Example usage for javax.swing JToolBar setRequestFocusEnabled

List of usage examples for javax.swing JToolBar setRequestFocusEnabled

Introduction

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

Prototype

public void setRequestFocusEnabled(boolean requestFocusEnabled) 

Source Link

Document

Provides a hint as to whether or not this JComponent should get focus.

Usage

From source file:com.mgmtp.jfunk.core.ui.JFunkFrame.java

private void buildToolBar() {
    // Toolbar for the first line
    JToolBar toolBarFirstLine = new JToolBar("Toolbar");
    toolBarFirstLine.setRequestFocusEnabled(false);
    toolBarFirstLine.setFloatable(false);

    toolBarFirstLine.add(fileOpenScriptsAction);
    toolBarFirstLine.add(toolsRunAction);
    toolBarFirstLine.addSeparator();/* www  .  j a v a 2  s . c  o m*/

    // Build component jFunk property files
    jFunkPropertyFilesModel = new PropertiesComboBoxModel("config", "jfunk", PROPS_SUFFIX, null, true);
    jFunkPropertyFilesComboBox = new JComboBox(jFunkPropertyFilesModel);
    jFunkPropertyFilesComboBox.setBorder(BorderFactory.createTitledBorder("jFunk configuration"));
    // Multi-line tooltip
    jFunkPropertyFilesComboBox
            .setToolTipText("<html>List of jFunk property files containing listener and modules"
                    + "<br>Location: all files in directory 'config'</br></html>");
    toolBarFirstLine.add(jFunkPropertyFilesComboBox);

    // Build component testsystems
    testSystemsModel = new PropertiesComboBoxModel("config/system", null, PROPS_SUFFIX, "baseurl", false);
    testSystemsComboBox = new JComboBox(testSystemsModel);
    testSystemsComboBox.setBorder(BorderFactory.createTitledBorder("Test system"));
    // Multi-line tooltip
    testSystemsComboBox.setToolTipText(
            "<html>List of test systems" + "<br>Defined by all files in directory 'config/system'</br></html>");
    testSystemsComboBox.setSelectedItem(0);
    toolBarFirstLine.add(testSystemsComboBox);

    // Toolbar for the second line
    JToolBar toolBarSecondLine = new JToolBar();
    toolBarSecondLine.setRequestFocusEnabled(false);
    toolBarSecondLine.setFloatable(false);

    // Build component mail configuration
    mailConfigurationsModel = new PropertiesComboBoxModel(PATH_TO_MAIL_CONFIG_FILES, null, PROPS_SUFFIX, null,
            false);
    mailConfigurationsComboBox = new JComboBox(mailConfigurationsModel);
    mailConfigurationsComboBox.setBorder(BorderFactory.createTitledBorder("Mail configuration"));
    // Multi-line tooltip
    mailConfigurationsComboBox.setToolTipText("<html>List of mail configurations"
            + "<br>Defined by all files in directory 'config/email_accounts'</br></html>");
    toolBarSecondLine.add(mailConfigurationsComboBox);

    // Build component thread count
    threadCountComboBox = new JComboBox(createNumberArray(30));
    threadCountComboBox.setBorder(BorderFactory.createTitledBorder("Threads"));
    threadCountComboBox.setToolTipText(
            "Number of threads which will be used for the execution of the selected script files");
    toolBarSecondLine.add(threadCountComboBox);

    // Build component parallel
    parallelComboBox = new JComboBox(new String[] { "yes", "no" });
    parallelComboBox.setSelectedIndex(1);
    parallelComboBox.setBorder(BorderFactory.createTitledBorder("Parallel?"));
    parallelComboBox.setToolTipText("If set to 'yes', a single script will be executed "
            + "multiple times using the specified number of threads");
    toolBarSecondLine.add(parallelComboBox);

    jPanelUtilities = new JPanel();
    jPanelUtilities.setLayout(new BorderLayout());
    jPanelUtilities.add(toolBarFirstLine, BorderLayout.NORTH);
    jPanelUtilities.add(toolBarSecondLine, BorderLayout.CENTER);
}