Example usage for javax.swing JMenuBar setBorder

List of usage examples for javax.swing JMenuBar setBorder

Introduction

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

Prototype

@BeanProperty(preferred = true, visualUpdate = true, description = "The component's border.")
public void setBorder(Border border) 

Source Link

Document

Sets the border of this component.

Usage

From source file:MenuLayoutDemo.java

public JMenuBar createMenuBar() {
    JMenuBar menuBar = new JMenuBar();
    menuBar.setLayout(new BoxLayout(menuBar, BoxLayout.PAGE_AXIS));
    menuBar.add(createMenu("Menu 1"));
    menuBar.add(createMenu("Menu 2"));
    menuBar.add(createMenu("Menu 3"));

    menuBar.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 1, Color.BLACK));
    return menuBar;
}

From source file:org.isatools.isacreatorconfigurator.configui.DataEntryPanel.java

private JPanel createMenu() {
    JPanel topPanel = new JPanel(new GridLayout(1, 1));
    topPanel.setBackground(UIHelper.BG_COLOR);
    topPanel.setBorder(null);//from  w  w  w  .j a  v a  2s. c om

    JMenuBar menu_container = new JMenuBar();
    menu_container.setBorder(null);

    JMenu file = new JMenu("File");

    JMenuItem save = new JMenuItem("Save");
    save.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            try {
                updateFieldOrder();
                saveCurrentField(true, true);
                if (sourceFile == null) {
                    createOutput();
                } else {
                    save();
                }
            } catch (DataNotCompleteException dce) {
                showMessagePane(dce.getMessage(), JOptionPane.ERROR_MESSAGE);
            } catch (Exception e1) {
                showMessagePane(e1.getMessage(), JOptionPane.ERROR_MESSAGE);
            }
        }
    });

    JMenuItem createFile = new JMenuItem("Save As");
    createFile.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            try {
                saveCurrentField(true, true);
                createOutput();
            } catch (DataNotCompleteException dce) {
                showMessagePane(dce.getMessage(), JOptionPane.ERROR_MESSAGE);
            } catch (IOException e1) {
                showMessagePane("IO error occurred when saving file!", JOptionPane.ERROR_MESSAGE);
            } catch (Exception e1) {
                showMessagePane(e1.getMessage(), JOptionPane.ERROR_MESSAGE);
            }
        }
    });

    JMenuItem closeSession = new JMenuItem("Close session without saving");
    closeSession.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            tableFields.clear();
            applicationContainer.setCurrentPage(applicationContainer.getMp());
        }
    });

    file.add(save);
    file.add(createFile);
    file.add(closeSession);

    JMenu mappingMenu = new JMenu("Mappings");

    JMenuItem viewMappings = new JMenuItem("View Mappings", viewMappingsIcon);
    viewMappings.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    getApplicationContainer()
                            .showJDialogAsSheet(new TableMappingViewer(getThis(), getTableTypeMapping()));
                }
            });
        }
    });

    mappingMenu.add(viewMappings);

    JMenu validation = new JMenu("Validation");

    JMenuItem viewErrors = new JMenuItem("Show Validation Errors", viewMappingsIcon);
    viewErrors.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    Validator validator = new Validator();
                    validateAll(validator);

                    ValidationReport report = validator.getReport();

                    ConfigurationValidationUI validationUI = new ConfigurationValidationUI(tableFields.keySet(),
                            report);
                    validationUI.createGUI();
                    validationUI.setLocationRelativeTo(getApplicationContainer());
                    validationUI.setAlwaysOnTop(true);
                    validationUI.setVisible(true);
                }
            });

        }
    });

    validation.add(viewErrors);

    JMenu helpMenu = new JMenu("Help");

    JMenuItem about = new JMenuItem("About", aboutIcon);
    about.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    applicationContainer.setGlassPanelContents(aboutPanel);
                }
            });

        }
    });

    helpMenu.add(about);

    menu_container.add(file);
    menu_container.add(mappingMenu);
    menu_container.add(validation);
    menu_container.add(helpMenu);

    topPanel.add(menu_container);
    return topPanel;
}

From source file:pl.kotcrab.arget.gui.MainWindow.java

private void createMenuBars() {
    JMenuBar menuBar = new JMenuBar();
    menuBar.setBorder(new EmptyBorder(0, 0, 0, 0));
    setJMenuBar(menuBar);//  w  w  w.j  a  va2 s  . c o  m

    JMenu argetMenu = new JMenu("Arget");
    serversMenu = new JMenu("Servers");
    JMenu contactsMenu = new JMenu("Contacts");
    JMenu viewMenu = new JMenu("View");
    JMenu helpMenu = new JMenu("Help");

    menuBar.add(argetMenu);
    menuBar.add(serversMenu);
    menuBar.add(contactsMenu);
    menuBar.add(viewMenu);
    menuBar.add(helpMenu);

    argetMenu.add(new MenuItem("Options...", MenuEventType.ARGET_EDIT_OPTIONS));
    argetMenu.add(new JSeparator());
    argetMenu.add(new MenuItem("Logout", MenuEventType.ARGET_LOGOUT));
    argetMenu.add(new MenuItem("Exit", MenuEventType.ARGET_EXIT));

    serversMenu.add(new MenuItem("Add Server...", MenuEventType.SERVERS_ADD));
    serversMenu.add(new MenuItem("Manage Servers...", MenuEventType.SERVERS_MANAGE));
    serversMenu.add(new MenuItem("Disconnect", MenuEventType.SERVERS_DISCONNECT));
    serversMenu.add(new JSeparator());

    viewMenu.add(new MenuItem("Show Home Screen", MenuEventType.VIEW_SHOW_HOME));
    viewMenu.add(new MenuItem("Show Log", MenuEventType.VIEW_SHOW_LOG));

    contactsMenu.add(new MenuItem("Show My Public Key...", MenuEventType.CONTACTS_SHOW_PUBLIC_KEY));
    contactsMenu.add(new MenuItem("Add Contact...", MenuEventType.CONTACTS_ADD));
    contactsMenu.add(new JSeparator());
    contactsMenu.add(new MenuItem("Refresh list", MenuEventType.CONTACTS_REFRESH));

    helpMenu.add(new MenuItem("About Arget", MenuEventType.HELP_ABOUT));

    addServersFromProfile();
}