private void initMenu() {
        connectItem = new JMenuItem("Connect");
        connectItem.setEnabled(false);
        connectItem.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                for (JCheckBoxMenuItem portItem : portItems) {
                    portItem.setEnabled(false);
                }
                for (JComponent component : components) {
                    component.setEnabled(true);
                }

                connectItem.setEnabled(false);
                disconnectItem.setEnabled(true);

                try {
                    serial.setPortName(currentItemPort.getText());
                    serial.connect();
                } catch (SerialPortException ex) {
                    ex.printStackTrace();
                }
            }
        });

        disconnectItem = new JMenuItem("Disconnect");
        disconnectItem.setEnabled(false);
        disconnectItem.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                connectItem.setEnabled(true);
                disconnectItem.setEnabled(false);

                for (JComponent component : components) {
                    component.setEnabled(false);
                }
                for (JCheckBoxMenuItem portItem : portItems) {
                    portItem.setEnabled(true);
                }

                rSlider.setValue(0);
                gSlider.setValue(0);
                bSlider.setValue(0);

                try {
                    serial.disconnect();
                } catch (SerialPortException ex) {
                    ex.printStackTrace();
                }
            }
        });

        JMenu actionMenu = new JMenu("Action");
        actionMenu.add(connectItem);
        actionMenu.add(disconnectItem);

        JMenu serialPortMenu = new JMenu("Serial Port");

        for (String port : SerialUtil.getPorts()) {
            JCheckBoxMenuItem portItem = new JCheckBoxMenuItem(port);
            portItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    JCheckBoxMenuItem portItem = (JCheckBoxMenuItem) e.getSource();

                    if (currentItemPort == null) {
                        currentItemPort = portItem;
                        currentItemPort.setState(true);

                        connectItem.setEnabled(true);
                    } else {
                        if (portItem == currentItemPort) {
                            currentItemPort.setState(false);
                            currentItemPort = null;

                            connectItem.setEnabled(false);
                        } else {
                            currentItemPort.setState(false);
                            currentItemPort = portItem;
                            currentItemPort.setState(true);
                        }
                    }
                }
            });

            serialPortMenu.add(portItem);
            portItems.add(portItem);
        }

        JMenuBar menuBar = new JMenuBar();
        menuBar.add(actionMenu);
        menuBar.add(serialPortMenu);

        setJMenuBar(menuBar);
    }