Example usage for javax.swing JMenuBar JMenuBar

List of usage examples for javax.swing JMenuBar JMenuBar

Introduction

In this page you can find the example usage for javax.swing JMenuBar JMenuBar.

Prototype

public JMenuBar() 

Source Link

Document

Creates a new menu bar.

Usage

From source file:JXTransformer.java

public TransformerDemo() {
        super("Transformer demo");
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        JMenuBar bar = new JMenuBar();
        JMenu lafMenu = new JMenu("LaF");

        JMenuItem winLaf = new JMenuItem("Windows LaF");
        lafMenu.add(winLaf);//from   ww w .  java2  s.c o  m
        winLaf.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                setLaf("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
            }
        });
        JMenuItem motifLaf = new JMenuItem("Motif LaF");
        lafMenu.add(motifLaf);
        motifLaf.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                setLaf("com.sun.java.swing.plaf.motif.MotifLookAndFeel");
            }
        });
        bar.add(lafMenu);
        JMenuItem metalLaf = new JMenuItem("Metal LaF");
        lafMenu.add(metalLaf);
        metalLaf.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                setLaf("javax.swing.plaf.metal.MetalLookAndFeel");
            }
        });

        JMenu settingsMenu = new JMenu("Settings");
        settingsMenu.setMnemonic(KeyEvent.VK_S);
        JMenuItem item = new JMenuItem("Reset sliders", KeyEvent.VK_R);
        item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_R, InputEvent.ALT_MASK));
        item.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                rotationSlider.setValue(0);
                scalingSlider.setValue(100);
                shearingSlider.setValue(0);
            }
        });
        settingsMenu.add(item);
        bar.add(settingsMenu);
        setJMenuBar(bar);

        JPanel panel = new JPanel(new BorderLayout());
        panel.add(createDemoPanel());
        panel.add(createStressTestPanel(), BorderLayout.EAST);
        add(new JScrollPane(panel));
        add(new JScrollPane(createToolPanel()), BorderLayout.SOUTH);
        pack();
    }

From source file:com.tiempometa.muestradatos.JMuestraDatos.java

private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY
    // //GEN-BEGIN:initComponents
    ResourceBundle bundle = ResourceBundle.getBundle("com.tiempometa.muestradatos.muestradatos");
    menuBar1 = new JMenuBar();
    menu1 = new JMenu();
    configMenuItem = new JMenuItem();
    importTagsMenuItem = new JMenuItem();
    exportTagsMenuItem = new JMenuItem();
    clearTagsMenuItem = new JMenuItem();
    exitMenuItem = new JMenuItem();
    menu3 = new JMenu();
    aboutUsMenuItem = new JMenuItem();
    configureJavaMenuItem = new JMenuItem();
    panel5 = new JPanel();
    panel3 = new JPanel();
    panel4 = new JPanel();
    tabbedPane1 = new JTabbedPane();
    panel2 = new JPanel();
    label9 = new JLabel();
    label10 = new JLabel();
    label3 = new JLabel();
    readerPortLabel = new JLabel();
    label11 = new JLabel();
    boxIpAddressLabel = new JLabel();
    label4 = new JLabel();
    readerStatusLabel = new JLabel();
    label12 = new JLabel();
    boxTypeLabel = new JLabel();
    label2 = new JLabel();
    rssiLevelLabel = new JLabel();
    label13 = new JLabel();
    preferredReaderLabel = new JLabel();
    label5 = new JLabel();
    regionLabel = new JLabel();
    label14 = new JLabel();
    preferredAntenaLabel = new JLabel();
    label6 = new JLabel();
    readPowerLabel = new JLabel();
    label7 = new JLabel();
    writePowerLevel = new JLabel();
    usbConnectButton = new JButton();
    boxConnectButton = new JButton();
    panel1 = new JPanel();
    verifyDataButton = new JButton();
    loadReadingsButton = new JButton();
    readTagButton = new JButton();
    countTagsButton = new JButton();
    programTagButton = new JButton();
    panel8 = new JPanel();
    setBoxTimeButton = new JButton();
    getBoxTimeButton = new JButton();
    label20 = new JLabel();
    label19 = new JLabel();
    systemTimeLabel = new JLabel();
    foxberryTimeLabel = new JLabel();
    foxberryTimeDiffLabel = new JLabel();
    panel6 = new JPanel();
    label21 = new JLabel();
    label1 = new JLabel();
    usbStatusLabel = new JLabel();
    label16 = new JLabel();
    tcpStatusLabel = new JLabel();
    label8 = new JLabel();
    databaseLabel = new JLabel();
    panel7 = new JPanel();
    CellConstraints cc = new CellConstraints();

    //======== this ========
    setTitle(bundle.getString("JMuestraDatos.this.title"));
    setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    setIconImage(//from  w w w .ja  va 2s.com
            new ImageIcon(getClass().getResource("/com/tiempometa/resources/tiempometa_icon_large_alpha.png"))
                    .getImage());
    setResizable(false);
    Container contentPane = getContentPane();
    contentPane.setLayout(new BorderLayout());

    //======== menuBar1 ========
    {

        //======== menu1 ========
        {
            menu1.setText(bundle.getString("JMuestraDatos.menu1.text"));

            //---- configMenuItem ----
            configMenuItem.setText(bundle.getString("JMuestraDatos.configMenuItem.text"));
            configMenuItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    configMenuItemActionPerformed(e);
                }
            });
            menu1.add(configMenuItem);

            //---- importTagsMenuItem ----
            importTagsMenuItem.setText(bundle.getString("JMuestraDatos.importTagsMenuItem.text"));
            importTagsMenuItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    importTagsMenuItemActionPerformed(e);
                }
            });
            menu1.add(importTagsMenuItem);

            //---- exportTagsMenuItem ----
            exportTagsMenuItem.setText(bundle.getString("JMuestraDatos.exportTagsMenuItem.text"));
            exportTagsMenuItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    exportTagsMenuItemActionPerformed(e);
                }
            });
            menu1.add(exportTagsMenuItem);

            //---- clearTagsMenuItem ----
            clearTagsMenuItem.setText(bundle.getString("JMuestraDatos.clearTagsMenuItem.text"));
            clearTagsMenuItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    clearTagsMenuItemActionPerformed(e);
                }
            });
            menu1.add(clearTagsMenuItem);
            menu1.addSeparator();

            //---- exitMenuItem ----
            exitMenuItem.setText(bundle.getString("JMuestraDatos.exitMenuItem.text"));
            exitMenuItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    menuItem2ActionPerformed(e);
                }
            });
            menu1.add(exitMenuItem);
        }
        menuBar1.add(menu1);

        //======== menu3 ========
        {
            menu3.setText(bundle.getString("JMuestraDatos.menu3.text"));

            //---- aboutUsMenuItem ----
            aboutUsMenuItem.setText(bundle.getString("JMuestraDatos.aboutUsMenuItem.text"));
            aboutUsMenuItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    aboutUsMenuItemActionPerformed(e);
                }
            });
            menu3.add(aboutUsMenuItem);

            //---- configureJavaMenuItem ----
            configureJavaMenuItem.setText(bundle.getString("JMuestraDatos.configureJavaMenuItem.text"));
            configureJavaMenuItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    configureJavaMenuItemActionPerformed(e);
                }
            });
            menu3.add(configureJavaMenuItem);
        }
        menuBar1.add(menu3);
    }
    setJMenuBar(menuBar1);

    //======== panel5 ========
    {
        panel5.setLayout(new FormLayout(
                new ColumnSpec[] { new ColumnSpec(Sizes.dluX(18)), FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                        new ColumnSpec(Sizes.dluX(343)) },
                new RowSpec[] { new RowSpec(Sizes.dluY(17)), FormFactory.LINE_GAP_ROWSPEC,
                        new RowSpec(Sizes.dluY(17)) }));
    }
    contentPane.add(panel5, BorderLayout.NORTH);

    //======== panel3 ========
    {
        panel3.setLayout(new FormLayout(
                new ColumnSpec[] { new ColumnSpec(Sizes.dluX(16)), FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                        FormFactory.DEFAULT_COLSPEC },
                new RowSpec[] { FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                        FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                        FormFactory.DEFAULT_ROWSPEC }));
    }
    contentPane.add(panel3, BorderLayout.WEST);

    //======== panel4 ========
    {
        panel4.setLayout(
                new FormLayout(
                        new ColumnSpec[] { new ColumnSpec(Sizes.dluX(410)),
                                FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC },
                        RowSpec.decodeSpecs("245dlu")));

        //======== tabbedPane1 ========
        {
            tabbedPane1.setFont(new Font("Tahoma", Font.BOLD, 16));

            //======== panel2 ========
            {
                panel2.setLayout(new FormLayout(
                        new ColumnSpec[] { new ColumnSpec(Sizes.dluX(25)),
                                FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(Sizes.dluX(89)),
                                FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(Sizes.dluX(73)),
                                FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(Sizes.dluX(17)),
                                FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(Sizes.dluX(84)),
                                FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(Sizes.dluX(80)) },
                        new RowSpec[] { new RowSpec(Sizes.dluY(20)), FormFactory.LINE_GAP_ROWSPEC,
                                FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                                FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                                FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                                FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                                FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                                FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                                FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                                FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                                new RowSpec(Sizes.DLUY8) }));

                //---- label9 ----
                label9.setText(bundle.getString("JMuestraDatos.label9.text"));
                label9.setFont(new Font("Tahoma", Font.BOLD, 16));
                label9.setIcon(new ImageIcon(getClass().getResource("/com/tiempometa/resources/usb_128.png")));
                label9.setHorizontalAlignment(SwingConstants.CENTER);
                panel2.add(label9, cc.xywh(3, 3, 3, 1));

                //---- label10 ----
                label10.setText(bundle.getString("JMuestraDatos.label10.text"));
                label10.setFont(new Font("Tahoma", Font.BOLD, 16));
                label10.setIcon(
                        new ImageIcon(getClass().getResource("/com/tiempometa/resources/briefcase_128.png")));
                label10.setHorizontalAlignment(SwingConstants.CENTER);
                panel2.add(label10, cc.xywh(9, 3, 3, 1));

                //---- label3 ----
                label3.setText(bundle.getString("JMuestraDatos.label3.text"));
                label3.setFont(new Font("Tahoma", Font.BOLD, 14));
                panel2.add(label3, cc.xy(3, 5));

                //---- readerPortLabel ----
                readerPortLabel.setText(bundle.getString("JMuestraDatos.readerPortLabel.text"));
                panel2.add(readerPortLabel, cc.xy(5, 5));

                //---- label11 ----
                label11.setText(bundle.getString("JMuestraDatos.label11.text"));
                label11.setFont(new Font("Tahoma", Font.BOLD, 14));
                panel2.add(label11, cc.xy(9, 5));

                //---- boxIpAddressLabel ----
                boxIpAddressLabel.setText(bundle.getString("JMuestraDatos.boxIpAddressLabel.text"));
                panel2.add(boxIpAddressLabel, cc.xy(11, 5));

                //---- label4 ----
                label4.setText(bundle.getString("JMuestraDatos.label4.text"));
                label4.setFont(new Font("Tahoma", Font.BOLD, 14));
                panel2.add(label4, cc.xy(3, 7));

                //---- readerStatusLabel ----
                readerStatusLabel.setText(bundle.getString("JMuestraDatos.readerStatusLabel.text"));
                panel2.add(readerStatusLabel, cc.xy(5, 7));

                //---- label12 ----
                label12.setText(bundle.getString("JMuestraDatos.label12.text"));
                label12.setFont(new Font("Tahoma", Font.BOLD, 14));
                panel2.add(label12, cc.xy(9, 7));

                //---- boxTypeLabel ----
                boxTypeLabel.setText(bundle.getString("JMuestraDatos.boxTypeLabel.text"));
                panel2.add(boxTypeLabel, cc.xy(11, 7));

                //---- label2 ----
                label2.setText(bundle.getString("JMuestraDatos.label2.text"));
                label2.setFont(new Font("Tahoma", Font.BOLD, 14));
                panel2.add(label2, cc.xy(3, 9));

                //---- rssiLevelLabel ----
                rssiLevelLabel.setText(bundle.getString("JMuestraDatos.rssiLevelLabel.text"));
                panel2.add(rssiLevelLabel, cc.xy(5, 9));

                //---- label13 ----
                label13.setText(bundle.getString("JMuestraDatos.label13.text"));
                label13.setFont(new Font("Tahoma", Font.BOLD, 14));
                panel2.add(label13, cc.xy(9, 9));

                //---- preferredReaderLabel ----
                preferredReaderLabel.setText(bundle.getString("JMuestraDatos.preferredReaderLabel.text"));
                panel2.add(preferredReaderLabel, cc.xy(11, 9));

                //---- label5 ----
                label5.setText(bundle.getString("JMuestraDatos.label5.text"));
                label5.setFont(new Font("Tahoma", Font.BOLD, 14));
                panel2.add(label5, cc.xy(3, 11));

                //---- regionLabel ----
                regionLabel.setText(bundle.getString("JMuestraDatos.regionLabel.text"));
                panel2.add(regionLabel, cc.xy(5, 11));

                //---- label14 ----
                label14.setText(bundle.getString("JMuestraDatos.label14.text"));
                label14.setFont(new Font("Tahoma", Font.BOLD, 14));
                panel2.add(label14, cc.xy(9, 11));

                //---- preferredAntenaLabel ----
                preferredAntenaLabel.setText(bundle.getString("JMuestraDatos.preferredAntenaLabel.text"));
                panel2.add(preferredAntenaLabel, cc.xy(11, 11));

                //---- label6 ----
                label6.setText(bundle.getString("JMuestraDatos.label6.text"));
                label6.setFont(new Font("Tahoma", Font.BOLD, 14));
                panel2.add(label6, cc.xy(3, 13));

                //---- readPowerLabel ----
                readPowerLabel.setText(bundle.getString("JMuestraDatos.readPowerLabel.text"));
                panel2.add(readPowerLabel, cc.xy(5, 13));

                //---- label7 ----
                label7.setText(bundle.getString("JMuestraDatos.label7.text"));
                label7.setFont(new Font("Tahoma", Font.BOLD, 14));
                panel2.add(label7, cc.xy(3, 15));

                //---- writePowerLevel ----
                writePowerLevel.setText(bundle.getString("JMuestraDatos.writePowerLevel.text"));
                panel2.add(writePowerLevel, cc.xy(5, 15));

                //---- usbConnectButton ----
                usbConnectButton.setText(bundle.getString("JMuestraDatos.usbConnectButton.text"));
                usbConnectButton.setFont(new Font("Tahoma", Font.BOLD, 14));
                usbConnectButton.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        usbConnectButtonActionPerformed(e);
                    }
                });
                panel2.add(usbConnectButton, cc.xywh(3, 17, 3, 1));

                //---- boxConnectButton ----
                boxConnectButton.setText(bundle.getString("JMuestraDatos.boxConnectButton.text"));
                boxConnectButton.setFont(new Font("Tahoma", Font.BOLD, 14));
                boxConnectButton.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        boxConnectButtonActionPerformed(e);
                    }
                });
                panel2.add(boxConnectButton, cc.xywh(9, 17, 3, 1));
            }
            tabbedPane1.addTab(bundle.getString("JMuestraDatos.panel2.tab.title"), panel2);

            //======== panel1 ========
            {
                panel1.setLayout(new FormLayout(
                        new ColumnSpec[] { new ColumnSpec(Sizes.dluX(35)),
                                FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(Sizes.dluX(120)),
                                FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(Sizes.dluX(47)),
                                FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(Sizes.dluX(130)),
                                FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(Sizes.dluX(28)) },
                        new RowSpec[] { new RowSpec(Sizes.dluY(15)), FormFactory.LINE_GAP_ROWSPEC,
                                FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                                FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                                FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                                FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                                FormFactory.DEFAULT_ROWSPEC }));

                //---- verifyDataButton ----
                verifyDataButton.setText(bundle.getString("JMuestraDatos.verifyDataButton.text"));
                verifyDataButton.setIcon(
                        new ImageIcon(getClass().getResource("/com/tiempometa/resources/check_64.png")));
                verifyDataButton.setHorizontalAlignment(SwingConstants.LEFT);
                verifyDataButton.setRolloverIcon(null);
                verifyDataButton.setPressedIcon(null);
                verifyDataButton.setFont(new Font("Tahoma", Font.BOLD, 16));
                verifyDataButton.setEnabled(false);
                verifyDataButton.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        verifyDataButtonActionPerformed(e);
                    }
                });
                panel1.add(verifyDataButton, cc.xywh(3, 3, 3, 1));

                //---- loadReadingsButton ----
                loadReadingsButton.setText(bundle.getString("JMuestraDatos.loadReadingsButton.text"));
                loadReadingsButton.setIcon(
                        new ImageIcon(getClass().getResource("/com/tiempometa/resources/load_64.png")));
                loadReadingsButton.setHorizontalAlignment(SwingConstants.LEFT);
                loadReadingsButton.setFont(new Font("Tahoma", Font.BOLD, 16));
                loadReadingsButton.setEnabled(false);
                loadReadingsButton.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        loadReadingsButtonActionPerformed(e);
                    }
                });
                panel1.add(loadReadingsButton, cc.xywh(7, 3, 3, 1));

                //---- readTagButton ----
                readTagButton.setText(bundle.getString("JMuestraDatos.readTagButton.text"));
                readTagButton.setIcon(
                        new ImageIcon(getClass().getResource("/com/tiempometa/resources/scan_64.png")));
                readTagButton.setHorizontalAlignment(SwingConstants.LEFT);
                readTagButton.setFont(new Font("Tahoma", Font.BOLD, 16));
                readTagButton.setEnabled(false);
                readTagButton.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        readTagButtonActionPerformed(e);
                    }
                });
                panel1.add(readTagButton, cc.xywh(3, 5, 3, 1));

                //---- countTagsButton ----
                countTagsButton.setText(bundle.getString("JMuestraDatos.countTagsButton.text"));
                countTagsButton.setIcon(
                        new ImageIcon(getClass().getResource("/com/tiempometa/resources/counter_64.png")));
                countTagsButton.setHorizontalAlignment(SwingConstants.LEFT);
                countTagsButton.setFont(new Font("Tahoma", Font.BOLD, 16));
                countTagsButton.setEnabled(false);
                countTagsButton.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        countTagsButtonActionPerformed(e);
                    }
                });
                panel1.add(countTagsButton, cc.xywh(7, 5, 3, 1));

                //---- programTagButton ----
                programTagButton.setText(bundle.getString("JMuestraDatos.programTagButton.text"));
                programTagButton.setIcon(
                        new ImageIcon(getClass().getResource("/com/tiempometa/resources/record_64.png")));
                programTagButton.setHorizontalAlignment(SwingConstants.LEFT);
                programTagButton.setFont(new Font("Tahoma", Font.BOLD, 16));
                programTagButton.setEnabled(false);
                programTagButton.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        programTagButtonActionPerformed(e);
                    }
                });
                panel1.add(programTagButton, cc.xywh(3, 7, 3, 1));
            }
            tabbedPane1.addTab(bundle.getString("JMuestraDatos.panel1.tab.title"), panel1);

            //======== panel8 ========
            {
                panel8.setLayout(new FormLayout(
                        new ColumnSpec[] { new ColumnSpec(Sizes.dluX(35)),
                                FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(Sizes.dluX(160)),
                                FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(Sizes.dluX(160)) },
                        new RowSpec[] { new RowSpec(Sizes.dluY(15)), FormFactory.LINE_GAP_ROWSPEC,
                                FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                                FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                                FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                                FormFactory.DEFAULT_ROWSPEC }));

                //---- setBoxTimeButton ----
                setBoxTimeButton.setText(bundle.getString("JMuestraDatos.setBoxTimeButton.text"));
                setBoxTimeButton.setIcon(
                        new ImageIcon(getClass().getResource("/com/tiempometa/resources/set_time_64.png")));
                setBoxTimeButton.setHorizontalAlignment(SwingConstants.LEFT);
                setBoxTimeButton.setFont(new Font("Tahoma", Font.BOLD, 16));
                setBoxTimeButton.setEnabled(false);
                setBoxTimeButton.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        setBoxTimeButtonActionPerformed(e);
                    }
                });
                panel8.add(setBoxTimeButton, cc.xy(3, 3));

                //---- getBoxTimeButton ----
                getBoxTimeButton.setText(bundle.getString("JMuestraDatos.getBoxTimeButton.text"));
                getBoxTimeButton.setIcon(
                        new ImageIcon(getClass().getResource("/com/tiempometa/resources/get_time_64.png")));
                getBoxTimeButton.setHorizontalAlignment(SwingConstants.LEFT);
                getBoxTimeButton.setFont(new Font("Tahoma", Font.BOLD, 16));
                getBoxTimeButton.setEnabled(false);
                getBoxTimeButton.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        getBoxTimeButtonActionPerformed(e);
                    }
                });
                panel8.add(getBoxTimeButton, cc.xy(5, 3));

                //---- label20 ----
                label20.setText(bundle.getString("JMuestraDatos.label20.text"));
                label20.setFont(new Font("Tahoma", Font.BOLD, 14));
                panel8.add(label20, cc.xy(3, 5));

                //---- label19 ----
                label19.setText(bundle.getString("JMuestraDatos.label19.text"));
                label19.setFont(new Font("Tahoma", Font.BOLD, 14));
                panel8.add(label19, cc.xy(5, 5));
                panel8.add(systemTimeLabel, cc.xy(3, 7));
                panel8.add(foxberryTimeLabel, cc.xy(5, 7));
                panel8.add(foxberryTimeDiffLabel, cc.xy(5, 9));
            }
            tabbedPane1.addTab(bundle.getString("JMuestraDatos.panel8.tab.title"), panel8);
        }
        panel4.add(tabbedPane1, cc.xy(1, 1));
    }
    contentPane.add(panel4, BorderLayout.CENTER);

    //======== panel6 ========
    {
        panel6.setLayout(new FormLayout(
                new ColumnSpec[] { new ColumnSpec(Sizes.dluX(17)), FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                        FormFactory.DEFAULT_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                        FormFactory.DEFAULT_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                        new ColumnSpec(Sizes.dluX(65)), FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                        FormFactory.DEFAULT_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                        new ColumnSpec(Sizes.dluX(65)), FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                        new ColumnSpec(Sizes.dluX(199)) },
                new RowSpec[] { FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                        FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
                        FormFactory.LINE_GAP_ROWSPEC, new RowSpec(Sizes.dluY(10)) }));

        //---- label21 ----
        label21.setText(bundle.getString("JMuestraDatos.label21.text"));
        label21.setFont(new Font("Tahoma", Font.BOLD, 16));
        panel6.add(label21, cc.xy(3, 1));

        //---- label1 ----
        label1.setText(bundle.getString("JMuestraDatos.label1.text"));
        label1.setFont(new Font("Tahoma", Font.PLAIN, 14));
        panel6.add(label1, cc.xy(5, 1));

        //---- usbStatusLabel ----
        usbStatusLabel.setText(bundle.getString("JMuestraDatos.usbStatusLabel.text"));
        usbStatusLabel.setFont(new Font("Tahoma", Font.PLAIN, 14));
        panel6.add(usbStatusLabel, cc.xy(7, 1));

        //---- label16 ----
        label16.setText(bundle.getString("JMuestraDatos.label16.text"));
        label16.setFont(new Font("Tahoma", Font.PLAIN, 14));
        panel6.add(label16, cc.xy(9, 1));

        //---- tcpStatusLabel ----
        tcpStatusLabel.setText(bundle.getString("JMuestraDatos.tcpStatusLabel.text"));
        tcpStatusLabel.setFont(new Font("Tahoma", Font.PLAIN, 14));
        panel6.add(tcpStatusLabel, cc.xy(11, 1));

        //---- label8 ----
        label8.setText(bundle.getString("JMuestraDatos.label8.text"));
        label8.setFont(new Font("Tahoma", Font.BOLD, 16));
        panel6.add(label8, cc.xy(3, 3));

        //---- databaseLabel ----
        databaseLabel.setText(bundle.getString("JMuestraDatos.databaseLabel.text"));
        panel6.add(databaseLabel, cc.xywh(3, 5, 11, 1));
    }
    contentPane.add(panel6, BorderLayout.SOUTH);

    //======== panel7 ========
    {
        panel7.setLayout(new FormLayout(
                new ColumnSpec[] { FormFactory.DEFAULT_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                        FormFactory.DEFAULT_COLSPEC },
                new RowSpec[] { FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                        FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                        FormFactory.DEFAULT_ROWSPEC }));
    }
    contentPane.add(panel7, BorderLayout.EAST);
    setSize(740, 620);
    setLocationRelativeTo(getOwner());
    // //GEN-END:initComponents
}

From source file:io.gameover.utilities.pixeleditor.Pixelizer.java

private JMenuBar getAppMenuBar() {
    if (this.appMenuBar == null) {
        this.appMenuBar = new JMenuBar();

        JMenu menuOpen = new JMenu("File");
        JMenuItem openMenu = new JMenuItem("Open...");
        openMenu.setActionCommand(ACTION_OPEN);
        InternalActionListener actionListener = new InternalActionListener(this);
        openMenu.addActionListener(actionListener);
        menuOpen.add(openMenu);//  ww  w.  j a  v  a  2s .c  o  m

        JMenuItem saveMenuAsPng = new JMenuItem("Save as PNG...");
        saveMenuAsPng.setActionCommand(ACTION_SAVE_AS_PNG);
        saveMenuAsPng.addActionListener(actionListener);
        menuOpen.add(saveMenuAsPng);

        JMenuItem saveMenuAsGif = new JMenuItem("Save as GIF...");
        saveMenuAsGif.setActionCommand(ACTION_SAVE_AS_GIF);
        saveMenuAsGif.addActionListener(actionListener);
        menuOpen.add(saveMenuAsGif);

        this.appMenuBar.add(menuOpen);

        JMenu menuEdit = new JMenu("Edit");
        JMenuItem clearChangesMenu = new JMenuItem("Clear changes");
        clearChangesMenu.setActionCommand(ACTION_CLEAR);
        clearChangesMenu.addActionListener(actionListener);
        menuEdit.add(clearChangesMenu);
        JMenuItem clearSelectionMenu = new JMenuItem("Clear selection");
        clearSelectionMenu.setActionCommand(ACTION_CLEAR_SELECTION);
        clearSelectionMenu.addActionListener(actionListener);
        menuEdit.add(clearSelectionMenu);
        appMenuBar.add(menuEdit);
    }

    return appMenuBar;
}

From source file:com.github.fritaly.dualcommander.DualCommander.java

public DualCommander() {
    // TODO Generate a fat jar at build time
    super(String.format("Dual Commander %s", Utils.getApplicationVersion()));

    if (logger.isInfoEnabled()) {
        logger.info(String.format("Dual Commander %s", Utils.getApplicationVersion()));
    }//from w  ww  . j av a2s  .  c om

    try {
        // Apply the JGoodies L&F
        UIManager.setLookAndFeel(new WindowsLookAndFeel());
    } catch (Exception e) {
        // Not supposed to happen
    }

    // Layout, columns & rows
    setLayout(new MigLayout("insets 0px", "[grow]0px[grow]", "[grow]0px[]"));

    // Create a menu bar
    final JMenu fileMenu = new JMenu("File");
    fileMenu.add(new JMenuItem(preferencesAction));
    fileMenu.add(new JSeparator());
    fileMenu.add(new JMenuItem(quitAction));

    final JMenu helpMenu = new JMenu("Help");
    helpMenu.add(new JMenuItem(aboutAction));

    final JMenuBar menuBar = new JMenuBar();
    menuBar.add(fileMenu);
    menuBar.add(helpMenu);

    setJMenuBar(menuBar);

    this.leftPane = new TabbedPane(preferences);
    this.leftPane.setName("Left");
    this.leftPane.addChangeListener(this);
    this.leftPane.addKeyListener(this);
    this.leftPane.addFocusListener(this);

    this.rightPane = new TabbedPane(preferences);
    this.rightPane.setName("Right");
    this.rightPane.addChangeListener(this);
    this.rightPane.addKeyListener(this);
    this.rightPane.addFocusListener(this);

    // Adding the 2 components to the same sizegroup ensures they always
    // keep the same width
    getContentPane().add(leftPane, "grow, sizegroup g1");
    getContentPane().add(rightPane, "grow, sizegroup g1, wrap");

    // The 7 buttons must all have the same width (they must belong to the
    // same size group)
    final JPanel buttonPanel = new JPanel(
            new MigLayout("insets 0px", StringUtils.repeat("[grow, sizegroup g1]", 7), "[grow]"));
    buttonPanel.add(viewButton, "grow");
    buttonPanel.add(editButton, "grow");
    buttonPanel.add(copyButton, "grow");
    buttonPanel.add(moveButton, "grow");
    buttonPanel.add(mkdirButton, "grow");
    buttonPanel.add(deleteButton, "grow");
    buttonPanel.add(quitButton, "grow");

    getContentPane().add(buttonPanel, "grow, span 2");

    // Register shortcuts at a global level (not on every component)
    final InputMap inputMap = this.leftPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
    inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_F3, 0, true), "view");
    inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_F4, 0, true), "edit");
    inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_F5, 0, true), "copy");
    inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_F6, 0, true), "move");
    inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_F7, 0, true), "mkdir");
    inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_F8, 0, true), "delete");
    inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_F4, KeyEvent.ALT_DOWN_MASK), "quit");

    final ActionMap actionMap = this.leftPane.getActionMap();
    actionMap.put("view", viewAction);
    actionMap.put("edit", editAction);
    actionMap.put("copy", copyAction);
    actionMap.put("move", moveAction);
    actionMap.put("mkdir", mkdirAction);
    actionMap.put("delete", deleteAction);
    actionMap.put("quit", quitAction);

    addWindowListener(this);
    addKeyListener(this);

    // Listen to preference change events
    this.preferences.addPropertyChangeListener(this);

    // Reload the last configuration and init the left & right panels
    // accordingly
    final Preferences prefs = Preferences.userNodeForPackage(this.getClass());

    // The user preferences must be loaded first because they're needed to
    // init the UI
    this.preferences.init(prefs.node("user.preferences"));
    this.leftPane.init(prefs.node("left.panel"));
    this.rightPane.init(prefs.node("right.panel"));

    if (logger.isInfoEnabled()) {
        logger.info("Loaded preferences");
    }

    // Init the buttons
    refreshButtons(this.leftPane.getActiveBrowser().getSelection());

    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setExtendedState(JFrame.MAXIMIZED_BOTH);

    if (logger.isInfoEnabled()) {
        logger.info("UI initialized");
    }
}

From source file:net.jradius.client.gui.JRadiusSimulator.java

/**
 * This method initializes jJMenuBar/*  w w w .ja  va 2 s.c o  m*/
 * 
 * @return javax.swing.JMenuBar
 */
private JMenuBar getJJMenuBar() {
    if (jJMenuBar == null) {
        jJMenuBar = new JMenuBar();
        jJMenuBar.add(getFileMenu());
        jJMenuBar.add(getHelpMenu());
    }
    return jJMenuBar;
}

From source file:org.simbrain.plot.projection.ProjectionGui.java

/**
 * Creates the menu bar.//from  ww  w.j av  a2s  .co  m
 */
private void createAttachMenuBar() {

    final JMenuBar bar = new JMenuBar();
    final JMenu fileMenu = new JMenu("File");

    for (Action action : actionManager.getOpenSavePlotActions()) {
        fileMenu.add(action);
    }
    fileMenu.addSeparator();
    final JMenu exportImport = new JMenu("Export/Import...");
    fileMenu.add(exportImport);
    exportImport.add(ProjectionPlotActions.getImportData(getWorkspaceComponent().getProjectionModel()));
    exportImport.addSeparator();
    exportImport.add(ProjectionPlotActions.getExportDataHi(getWorkspaceComponent().getProjectionModel()));
    exportImport.add(ProjectionPlotActions.getExportDataLow(getWorkspaceComponent().getProjectionModel()));
    fileMenu.addSeparator();
    fileMenu.add(new CloseAction(this.getWorkspaceComponent()));

    final JMenu editMenu = new JMenu("Edit");
    final JMenuItem preferencesGeneral = new JMenuItem("General Preferences...");
    preferencesGeneral.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            ProjectionPreferencesDialog dialog = new ProjectionPreferencesDialog(
                    getWorkspaceComponent().getProjectionModel().getProjector());
            dialog.pack();
            dialog.setLocationRelativeTo(null);
            dialog.setVisible(true);
        }

    });
    editMenu.add(preferencesGeneral);

    final JMenuItem colorPrefs = new JMenuItem("Datapoint Coloring...");
    colorPrefs.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            DataPointColoringDialog dialog = new DataPointColoringDialog(
                    getWorkspaceComponent().getProjectionModel());
            dialog.pack();
            dialog.setLocationRelativeTo(null);
            dialog.setVisible(true);

        }

    });
    editMenu.add(colorPrefs);

    final JMenuItem dims = new JMenuItem("Set dimensions...");
    dims.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            String dimensions = JOptionPane.showInputDialog("Dimensions:");
            if (dimensions != null) {
                getWorkspaceComponent().getProjectionModel().getProjector().init(Integer.parseInt(dimensions));
            }

        }

    });
    // editMenu.add(dims);

    JMenu helpMenu = new JMenu("Help");
    JMenuItem helpItem = new JMenuItem(helpAction);
    helpMenu.add(helpItem);

    bar.add(fileMenu);
    bar.add(editMenu);
    bar.add(helpMenu);

    getParentFrame().setJMenuBar(bar);
}

From source file:net.sourceforge.entrainer.gui.EntrainerFX.java

private void addMenu() {
    JMenuBar bar = new JMenuBar();

    JMenu menu = new JMenu(FILE_MENU_NAME);
    addMnemonic(menu, KeyEvent.VK_F);

    menu.add(getStartItem());//ww w  .java2 s.  c o m
    menu.add(getStopItem());
    menu.add(new JSeparator());
    menu.add(getLoadXmlItem());
    menu.add(getClearXmlItem());
    menu.add(getEditXmlItem());
    menu.add(getNewXmlItem());
    menu.add(new JSeparator());
    menu.add(getExitItem());
    bar.add(menu);

    bar.add(getLookAndFeels());

    bar.add(intervalMenu);

    bar.add(getEspMenu());

    bar.add(getSocketMenu());

    JMenu help = new JMenu(HELP_MENU_NAME);
    addMnemonic(help, KeyEvent.VK_H);

    help.add(getAboutItem());
    help.add(getLicenseItem());
    help.add(getLocalDocItem());
    help.add(getRemoteDocItem());
    help.add(getSplashItem());
    help.add(getSplashOnStartupItem());
    bar.add(help);

    setJMenuBar(bar);
}

From source file:ucar.unidata.idv.flythrough.Flythrough.java

/**
 * _more_/*from  ww  w .j  a  v a 2  s.  co  m*/
 *
 * @return _more_
 */
public JMenuBar doMakeMenuBar() {
    JMenuBar menuBar = new JMenuBar();
    JMenu fileMenu = GuiUtils.makeDynamicMenu("File", this, "initFileMenu");
    JMenu editMenu = GuiUtils.makeDynamicMenu("Edit", this, "initEditMenu");
    JMenu viewMenu = GuiUtils.makeDynamicMenu("View", this, "initViewMenu");

    menuBar.add(fileMenu);
    menuBar.add(editMenu);
    menuBar.add(viewMenu);

    return menuBar;
}

From source file:de.whiledo.iliasdownloader2.swing.service.MainController.java

private JMenuBar initMenuBar() {
    JMenuBar menubar = new JMenuBar();
    {//  w  w w  .ja  v a 2  s  . co  m
        JMenu menu = new JMenu("Synchronisation");
        {
            JMenuItem m = new JMenuItem("Kurse auswhlen");
            m.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    chooseCourses();
                }
            });
            menu.add(m);
        }
        {
            JMenuItem m = new JMenuItem("Automatische Synchronisation");
            m.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    showAutoSyncSettings();
                }
            });
            menu.add(m);
        }
        {
            JMenuItem m = new JMenuItem("Neue Dateien zeigen");
            m.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    showNewFiles();
                }
            });
            menu.add(m);
        }
        menubar.add(menu);
    }
    {
        JMenu menu = new JMenu("Einstellungen");
        {
            JMenuItem m = new JMenuItem("Speicherpfad ndern");
            m.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    changeBaseDir();
                }
            });
            menu.add(m);
        }
        {
            JMenuItem m = new JMenuItem("Speicherpfad ffnen");
            m.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    openBaseDir();
                }
            });
            menu.add(m);
        }
        {
            JMenuItem m = new JMenuItem("Maximale Dateigre ndern");
            m.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    changeMaxFileSize();
                }
            });
            menu.add(m);
        }
        {
            final JCheckBoxMenuItem menuitem = new JCheckBoxMenuItem(
                    "Benachrichtigungen im Systemtray anzeigen");
            menuitem.setSelected(iliasProperties.isShowNotifications());
            menuitem.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    iliasProperties.setShowNotifications(!iliasProperties.isShowNotifications());
                    saveProperties(iliasProperties);
                    menuitem.setSelected(iliasProperties.isShowNotifications());
                }
            });
            menu.add(menuitem);
        }
        {
            menu.add(new JSeparator());
        }
        {
            JMenuItem m = new JMenuItem("Design ndern");
            m.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    changeLookAndFeel();
                }
            });
            menu.add(m);
        }
        {
            menu.add(new JSeparator());
        }
        {
            JMenuItem m = new JMenuItem("Server einstellen");
            m.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    chooseServer();
                }
            });
            menu.add(m);
        }
        menubar.add(menu);
    }
    {
        JMenu menu = new JMenu("Hilfe");
        {
            JMenuItem m = new JMenuItem("Fehler melden, Feedback geben");
            m.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    openFeedbackPage();
                }
            });
            menu.add(m);
        }
        {
            JMenuItem m = new JMenuItem("Webseite");
            m.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    openWebsite();
                }
            });
            menu.add(m);
        }
        {
            JMenuItem m = new JMenuItem("Android App");
            m.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    openAndroidWebsite();
                }
            });
            menu.add(m);
        }
        {
            JMenuItem m = new JMenuItem("Info");
            m.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    showInfo();
                }
            });
            menu.add(m);
        }
        menubar.add(menu);
    }
    return menubar;
}