//TODO remove after testing
public static void layoutInit() {
        Dimension dimension = new Dimension(560, 320);
        if (OperatingSystem.getCurrent() == OperatingSystem.MACOS) {
            dimension.setSize(dimension.getWidth() * PopupBase.MACOS_WIDTH_SCALE, dimension.getHeight());
        }
        FRAME.setPreferredSize(dimension);
        LOG_BTN.addActionListener((e) -> {
            if (!PopupBase.isAlive(LogFrame.class)) {
                new LogFrame();
            } else {
                PopupBase.getAlive(LogFrame.class).reopen();
            }
        });
        JS_BTN.addActionListener((e) -> {
            MainJDEC.IS_ENABLED.setSelected(false);
            MainJDEC.IS_ENABLED.setEnabled(false);
            if (!PopupBase.isAlive(JoystickFrame.class)) {
                new JoystickFrame();
            } else {
                PopupBase.getAlive(JoystickFrame.class).reopen();
            }
        });
        STATS_BTN.addActionListener((e) -> {
            if (!PopupBase.isAlive(StatsFrame.class)) {
                new StatsFrame();
            } else {
                PopupBase.getAlive(StatsFrame.class).reopen();
            }
        });
        NT_BTN.addActionListener((e) -> {
            if (!PopupBase.isAlive(NTFrame.class)) {
                NT_FRAME = new NTFrame();
            } else {
                PopupBase.getAlive(NTFrame.class).reopen();
            }
        });
        USB_CONNECT.addActionListener((e) -> {
            Thread reload = new Thread() {
                @Override
                public void run() {
                    NetworkReloader.reloadRio(Protocol.UDP);
                    NetworkReloader.reloadRio(Protocol.TCP);
                    super.run();
                    interrupt();
                }
            };
            reload.start();
        });
        RESTART_CODE_BTN.addActionListener(e -> IS_ENABLED.setSelected(false));
        //TODO remove after testing
        TEAM_NUMBER.setText("localhost");
        TEAM_NUMBER.getDocument().addDocumentListener(new TeamNumListener());
        IS_ENABLED.setEnabled(false);
        GlobalScreen.addNativeKeyListener(GlobalKeyListener.INSTANCE
                .addKeyEvent(NativeKeyEvent.VC_ENTER, () -> MainJDEC.IS_ENABLED.setSelected(false))
                .addKeyEvent(NativeKeyEvent.VC_SPACE, MainJDEC.ESTOP_BTN::doClick));
        GBCPanelBuilder endr = base.clone().setAnchor(GridBagConstraints.LINE_END).setFill(GridBagConstraints.NONE);
        base.clone().setPos(0, 0, 6, 1).setFill(GridBagConstraints.NONE).build(TITLE);
        base.clone().setPos(0, 1, 6, 1).setFill(GridBagConstraints.NONE).build(LINK);
        base.clone().setPos(5, 0, 1, 2).setFill(GridBagConstraints.NONE).build(new JLabel(new ImageIcon(MainFrame.ICON_MIN)));
        base.clone().setPos(0, 2, 1, 1).build(IS_ENABLED);
        base.clone().setPos(1, 2, 1, 1).build(ROBOT_DRIVE_MODE);
        base.clone().setPos(0, 3, 2, 1).setFill(GridBagConstraints.NONE).build(new JLabel("Alliance Station"));
        base.clone().setPos(0, 4, 1, 1).build(ALLIANCE_NUM);
        base.clone().setPos(1, 4, 1, 1).build(ALLIANCE_COLOR);
        endr.clone().setPos(0, 5, 1, 1).build(new JLabel("Team Number:"));
        base.clone().setPos(1, 5, 1, 1).setAnchor(GridBagConstraints.LINE_START).build(TEAM_NUMBER);
        endr.clone().setPos(0, 6, 1, 1).build(new JLabel("Game Data:"));
        base.clone().setPos(1, 6, 1, 1).setAnchor(GridBagConstraints.LINE_START).build(GAME_DATA);
        endr.clone().setPos(0, 7, 1, 1).build(new JLabel("Protocol Year:"));
        base.clone().setPos(1, 7, 1, 1).setAnchor(GridBagConstraints.LINE_START).build(PROTOCOL_YEAR);
        base.clone().setPos(2, 2, 2, 1).build(RESTART_CODE_BTN);
        base.clone().setPos(2, 3, 2, 1).build(RESTART_ROBO_RIO_BTN);
        base.clone().setPos(2, 4, 2, 1).build(ESTOP_BTN);
        base.clone().setPos(2, 5, 1, 1).build(JS_BTN);
        base.clone().setPos(3, 5, 1, 1).build(STATS_BTN);
        base.clone().setPos(2, 6, 1, 1).build(NT_BTN);
        base.clone().setPos(3, 6, 1, 1).build(LOG_BTN);
        base.clone().setPos(2, 7, 1, 1).build(FMS_CONNECT);
        base.clone().setPos(3, 7, 1, 1).build(USB_CONNECT);
        base.clone().setPos(4, 2, 2, 1).setFill(GridBagConstraints.NONE).build(BAT_VOLTAGE);
        endr.clone().setPos(4, 3, 1, 1).build(new JLabel("Robot:"));
        base.clone().setPos(5, 3, 1, 1).setAnchor(GridBagConstraints.LINE_START).build(ROBOT_CONNECTION_STATUS);
        endr.clone().setPos(4, 4, 1, 1).build(new JLabel("Code: "));
        base.clone().setPos(5, 4, 1, 1).setAnchor(GridBagConstraints.LINE_START).build(ROBOT_CODE_STATUS);
        endr.clone().setPos(4, 5, 1, 1).build(new JLabel("EStop: "));
        base.clone().setPos(5, 5, 1, 1).setAnchor(GridBagConstraints.LINE_START).build(ESTOP_STATUS);
        endr.clone().setPos(4, 6, 1, 1).build(new JLabel("FMS: "));
        base.clone().setPos(5, 6, 1, 1).setAnchor(GridBagConstraints.LINE_START).build(FMS_CONNECTION_STATUS);
        endr.clone().setPos(4, 7, 1, 1).build(new JLabel("Time: "));
        base.clone().setPos(5, 7, 1, 1).setAnchor(GridBagConstraints.LINE_START).build(MATCH_TIME);
    }
});
RESTART_CODE_BTN.addActionListener(e -> IS_ENABLED.setSelected(false));
//TODO remove after testing
TEAM_NUMBER.setText("localhost");
TEAM_NUMBER.getDocument().addDocumentListener(new TeamNumListener());
public void run() {
NetworkReloader.reloadRio(Protocol.UDP);
NetworkReloader.reloadRio(Protocol.TCP);
super.run();
interrupt();
}
};
reload.start();
});
RESTART_CODE_BTN.addActionListener(e -> IS_ENABLED.setSelected(false));
//TODO remove after testing
TEAM_NUMBER.setText("localhost");
TEAM_NUMBER.getDocument().addDocumentListener(new TeamNumListener());
IS_ENABLED.setEnabled(false);
GlobalScreen.addNativeKeyListener(GlobalKeyListener.INSTANCE
.addKeyEvent(NativeKeyEvent.VC_ENTER, () -> MainJDEC.IS_ENABLED.setSelected(false))
.addKeyEvent(NativeKeyEvent.VC_SPACE, MainJDEC.ESTOP_BTN::doClick));
GBCPanelBuilder endr = base.clone().setAnchor(GridBagConstraints.LINE_END).setFill(GridBagConstraints.NONE);
base.clone().setPos(0, 0, 6, 1).setFill(GridBagConstraints.NONE).build(TITLE);
base.clone().setPos(0, 1, 6, 1).setFill(GridBagConstraints.NONE).build(LINK);
base.clone().setPos(5, 0, 1, 2).setFill(GridBagConstraints.NONE).build(new JLabel(new ImageIcon(MainFrame.ICON_MIN)));
NT_BTN.addActionListener((e) -> {
if (!PopupBase.isAlive(NTFrame.class)) {
NT_FRAME = new NTFrame();
} else {
PopupBase.getAlive(NTFrame.class).reopen();
}
});
USB_CONNECT.addActionListener((e) -> {
Thread reload = new Thread() {
@Override
public void run() {
NetworkReloader.reloadRio(Protocol.UDP);
NetworkReloader.reloadRio(Protocol.TCP);
super.run();
interrupt();
}
};
reload.start();
});
RESTART_CODE_BTN.addActionListener(e -> IS_ENABLED.setSelected(false));
//TODO remove after testing
TEAM_NUMBER.setText("localhost");
TEAM_NUMBER.getDocument().addDocumentListener(new TeamNumListener());
IS_ENABLED.setEnabled(false);
GlobalScreen.addNativeKeyListener(GlobalKeyListener.INSTANCE
.addKeyEvent(NativeKeyEvent.VC_ENTER, () -> MainJDEC.IS_ENABLED.setSelected(false))
.addKeyEvent(NativeKeyEvent.VC_SPACE, MainJDEC.ESTOP_BTN::doClick));
GBCPanelBuilder endr = base.clone().setAnchor(GridBagConstraints.LINE_END).setFill(GridBagConstraints.NONE);
base.clone().setPos(0, 0, 6, 1).setFill(GridBagConstraints.NONE).build(TITLE);
base.clone().setPos(0, 1, 6, 1).setFill(GridBagConstraints.NONE).build(LINK);
base.clone().setPos(5, 0, 1, 2).setFill(GridBagConstraints.NONE).build(new JLabel(new ImageIcon(MainFrame.ICON_MIN)));
base.clone().setPos(0, 2, 1, 1).build(IS_ENABLED);
base.clone().setPos(1, 2, 1, 1).build(ROBOT_DRIVE_MODE);
base.clone().setPos(0, 3, 2, 1).setFill(GridBagConstraints.NONE).build(new JLabel("Alliance Station"));
base.clone().setPos(0, 4, 1, 1).build(ALLIANCE_NUM);
base.clone().setPos(1, 4, 1, 1).build(ALLIANCE_COLOR);
endr.clone().setPos(0, 5, 1, 1).build(new JLabel("Team Number:"));
base.clone().setPos(1, 5, 1, 1).setAnchor(GridBagConstraints.LINE_START).build(TEAM_NUMBER);
endr.clone().setPos(0, 6, 1, 1).build(new JLabel("Game Data:"));
base.clone().setPos(1, 6, 1, 1).setAnchor(GridBagConstraints.LINE_START).build(GAME_DATA);
endr.clone().setPos(0, 7, 1, 1).build(new JLabel("Protocol Year:"));