Example usage for javax.swing JSeparator JSeparator

List of usage examples for javax.swing JSeparator JSeparator

Introduction

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

Prototype

public JSeparator() 

Source Link

Document

Creates a new horizontal separator.

Usage

From source file:se.trixon.mapollage.ui.MainFrame.java

private void initMenus() {
    if (mAlmondOptions.getMenuMode() == MenuModePanel.MenuMode.BUTTON) {
        mPopupMenu.add(addMenuItem);//from   w  w w .  ja va 2 s  . co m
        mPopupMenu.add(removeMenuItem);
        mPopupMenu.add(renameMenuItem);
        mPopupMenu.add(cloneMenuItem);
        mPopupMenu.add(removeAllMenuItem);
        mPopupMenu.add(new JSeparator());

        if (!IS_MAC) {
            mPopupMenu.add(optionsMenuItem);
            mPopupMenu.add(new JSeparator());
        }

        mPopupMenu.add(helpMenuItem);
        mPopupMenu.add(aboutDateFormatMenuItem);

        if (!IS_MAC) {
            mPopupMenu.add(aboutMenuItem);
        }

        if (!IS_MAC) {
            mPopupMenu.add(new JSeparator());
            mPopupMenu.add(quitMenuItem);
        }

    } else {
        setJMenuBar(menuBar);
        if (IS_MAC) {
            fileMenu.remove(quitMenuItem);
            toolsMenu.remove(optionsMenuItem);
            helpMenu.remove(aboutMenuItem);
        }

        fileMenu.setVisible(fileMenu.getComponents().length > 0 || !IS_MAC);
        toolsMenu.setVisible(toolsMenu.getComponents().length > 0 || !IS_MAC);
    }

    menuButton.setVisible(mAlmondOptions.getMenuMode() == MenuModePanel.MenuMode.BUTTON);
    SwingHelper.clearToolTipText(menuBar);
    SwingHelper.clearToolTipText(mPopupMenu);
}

From source file:se.trixon.mapollage.ui.MainFrame.java

private void showOptions() {
    OptionsPanel optionsPanel = new OptionsPanel();
    SwingHelper.makeWindowResizable(optionsPanel);

    Object[] options = new Object[] { AlmondOptionsPanel.getGlobalOptionsButton(optionsPanel), new JSeparator(),
            Dict.CANCEL, Dict.OK };//from  w  ww .  j av a2  s . c  om
    int retval = JOptionPane.showOptionDialog(this, optionsPanel, Dict.OPTIONS.toString(),
            JOptionPane.DEFAULT_OPTION, JOptionPane.PLAIN_MESSAGE, null, options, Dict.OK);

    if (retval == Arrays.asList(options).indexOf(Dict.OK)) {
        optionsPanel.save();
    }
}

From source file:se.trixon.pacoma.ui.MainFrame.java

private void initMenus() {
    if (mAlmondOptions.getMenuMode() == MenuModePanel.MenuMode.BUTTON) {
        mPopupMenu.add(newMenuItem);//w w  w. ja  v a 2s  .co m
        mPopupMenu.add(openMenuItem);
        mPopupMenu.add(closeMenuItem);
        mPopupMenu.add(new JSeparator());
        mPopupMenu.add(saveMenuItem);
        mPopupMenu.add(saveAsMenuItem);
        mPopupMenu.add(new JSeparator());
        mPopupMenu.add(propertiesMenuItem);
        mPopupMenu.add(new JSeparator());

        if (!IS_MAC) {
            mPopupMenu.add(optionsMenuItem);
            mPopupMenu.add(new JSeparator());
        }

        mPopupMenu.add(helpMenuItem);
        if (!IS_MAC) {
            mPopupMenu.add(aboutMenuItem);
        }

        if (!IS_MAC) {
            mPopupMenu.add(new JSeparator());
            mPopupMenu.add(quitMenuItem);
        }

    } else {
        setJMenuBar(menuBar);
        if (IS_MAC) {
            fileMenu.remove(quitMenuItem);
            toolsMenu.remove(optionsMenuItem);
            helpMenu.remove(aboutMenuItem);
        }

        fileMenu.setVisible(fileMenu.getMenuComponentCount() > 0 || !IS_MAC);
        toolsMenu.setVisible(toolsMenu.getMenuComponentCount() > 0 || !IS_MAC);
    }

    menuButton.setVisible(mAlmondOptions.getMenuMode() == MenuModePanel.MenuMode.BUTTON);
    SwingHelper.clearToolTipText(menuBar);
    SwingHelper.clearToolTipText(mPopupMenu);
}

From source file:uk.ac.ucl.chem.ccs.clinicalgui.ClinicalGuiClient.java

protected void startup() {
    loadProperties();//from   ww w.  j a v a2  s .co  m
    {
        getMainFrame().setSize(800, 700);
        //getMainFrame().setMinimumSize(new java.awt.Dimension(600, 600));
        //getMainFrame().setMaximumSize(new java.awt.Dimension(600, 600));

    }
    {
        jMenuBar1 = new JMenuBar();
        getMainFrame().setJMenuBar(jMenuBar1);
        {
            jMenu1 = new JMenu();
            jMenuBar1.add(jMenu1);
            jMenu1.setName("jMenu1");
            /*
            {
               change = new JMenuItem();
               jMenu1.add(change);
               change.setName("Change");
               change.addActionListener(new ActionListener() {
                 public void actionPerformed (ActionEvent evt) {
              PatientIdDialog pd = new PatientIdDialog(ClinicalGuiClient.this.getMainFrame());
             pd.setModal(true);
             pd.setVisible(true);
                 }
              });
            }
            */
            {
                manage = new JMenuItem();
                jMenu1.add(manage);
                manage.setName("manage");
            }
            {
                jSeparator1 = new JSeparator();
                jMenu1.add(jSeparator1);
            }
            {
                exit = new JMenuItem();
                jMenu1.add(exit);
                exit.setName("Exit");
                exit.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        closeApp();
                    }
                });
            }
        }
        {
            accessGridMenu = new JMenu();
            jMenuBar1.add(accessGridMenu);
            accessGridMenu.setName("accessGridMenu");
            {
                agToolKitLaunch = new JMenuItem();
                accessGridMenu.add(agToolKitLaunch);
                agToolKitLaunch.setName("agToolKitLaunch");
                agToolKitLaunch.setEnabled(false);
            }
            {
                configureAG = new JMenuItem();
                accessGridMenu.add(configureAG);
                configureAG.setName("configureAG");
                configureAG.setEnabled(false);
            }
        }
    }
    topPanel = new JPanel();
    GridLayout topPanelLayout = new GridLayout(1, 1);
    topPanelLayout.setColumns(1);
    topPanelLayout.setHgap(5);
    topPanelLayout.setVgap(5);
    // topPanel.setMinimumSize(new java.awt.Dimension(600, 600));
    topPanel.setPreferredSize(new java.awt.Dimension(800, 700));
    topPanel.setLayout(topPanelLayout);
    {
        mainPanel1 = new MainPanel();
        topPanel.add(mainPanel1);
    }
    show(topPanel);
}

From source file:uk.ac.ucl.cs.cmic.giftcloud.uploadapp.ConfigurationDialog.java

ConfigurationDialog(final Component owner, final UploaderGuiController controller,
        final GiftCloudPropertiesFromApplication giftCloudProperties, final ProjectListModel projectListModel,
        final ResourceBundle resourceBundle, final GiftCloudDialogs giftCloudDialogs,
        final GiftCloudReporter reporter) {
    this.controller = controller;
    this.giftCloudProperties = giftCloudProperties;
    this.projectListModel = projectListModel;
    this.resourceBundle = resourceBundle;
    this.giftCloudDialogs = giftCloudDialogs;
    this.reporter = reporter;
    temporaryDropDownListModel = new TemporaryProjectListModel(projectListModel,
            giftCloudProperties.getLastProject());
    componentToCenterDialogOver = owner;

    dialog = new JDialog();
    dialog.setModal(true);/*  w  ww  . j  a va 2s.  c o m*/
    dialog.setResizable(false);

    // Call custom dialog close code when the close button is clicked
    dialog.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    dialog.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent ev) {
            closeDialog();
        }
    });

    dialog.setLocationRelativeTo(componentToCenterDialogOver); // without this, appears at TLHC rather then center of parent or screen
    dialog.setTitle(resourceBundle.getString("configurationDialogTitle"));

    final GridBagConstraints sectionTitleConstraints = new GridBagConstraints();
    sectionTitleConstraints.gridx = 0;
    sectionTitleConstraints.gridy = 1;
    sectionTitleConstraints.gridwidth = 2;
    sectionTitleConstraints.weightx = 1;
    sectionTitleConstraints.weighty = 1;
    sectionTitleConstraints.anchor = GridBagConstraints.CENTER;
    sectionTitleConstraints.fill = GridBagConstraints.HORIZONTAL;

    final GridBagConstraints labelConstraints = new GridBagConstraints();
    labelConstraints.gridx = 0;
    labelConstraints.gridy = 0;
    labelConstraints.gridwidth = 1;
    labelConstraints.weightx = 1;
    labelConstraints.weighty = 1;
    labelConstraints.anchor = GridBagConstraints.LINE_START;
    labelConstraints.fill = GridBagConstraints.NONE;

    final GridBagConstraints inputConstraints = new GridBagConstraints();
    inputConstraints.gridx = 1;
    inputConstraints.gridy = 0;
    inputConstraints.gridwidth = 1;
    inputConstraints.weightx = 1;
    inputConstraints.weighty = 1;
    inputConstraints.anchor = GridBagConstraints.LINE_END;
    inputConstraints.fill = GridBagConstraints.HORIZONTAL;

    GridBagConstraints separatorConstraint = new GridBagConstraints();
    separatorConstraint.weightx = 1.0;
    separatorConstraint.fill = GridBagConstraints.HORIZONTAL;
    separatorConstraint.gridwidth = GridBagConstraints.REMAINDER;

    // The panel containing the GIFT-Cloud server configuration
    final JPanel giftCloudServerPanel = new JPanel();
    {
        GridBagLayout projectUploadlayout = new GridBagLayout();
        giftCloudServerPanel.setLayout(projectUploadlayout);
        JLabel serverPanelLabel = new JLabel(resourceBundle.getString("configPanelServerConfig"),
                SwingConstants.CENTER);
        giftCloudServerPanel.add(serverPanelLabel, sectionTitleConstraints);

        // GIFT-Cloud server URL
        {
            labelConstraints.gridwidth = 1;
            labelConstraints.gridy = 2;
            final JLabel giftCloudServerLabel = new JLabel(resourceBundle.getString("giftCloudServerText"),
                    SwingConstants.RIGHT);
            giftCloudServerLabel.setToolTipText(resourceBundle.getString("giftCloudServerTextToolTipText"));
            giftCloudServerPanel.add(giftCloudServerLabel, labelConstraints);

            giftCloudServerText = new AutoFocusTextField(giftCloudProperties.getGiftCloudUrl().orElse(""),
                    textFieldLengthForGiftCloudServerUrl);
            inputConstraints.gridy = 2;
            giftCloudServerPanel.add(giftCloudServerText, inputConstraints);
        }

        // GIFT-Cloud username
        {
            labelConstraints.gridy = 3;
            final JLabel giftCloudUserNameLabel = new JLabel(resourceBundle.getString("giftCloudUsername"),
                    SwingConstants.RIGHT);
            giftCloudUserNameLabel.setToolTipText(resourceBundle.getString("giftCloudUsernameToolTipText"));
            giftCloudServerPanel.add(giftCloudUserNameLabel, labelConstraints);

            final Optional<String> serverUrl = giftCloudProperties.getLastUserName();
            final String initialServerText = serverUrl.isPresent() ? serverUrl.get() : "";
            giftCloudUsernameText = new AutoFocusTextField(initialServerText);
            inputConstraints.gridy = 3;
            giftCloudServerPanel.add(giftCloudUsernameText, inputConstraints);
        }

        // GIFT-Cloud password
        {
            labelConstraints.gridy = 4;
            final JLabel giftCloudPasswordLabel = new JLabel(resourceBundle.getString("giftCloudPassword"),
                    SwingConstants.RIGHT);
            giftCloudPasswordLabel.setToolTipText(resourceBundle.getString("giftCloudPasswordToolTipText"));
            giftCloudServerPanel.add(giftCloudPasswordLabel, labelConstraints);

            final Optional<char[]> password = giftCloudProperties.getLastPassword();
            final char[] initialPassword = password.isPresent() ? password.get() : "".toCharArray();
            giftCloudPasswordText = new JPasswordField(new String(initialPassword), 16); // Shouldn't create a String but there's no other way to initialize the password field
            inputConstraints.gridy = 4;
            giftCloudServerPanel.add(giftCloudPasswordText, inputConstraints);
        }

        // Project list
        {
            labelConstraints.gridy = 5;
            JLabel projectListLabel = new JLabel(resourceBundle.getString("giftCloudProjectLabelText"),
                    SwingConstants.RIGHT);
            giftCloudServerPanel.add(projectListLabel, labelConstraints);

            inputConstraints.gridy = 5;
            projectList = new BackwardsCompatibleComboBox();
            projectList.setEditable(false);
            projectList.setToolTipText(resourceBundle.getString("giftCloudProjectTooltip"));
            giftCloudServerPanel.add(projectList, inputConstraints);

            labelConstraints.gridx = 1;
            projectListWaitingLabel = new JLabel(resourceBundle.getString("giftCloudProjectWaitingLabelText"),
                    SwingConstants.RIGHT);
            giftCloudServerPanel.add(projectListWaitingLabel, labelConstraints);
            labelConstraints.gridx = 0;
        }

        // Subject prefix
        {
            labelConstraints.gridy = 6;
            JLabel subjectPrefixLabel = new JLabel(resourceBundle.getString("configPanelListenerSubjectPrefix"),
                    SwingConstants.RIGHT);
            subjectPrefixLabel
                    .setToolTipText(resourceBundle.getString("configPanelListenerSubjectPrefixTooltip"));
            giftCloudServerPanel.add(subjectPrefixLabel, labelConstraints);

            inputConstraints.gridy = 6;
            final Optional<String> subjectPrefixText = giftCloudProperties.getSubjectPrefix();
            subjectPrefixField = new AutoFocusTextField(subjectPrefixText.orElse(""));
            giftCloudServerPanel.add(subjectPrefixField, inputConstraints);
        }
    }

    // Local Dicom node configuration
    final JPanel listenerPanel = new JPanel();
    {
        GridBagLayout listenerPanellayout = new GridBagLayout();
        listenerPanel.setLayout(listenerPanellayout);
        JSeparator separator = new JSeparator();
        listenerPanel.add(separator, separatorConstraint);

        JLabel listenerPanelLabel = new JLabel(resourceBundle.getString("configPanelListenerConfig"),
                SwingConstants.CENTER);
        listenerPanel.add(listenerPanelLabel, sectionTitleConstraints);

        {
            labelConstraints.gridy = 2;
            JLabel listeningAETitleJLabel = new JLabel(resourceBundle.getString("configPanelListenerAe"),
                    SwingConstants.RIGHT);
            listeningAETitleJLabel.setToolTipText(resourceBundle.getString("configPanelListenerAeToolTip"));
            listenerPanellayout.setConstraints(listeningAETitleJLabel, labelConstraints);
            listenerPanel.add(listeningAETitleJLabel);

            inputConstraints.gridy = 2;
            final String listeningAETitleInitialText = giftCloudProperties.getListenerAETitle();
            listeningAETitleField = new AutoFocusTextField(listeningAETitleInitialText);
            listenerPanellayout.setConstraints(listeningAETitleField, inputConstraints);
            listenerPanel.add(listeningAETitleField);
        }
        {
            labelConstraints.gridy = 3;
            JLabel listeningPortJLabel = new JLabel(resourceBundle.getString("configPanelListenerPort"),
                    SwingConstants.RIGHT);
            listeningPortJLabel.setToolTipText(resourceBundle.getString("configPanelListenerPortToolTip"));
            listenerPanellayout.setConstraints(listeningPortJLabel, labelConstraints);
            listenerPanel.add(listeningPortJLabel);

            inputConstraints.gridy = 3;
            final int port = giftCloudProperties.getListeningPort();
            final String portValue = Integer.toString(port);
            listeningPortField = new AutoFocusTextField(portValue);
            listenerPanellayout.setConstraints(listeningPortField, inputConstraints);
            listenerPanel.add(listeningPortField);
        }
        {
            labelConstraints.gridy = 4;
            JLabel patientListExportFolderLabel = new JLabel(
                    resourceBundle.getString("configPanelListenerPatientListExportFolder"),
                    SwingConstants.RIGHT);
            patientListExportFolderLabel.setToolTipText(
                    resourceBundle.getString("configPanelListenerPatientListExportFolderTooltip"));
            listenerPanellayout.setConstraints(patientListExportFolderLabel, labelConstraints);
            listenerPanel.add(patientListExportFolderLabel);

            inputConstraints.gridy = 4;
            final Optional<String> patientListExportFolder = giftCloudProperties.getPatientListExportFolder();
            patientListExportFolderField = new AutoFocusTextField(patientListExportFolder.orElse(""));
            listenerPanellayout.setConstraints(patientListExportFolderField, inputConstraints);
            listenerPanel.add(patientListExportFolderField);
        }

        // Patient list spreadsheet password
        {
            labelConstraints.gridy = 5;
            final JLabel patientListSpreadsheetPasswordLabel = new JLabel(
                    resourceBundle.getString("configPanelListenerPatientListSpreadhsheetPassword"),
                    SwingConstants.RIGHT);
            patientListSpreadsheetPasswordLabel.setToolTipText(
                    resourceBundle.getString("configPanelListenerPatientListSpreadhsheetPasswordTooltip"));
            listenerPanel.add(patientListSpreadsheetPasswordLabel, labelConstraints);

            final Optional<char[]> password = giftCloudProperties.getPatientListPassword();
            final char[] initialPassword = password.isPresent() ? password.get() : "".toCharArray();
            patientListSpreadsheetPasswordField = new JPasswordField(new String(initialPassword), 16); // Shouldn't create a String but there's no other way to initialize the password field
            inputConstraints.gridy = 5;
            listenerPanel.add(patientListSpreadsheetPasswordField, inputConstraints);
        }
    }

    // Remote PACS configuration
    final JPanel remoteAEPanel = new JPanel();

    {
        GridBagLayout pacsPanellayout = new GridBagLayout();
        remoteAEPanel.setLayout(pacsPanellayout);

        JSeparator separator = new JSeparator();
        remoteAEPanel.add(separator, separatorConstraint);

        JLabel remotePanelLabel = new JLabel(resourceBundle.getString("pacsPanelListenerConfig"),
                SwingConstants.CENTER);
        remoteAEPanel.add(remotePanelLabel, sectionTitleConstraints);

        {
            labelConstraints.gridy = 2;
            JLabel remoteAeTitleLabel = new JLabel(resourceBundle.getString("configPanelPacsAeTitle"),
                    SwingConstants.RIGHT);
            remoteAeTitleLabel.setToolTipText(resourceBundle.getString("configPanelPacsAeTitleTooltip"));
            remoteAEPanel.add(remoteAeTitleLabel, labelConstraints);

            final Optional<String> pacsAeTitle = giftCloudProperties.getPacsAeTitle();
            remoteAETitleField = new AutoFocusTextField(pacsAeTitle.isPresent() ? pacsAeTitle.get() : "");
            inputConstraints.gridy = 2;
            remoteAEPanel.add(remoteAETitleField, inputConstraints);
        }

        {
            labelConstraints.gridy = 3;
            JLabel remoteAeHostLabel = new JLabel(resourceBundle.getString("configPanelPacsHostname"),
                    SwingConstants.RIGHT);
            remoteAeHostLabel.setToolTipText(resourceBundle.getString("configPanelPacsHostnameTooltip"));
            remoteAEPanel.add(remoteAeHostLabel, labelConstraints);

            remoteAEHostName = new AutoFocusTextField(giftCloudProperties.getPacsHostName().orElse(""));
            inputConstraints.gridy = 3;
            remoteAEPanel.add(remoteAEHostName, inputConstraints);
        }

        {
            labelConstraints.gridy = 4;
            JLabel remoteAeTitleLabel = new JLabel(resourceBundle.getString("configPanelPacsPort"),
                    SwingConstants.RIGHT);
            remoteAeTitleLabel.setToolTipText(resourceBundle.getString("configPanelPacsPortTooltip"));
            remoteAEPanel.add(remoteAeTitleLabel, labelConstraints);

            remoteAEPortField = new AutoFocusTextField(Integer.toString(giftCloudProperties.getPacsPort()));
            inputConstraints.gridy = 4;
            remoteAEPanel.add(remoteAEPortField, inputConstraints);
        }

    }

    // The panel containing the cancel and apply buttons
    JPanel buttonPanel = new JPanel();
    JPanel closeButtonPanel = new JPanel();
    {
        final GridBagLayout buttonPanellayout = new GridBagLayout();
        buttonPanel.setLayout(buttonPanellayout);

        JSeparator separator = new JSeparator();
        buttonPanel.add(separator, separatorConstraint);

        closeButtonPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));

        JButton cancelButton = new JButton(resourceBundle.getString("cancelSettingsButtonLabelText"));
        cancelButton.setToolTipText(resourceBundle.getString("cancelSettingsButtonToolTipText"));
        closeButtonPanel.add(cancelButton);
        cancelButton.addActionListener(new CancelActionListener());

        JButton applyButton = new JButton(resourceBundle.getString("applySettingsButtonLabelText"));
        applyButton.setToolTipText(resourceBundle.getString("applySettingsButtonToolTipText"));
        closeButtonPanel.add(applyButton);
        applyButton.addActionListener(new ApplyActionListener());

        JButton closeButton = new JButton(resourceBundle.getString("closeSettingsButtonLabelText"));
        closeButton.setToolTipText(resourceBundle.getString("closeSettingsButtonToolTipText"));
        closeButtonPanel.add(closeButton);
        closeButton.addActionListener(new CloseActionListener());

        final GridBagConstraints constraints = new GridBagConstraints();
        constraints.gridx = 0;
        constraints.gridy = 1;
        constraints.weightx = 1;
        constraints.weighty = 1;
        constraints.insets = new Insets(5, 5, 5, 5);
        constraints.fill = GridBagConstraints.HORIZONTAL;
        buttonPanellayout.setConstraints(closeButtonPanel, constraints);
        buttonPanel.add(closeButtonPanel);
    }

    // The main panel of the configuration dialog
    JPanel configPanel = new JPanel();
    {
        final GridBagLayout configPanelLayout = new GridBagLayout();
        configPanel.setLayout(configPanelLayout);
        {
            final GridBagConstraints constraints = new GridBagConstraints();
            constraints.gridx = 0;
            constraints.gridy = 0;
            constraints.weightx = 1;
            constraints.weighty = 1;
            constraints.insets = new Insets(5, 5, 5, 5);
            constraints.fill = GridBagConstraints.HORIZONTAL;
            configPanelLayout.setConstraints(giftCloudServerPanel, constraints);
            configPanel.add(giftCloudServerPanel);
        }
        {
            final GridBagConstraints constraints = new GridBagConstraints();
            constraints.gridx = 0;
            constraints.gridy = 1;
            constraints.weightx = 1;
            constraints.weighty = 1;
            constraints.insets = new Insets(5, 5, 5, 5);
            constraints.fill = GridBagConstraints.HORIZONTAL;
            configPanelLayout.setConstraints(listenerPanel, constraints);
            configPanel.add(listenerPanel);
        }
        {
            final GridBagConstraints constraints = new GridBagConstraints();
            constraints.gridx = 0;
            constraints.gridy = 2;
            constraints.insets = new Insets(5, 5, 5, 5);
            constraints.fill = GridBagConstraints.HORIZONTAL;
            configPanelLayout.setConstraints(remoteAEPanel, constraints);
            configPanel.add(remoteAEPanel);
        }
        {
            final GridBagConstraints constraints = new GridBagConstraints();
            constraints.gridx = 0;
            constraints.gridy = 3;
            constraints.insets = new Insets(5, 5, 5, 5);
            constraints.fill = GridBagConstraints.HORIZONTAL;
            configPanelLayout.setConstraints(buttonPanel, constraints);
            configPanel.add(buttonPanel);
        }
    }

    projectList.setModel(temporaryDropDownListModel);
    showProjectList(projectListModel.isEnabled());

    // Create a listener to enable/disable the project list when it is set from the server.
    // The reason for this is that the project list is set after logging into the server, which can happen asynchronously after property changes have been applied.
    // If the server was configured in the dialog and apply clicked, it might take a few seconds for the project list to be updated, and we want it to become available when this happens
    projectListEnabledListener = new DropDownListModel.EnabledListener<Boolean>() {
        @Override
        public void statusChanged(final Boolean visibility) {
            showProjectList(projectListModel.isEnabled());
        }
    };

    projectListModel.addListener(projectListEnabledListener);

    GridBagLayout layout = new GridBagLayout();
    dialog.setLayout(layout);
    Container content = dialog.getContentPane();
    content.add(configPanel);
    dialog.pack();
    dialog.setVisible(true);
    dialog.pack();
}

From source file:uk.nhs.cfh.dsp.srth.desktop.uiframework.app.impl.ModularDockingApplicationView.java

/**
 * Creates the menu bar.//from   w ww  .j  av  a2  s. com
 */
protected synchronized void createMenuBar() {

    menuBar = new JMenuBar();
    menuBar.setName("menuBar"); // NOI18N
    JMenu fileMenu = new JMenu();
    JMenuItem exitMenuItem = new JMenuItem();
    JSeparator statusPanelSeparator = new JSeparator();
    statusPanelSeparator.setName("statusPanelSeparator"); // NOI18N

    fileMenu.setText("File"); // NOI18N
    fileMenu.setName("fileMenu"); // NOI18N
    exitMenuItem.setAction(actionMap.get("quitApp")); // NOI18N
    exitMenuItem.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_Q, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    exitMenuItem.setName("exitMenuItem"); // NOI18N
    fileMenu.add(exitMenuItem);
    menuBar.add(fileMenu);

    // query menu
    JMenu queryMenu = new JMenu();
    queryMenu.setText("Query");
    queryMenu.setName("queryMenu");
    menuBar.add(queryMenu);

    // dataMenu
    JMenu dataMenu = new JMenu();
    dataMenu.setText("Data");
    dataMenu.setName("dataMenu");
    menuBar.add(dataMenu);

    // toolsMenu
    JMenu toolsMenu = new JMenu();
    toolsMenu.setText("Tools");
    toolsMenu.setName("toolsMenu");
    menuBar.add(toolsMenu);

    // view menu
    JMenu viewMenu = new JMenu();
    viewMenu.setText(resourceMap.getString("viewMenu.text"));
    viewMenu.setName("viewMenu");
    viewMenu.add(actionMap.get("saveViewLayout"));
    viewMenu.add(actionMap.get("restoreViewLayout"));
    menuBar.add(viewMenu);

    // help menu
    JMenu helpMenu = new JMenu();
    helpMenu.setText("Help"); // NOI18N
    helpMenu.setName("helpMenu"); // NOI18N
    helpMenu.add(actionMap.get("showErrorReportingURL"));
    helpMenu.add(actionMap.get("showFeatureRequestURL"));
    helpMenu.add(actionMap.get("showAboutDialog"));
    menuBar.add(helpMenu);
}

From source file:us.paulevans.basicxslt.BasicXSLTFrame.java

/**
 * Create the menubar./*from w  w w  .jav a  2 s. c o m*/
 *
 */
private void buildMenuBar() {

    // local declarations...
    JMenuBar menuBar;
    JMenu help, file, validation, view;

    // build the file menu and associated menu items...
    file = new JMenu(stringFactory.getString(LabelStringFactory.MF_FILE_MENU));
    file.setMnemonic(stringFactory.getMnemonic(LabelStringFactory.MF_FILE_MENU));
    resetForm = new JMenuItem(stringFactory.getString(LabelStringFactory.MF_FILE_RESET_FORM_MI));
    resetForm.setMnemonic(stringFactory.getMnemonic(LabelStringFactory.MF_FILE_RESET_FORM_MI));
    resetForm.addActionListener(this);
    file.add(resetForm);
    file.add(new JSeparator());
    file.add(loadConfiguration = new JMenuItem(
            stringFactory.getString(LabelStringFactory.MF_FILE_LOAD_CONFIGURATION_MI)));
    loadConfiguration.setMnemonic(stringFactory.getMnemonic(LabelStringFactory.MF_FILE_LOAD_CONFIGURATION_MI));
    file.add(saveConfiguration = new JMenuItem(
            stringFactory.getString(LabelStringFactory.MF_FILE_SAVE_CONFIGURATION_MI)));
    saveConfiguration.setMnemonic(stringFactory.getMnemonic(LabelStringFactory.MF_FILE_SAVE_CONFIGURATION_MI));
    file.add(saveAsConfiguration = new JMenuItem(
            stringFactory.getString(LabelStringFactory.MF_FILE_SAVE_CONFIGURATION_AS_MI)));
    saveAsConfiguration
            .setMnemonic(stringFactory.getMnemonic(LabelStringFactory.MF_FILE_SAVE_CONFIGURATION_AS_MI));
    loadConfiguration.addActionListener(this);
    saveConfiguration.addActionListener(this);
    saveAsConfiguration.addActionListener(this);
    file.add(new JSeparator());
    exit = new JMenuItem(stringFactory.getString(LabelStringFactory.MF_FILE_EXIT_MI));
    exit.setMnemonic(stringFactory.getMnemonic(LabelStringFactory.MF_FILE_EXIT_MI));
    exit.addActionListener(this);
    file.add(exit);

    // build the validation menu and associated menu items...
    validation = new JMenu(stringFactory.getString(LabelStringFactory.MF_VALIDATION_MENU));
    validation.setMnemonic(stringFactory.getMnemonic(LabelStringFactory.MF_VALIDATION_MENU));
    validation.add(checkSaxWarning = new JCheckBoxMenuItem(
            stringFactory.getString(LabelStringFactory.MF_VALIDATION_CHECK_SAX_WARNINGS_MI)));
    checkSaxWarning
            .setMnemonic(stringFactory.getMnemonic(LabelStringFactory.MF_VALIDATION_CHECK_SAX_WARNINGS_MI));
    validation.add(checkSaxError = new JCheckBoxMenuItem(
            stringFactory.getString(LabelStringFactory.MF_VALIDATION_CHECK_SAX_ERRORS_MI)));
    checkSaxError.setMnemonic(stringFactory.getMnemonic(LabelStringFactory.MF_VALIDATION_CHECK_SAX_ERRORS_MI));
    validation.add(checkSaxFatalError = new JCheckBoxMenuItem(
            stringFactory.getString(LabelStringFactory.MF_VALIDATION_CHECK_SAX_FATAL_MI)));
    checkSaxFatalError
            .setMnemonic(stringFactory.getMnemonic(LabelStringFactory.MF_VALIDATION_CHECK_SAX_FATAL_MI));

    // build the view menu and associate menu items...
    view = new JMenu(stringFactory.getString(LabelStringFactory.MF_VIEW_MENU));
    view.setMnemonic(stringFactory.getMnemonic(LabelStringFactory.MF_VIEW_MENU));
    view.add(transformTimings = new JMenuItem(
            stringFactory.getString(LabelStringFactory.MF_VIEW_LAST_TIMINGS_MI)));
    transformTimings.setMnemonic(stringFactory.getMnemonic(LabelStringFactory.MF_VIEW_LAST_TIMINGS_MI));
    transformTimings.setEnabled(false);
    transformTimings.addActionListener(this);

    // build the help menu and associated menu items...
    help = new JMenu(stringFactory.getString(LabelStringFactory.MF_HELP_MENU));
    help.setMnemonic(stringFactory.getMnemonic(LabelStringFactory.MF_HELP_MENU));
    about = new JMenuItem(stringFactory.getString(LabelStringFactory.MF_HELP_ABOUT_MI));
    about.setMnemonic(stringFactory.getMnemonic(LabelStringFactory.MF_HELP_ABOUT_MI));
    about.addActionListener(this);
    help.add(about);

    // build the menubar...
    menuBar = new JMenuBar();
    menuBar.add(file);
    menuBar.add(validation);
    menuBar.add(view);
    menuBar.add(help);
    setJMenuBar(menuBar);
}

From source file:us.paulevans.basicxslt.SaveAsConfigurationFrame.java

/**
 * Builds the main panel/*from   w  w w.  ja v  a 2 s .  c om*/
 * @return
 */
private JPanel buildMainPanel() {

    int row;
    GridBagLayout layout;
    GridBagConstraints constraints;
    JPanel main;
    JLabel label;

    layout = new GridBagLayout();
    constraints = new GridBagConstraints();
    main = new JPanel(layout);
    row = 0;
    GUIUtils.add(main,
            new JLabel(stringFactory.getString(LabelStringFactory.SAVEASCONFIG_FRAME_CURRENT_CONFIGURATION)),
            layout, constraints, row, 0, 1, 1, GridBagConstraints.EAST, GridBagConstraints.NONE,
            GUIUtils.MED_INSETS);
    GUIUtils.add(main, label = new JLabel(userPrefs.getConfiguration()), layout, constraints, row++, 1, 1, 1,
            GridBagConstraints.WEST, GridBagConstraints.NONE, GUIUtils.SMALL_INSETS);
    label.setForeground(Color.BLUE);
    GUIUtils.add(main, new JSeparator(), layout, constraints, row++, 0, 1, 2, 1, 1, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, GUIUtils.MED_INSETS);
    GUIUtils.add(main,
            new JLabel(stringFactory.getString(LabelStringFactory.SAVEASCONFIG_FRAME_CONFIGURATION_NAME)),
            layout, constraints, row, 0, 1, 1, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE,
            GUIUtils.SMALL_INSETS);
    GUIUtils.add(main, new JScrollPane(configurationName = new JTextField(20)), layout, constraints, row++, 1,
            1, 1, GridBagConstraints.WEST, GridBagConstraints.NONE, GUIUtils.SMALL_INSETS);
    GUIUtils.add(main, new JLabel(stringFactory.getString(LabelStringFactory.SAVEASCONFIG_FRAME_MAKE_DEFAULT)),
            layout, constraints, row, 0, 1, 1, GridBagConstraints.EAST, GridBagConstraints.NONE,
            GUIUtils.SMALL_INSETS);
    GUIUtils.add(main, makeDefault = new JCheckBox(), layout, constraints, row++, 1, 1, 1,
            GridBagConstraints.WEST, GridBagConstraints.NONE, GUIUtils.SMALL_INSETS);
    return main;
}

From source file:us.paulevans.basicxslt.TransformOutputPropertiesFrame.java

/**
 * Builds the north panel/*from ww  w.j  ava  2  s .  co m*/
 * @param aHeaderLabel
 * @param aFile
 * @return
 */
private JPanel buildNorthPanel(String aHeaderLabel, String aFile) {

    GridBagLayout layout;
    GridBagConstraints constraints;
    JPanel panel;
    int row, col;
    JLabel headerLabel, fileLabel;

    layout = new GridBagLayout();
    constraints = new GridBagConstraints();
    panel = new JPanel(layout);
    headerLabel = new JLabel(aHeaderLabel);
    row = 0;
    col = 0;
    headerLabel.setFont(new Font("arial", Font.PLAIN, 18));
    fileLabel = new JLabel(stringFactory.getString(LabelStringFactory.OUTPUTPROPS_FRAME_FILE_LBL) + aFile);
    fileLabel.setFont(new Font("arial", Font.PLAIN, 12));
    GUIUtils.add(panel, headerLabel, layout, constraints, row++, col, 1, 1, 1, 1, GridBagConstraints.NORTHEAST,
            GridBagConstraints.BOTH, GUIUtils.MED_LARGE_INSETS);
    GUIUtils.add(panel, new JSeparator(), layout, constraints, row++, col, 1, 1, 1, 1,
            GridBagConstraints.NORTHEAST, GridBagConstraints.BOTH, GUIUtils.MED_LARGE_INSETS);
    GUIUtils.add(panel, fileLabel, layout, constraints, row++, col, 1, 1, 1, 1, GridBagConstraints.NORTHEAST,
            GridBagConstraints.BOTH, GUIUtils.MED_LARGE_INSETS);
    return panel;
}

From source file:us.paulevans.basicxslt.TransformParametersFrame.java

/**
 * Builds the north panel/*  w ww  .  ja v  a 2 s  .  c  om*/
 * @return
 */
private JPanel buildNorthPanel() {

    GridBagLayout layout;
    GridBagConstraints constraints;
    JPanel panel;
    int row, col;
    JLabel headerLabel;

    layout = new GridBagLayout();
    constraints = new GridBagConstraints();
    panel = new JPanel(layout);
    row = 0;
    col = 0;
    headerLabel = new JLabel(stringFactory.getString(LabelStringFactory.PARAMS_FRAME_TRANSFORM_PARAMETERS)
            + " (" + xslRow.getDescription() + ")");
    headerLabel.setFont(new Font("arial", Font.PLAIN, 18));
    JLabel fileLabel = new JLabel(stringFactory.getString(LabelStringFactory.PARAMS_FRAME_FILE_LBL_WITH_COLON)
            + xslRow.getTextField().getText());
    fileLabel.setFont(new Font("arial", Font.PLAIN, 12));
    GUIUtils.add(panel, headerLabel, layout, constraints, row++, col, 1, 1, 1, 1, GridBagConstraints.NORTHEAST,
            GridBagConstraints.BOTH, GUIUtils.MED_LARGE_INSETS);
    GUIUtils.add(panel, new JSeparator(), layout, constraints, row++, col, 1, 1, 1, 1,
            GridBagConstraints.NORTHEAST, GridBagConstraints.BOTH, GUIUtils.MED_LARGE_INSETS);
    GUIUtils.add(panel, fileLabel, layout, constraints, row++, col, 1, 1, 1, 1, GridBagConstraints.NORTHEAST,
            GridBagConstraints.BOTH, GUIUtils.MED_LARGE_INSETS);
    return panel;
}