Example usage for javax.swing JTabbedPane addChangeListener

List of usage examples for javax.swing JTabbedPane addChangeListener

Introduction

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

Prototype

public void addChangeListener(ChangeListener l) 

Source Link

Document

Adds a ChangeListener to this tabbedpane.

Usage

From source file:davmail.ui.SettingsFrame.java

/**
 * DavMail settings frame./*from   w w w  .ja  v  a 2  s  .c om*/
 */
public SettingsFrame() {
    setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
    setTitle(BundleMessage.format("UI_DAVMAIL_SETTINGS"));
    try {
        setIconImage(DavGatewayTray.getFrameIcon());
    } catch (NoSuchMethodError error) {
        DavGatewayTray.debug(new BundleMessage("LOG_UNABLE_TO_SET_ICON_IMAGE"));
    }

    JTabbedPane tabbedPane = new JTabbedPane();
    // add help (F1 handler)
    tabbedPane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke("F1"),
            "help");
    tabbedPane.getActionMap().put("help", new AbstractAction() {
        public void actionPerformed(ActionEvent e) {
            DesktopBrowser.browse("http://davmail.sourceforge.net");
        }
    });
    tabbedPane.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            boolean isSslEnabled = isSslEnabled();
            popNoSSLCheckBox.setEnabled(Settings.getProperty("davmail.popPort") != null && isSslEnabled);
            imapNoSSLCheckBox.setEnabled(imapPortCheckBox.isSelected() && isSslEnabled);
            smtpNoSSLCheckBox.setEnabled(smtpPortCheckBox.isSelected() && isSslEnabled);
            caldavNoSSLCheckBox.setEnabled(caldavPortCheckBox.isSelected() && isSslEnabled);
            ldapNoSSLCheckBox.setEnabled(ldapPortCheckBox.isSelected() && isSslEnabled);
        }
    });

    JPanel mainPanel = new JPanel();
    mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
    mainPanel.add(getSettingsPanel());
    mainPanel.add(getDelaysPanel());
    mainPanel.add(Box.createVerticalGlue());

    tabbedPane.add(BundleMessage.format("UI_TAB_MAIN"), mainPanel);

    JPanel proxyPanel = new JPanel();
    proxyPanel.setLayout(new BoxLayout(proxyPanel, BoxLayout.Y_AXIS));
    proxyPanel.add(getProxyPanel());
    proxyPanel.add(getNetworkSettingsPanel());
    tabbedPane.add(BundleMessage.format("UI_TAB_NETWORK"), proxyPanel);

    JPanel encryptionPanel = new JPanel();
    encryptionPanel.setLayout(new BoxLayout(encryptionPanel, BoxLayout.Y_AXIS));
    encryptionPanel.add(getKeystorePanel());
    encryptionPanel.add(getSmartCardPanel());
    // empty panel
    encryptionPanel.add(new JPanel());
    tabbedPane.add(BundleMessage.format("UI_TAB_ENCRYPTION"), encryptionPanel);

    JPanel loggingPanel = new JPanel();
    loggingPanel.setLayout(new BoxLayout(loggingPanel, BoxLayout.Y_AXIS));
    loggingPanel.add(getLoggingSettingsPanel());
    // empty panel
    loggingPanel.add(new JPanel());

    tabbedPane.add(BundleMessage.format("UI_TAB_LOGGING"), loggingPanel);

    JPanel advancedPanel = new JPanel();
    advancedPanel.setLayout(new BoxLayout(advancedPanel, BoxLayout.Y_AXIS));

    advancedPanel.add(getOtherSettingsPanel());
    // empty panel
    advancedPanel.add(new JPanel());

    tabbedPane.add(BundleMessage.format("UI_TAB_ADVANCED"), advancedPanel);

    if (OSXInfoPlist.isOSX()) {
        JPanel osxPanel = new JPanel();
        osxPanel.setLayout(new BoxLayout(osxPanel, BoxLayout.Y_AXIS));
        osxPanel.add(getOSXPanel());
        // empty panel
        osxPanel.add(new JPanel());

        tabbedPane.add(BundleMessage.format("UI_TAB_OSX"), osxPanel);
    }

    add(BorderLayout.CENTER, tabbedPane);

    JPanel buttonPanel = new JPanel();
    JButton cancel = new JButton(BundleMessage.format("UI_BUTTON_CANCEL"));
    JButton ok = new JButton(BundleMessage.format("UI_BUTTON_SAVE"));
    JButton help = new JButton(BundleMessage.format("UI_BUTTON_HELP"));
    ActionListener save = new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            // save options
            Settings.setProperty("davmail.url", urlField.getText());
            Settings.setProperty("davmail.popPort", popPortCheckBox.isSelected() ? popPortField.getText() : "");
            Settings.setProperty("davmail.ssl.nosecurepop", String.valueOf(popNoSSLCheckBox.isSelected()));
            Settings.setProperty("davmail.imapPort",
                    imapPortCheckBox.isSelected() ? imapPortField.getText() : "");
            Settings.setProperty("davmail.ssl.nosecureimap", String.valueOf(imapNoSSLCheckBox.isSelected()));
            Settings.setProperty("davmail.smtpPort",
                    smtpPortCheckBox.isSelected() ? smtpPortField.getText() : "");
            Settings.setProperty("davmail.ssl.nosecuresmtp", String.valueOf(smtpNoSSLCheckBox.isSelected()));
            Settings.setProperty("davmail.caldavPort",
                    caldavPortCheckBox.isSelected() ? caldavPortField.getText() : "");
            Settings.setProperty("davmail.ssl.nosecurecaldav",
                    String.valueOf(caldavNoSSLCheckBox.isSelected()));
            Settings.setProperty("davmail.ldapPort",
                    ldapPortCheckBox.isSelected() ? ldapPortField.getText() : "");
            Settings.setProperty("davmail.ssl.nosecureldap", String.valueOf(ldapNoSSLCheckBox.isSelected()));
            Settings.setProperty("davmail.keepDelay", keepDelayField.getText());
            Settings.setProperty("davmail.sentKeepDelay", sentKeepDelayField.getText());
            Settings.setProperty("davmail.caldavPastDelay", caldavPastDelayField.getText());
            Settings.setProperty("davmail.imapIdleDelay", imapIdleDelayField.getText());
            Settings.setProperty("davmail.useSystemProxies",
                    String.valueOf(useSystemProxiesField.isSelected()));
            Settings.setProperty("davmail.enableProxy", String.valueOf(enableProxyField.isSelected()));
            Settings.setProperty("davmail.proxyHost", httpProxyField.getText());
            Settings.setProperty("davmail.proxyPort", httpProxyPortField.getText());
            Settings.setProperty("davmail.proxyUser", httpProxyUserField.getText());
            Settings.setProperty("davmail.proxyPassword", httpProxyPasswordField.getText());
            Settings.setProperty("davmail.noProxyFor", noProxyForField.getText());

            Settings.setProperty("davmail.bindAddress", bindAddressField.getText());
            Settings.setProperty("davmail.clientSoTimeout", String.valueOf(clientSoTimeoutField.getText()));
            Settings.setProperty("davmail.allowRemote", String.valueOf(allowRemoteField.isSelected()));
            Settings.setProperty("davmail.server.certificate.hash", certHashField.getText());
            Settings.setProperty("davmail.disableUpdateCheck", String.valueOf(disableUpdateCheck.isSelected()));

            Settings.setProperty("davmail.caldavEditNotifications",
                    String.valueOf(caldavEditNotificationsField.isSelected()));
            Settings.setProperty("davmail.caldavAlarmSound", String.valueOf(caldavAlarmSoundField.getText()));
            Settings.setProperty("davmail.forceActiveSyncUpdate",
                    String.valueOf(forceActiveSyncUpdateCheckBox.isSelected()));
            Settings.setProperty("davmail.defaultDomain", String.valueOf(defaultDomainField.getText()));
            Settings.setProperty("davmail.showStartupBanner",
                    String.valueOf(showStartupBannerCheckBox.isSelected()));
            Settings.setProperty("davmail.disableGuiNotifications",
                    String.valueOf(disableGuiNotificationsCheckBox.isSelected()));
            Settings.setProperty("davmail.imapAutoExpunge",
                    String.valueOf(imapAutoExpungeCheckBox.isSelected()));
            Settings.setProperty("davmail.popMarkReadOnRetr",
                    String.valueOf(popMarkReadOnRetrCheckBox.isSelected()));
            String selectedEwsMode = (String) enableEwsComboBox.getSelectedItem();
            String enableEws;
            if (EWS.equals(selectedEwsMode)) {
                enableEws = "true";
            } else if (WEBDAV.equals(selectedEwsMode)) {
                enableEws = "false";
            } else {
                enableEws = "auto";
            }
            Settings.setProperty("davmail.enableEws", enableEws);
            Settings.setProperty("davmail.smtpSaveInSent", String.valueOf(smtpSaveInSentCheckBox.isSelected()));

            Settings.setProperty("davmail.ssl.keystoreType", (String) keystoreTypeCombo.getSelectedItem());
            Settings.setProperty("davmail.ssl.keystoreFile", keystoreFileField.getText());
            Settings.setProperty("davmail.ssl.keystorePass", String.valueOf(keystorePassField.getPassword()));
            Settings.setProperty("davmail.ssl.keyPass", String.valueOf(keyPassField.getPassword()));

            Settings.setProperty("davmail.ssl.clientKeystoreType",
                    (String) clientKeystoreTypeCombo.getSelectedItem());
            Settings.setProperty("davmail.ssl.clientKeystoreFile", clientKeystoreFileField.getText());
            Settings.setProperty("davmail.ssl.clientKeystorePass",
                    String.valueOf(clientKeystorePassField.getPassword()));
            Settings.setProperty("davmail.ssl.pkcs11Library", pkcs11LibraryField.getText());
            Settings.setProperty("davmail.ssl.pkcs11Config", pkcs11ConfigField.getText());

            Settings.setLoggingLevel("rootLogger", (Level) rootLoggingLevelField.getSelectedItem());
            Settings.setLoggingLevel("davmail", (Level) davmailLoggingLevelField.getSelectedItem());
            Settings.setLoggingLevel("org.apache.commons.httpclient",
                    (Level) httpclientLoggingLevelField.getSelectedItem());
            Settings.setLoggingLevel("httpclient.wire", (Level) wireLoggingLevelField.getSelectedItem());
            Settings.setProperty("davmail.logFilePath", logFilePathField.getText());
            Settings.setProperty("davmail.logFileSize", logFileSizeField.getText());

            setVisible(false);
            Settings.save();

            if (osxHideFromDockCheckBox != null) {
                OSXInfoPlist.setOSXHideFromDock(osxHideFromDockCheckBox.isSelected());
            }

            // restart listeners with new config
            DavGateway.restart();
        }
    };
    ok.addActionListener(save);

    cancel.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            reload();
            setVisible(false);
        }
    });

    help.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            DesktopBrowser.browse("http://davmail.sourceforge.net");
        }
    });

    buttonPanel.add(ok);
    buttonPanel.add(cancel);
    buttonPanel.add(help);

    add(BorderLayout.SOUTH, buttonPanel);

    pack();
    //setResizable(false);
    // center frame
    setLocation(getToolkit().getScreenSize().width / 2 - getSize().width / 2,
            getToolkit().getScreenSize().height / 2 - getSize().height / 2);
    urlField.requestFocus();
}

From source file:edu.clemson.cs.nestbed.client.gui.ConfigManagerFrame.java

private final JPanel buildBottomPanel() {
    JPanel panel = new JPanel(new BorderLayout());
    JTabbedPane tabbedPane = new JTabbedPane();
    Dimension size = new Dimension(WINDOW_WIDTH, WINDOW_HEIGHT / 10);

    panel.setSize(size);/*from www. j  av  a2 s .  com*/
    panel.setPreferredSize(size);

    tabbedPane.add("Symbol Profiling", new JScrollPane(profilingSymbolTable));

    tabbedPane.add("Message Profiling", new JScrollPane(profilingMsgTable));

    tabbedPane.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            profilingSymbolTable.clearSelection();
            profilingMsgTable.clearSelection();
        }
    });
    panel.add(tabbedPane);

    return panel;
}

From source file:com.polivoto.vistas.Charts.java

private void crearPieChart(Pregunta pregunta) {
    JTabbedPane tabPanel = new JTabbedPane();
    panelGrafica.add(tabPanel);//from   w ww  .j av  a  2s.c o  m

    //Calcular el nmero N de perfiles. Si N=1, no discriminar por pestanas. 
    //Si son N perfiles (N>2), hacer N+1 pestanas (la ltima representa la
    //suma de los resultados sin segregacin.
    int n = pregunta.obtenerCantidadDePerfiles();
    System.out.println(" n " + n);
    if (n > 1) {
        for (int i = 0; i < n; i++) {
            JPanel panel = hacerPiePanel(pregunta, pregunta.obtenerResultadoPorPerfil(i).getOpciones());
            panel.setName(pregunta.obtenerResultadoPorPerfil(i).getPerfil());
            tabPanel.addTab(panel.getName(), panel);

        }
    }

    JPanel panel = hacerPiePanel(pregunta, pregunta.obtenerOpciones());
    panel.setName("Todos");
    tabPanel.addTab(panel.getName(), panel);
    tabPanel.setFont(new Font("Roboto", 0, 24));
    tabPanel.addChangeListener(new ChangeListener() {

        @Override
        public void stateChanged(ChangeEvent e) {
            tabIndex = ((JTabbedPane) (e.getSource())).getSelectedIndex();
        }
    });
    tabPanel.setSelectedIndex(tabIndex);
    panelGrafica.add(tabPanel, BorderLayout.CENTER);
    panelGrafica.repaint();
    panelGrafica.revalidate();
}

From source file:net.pms.newgui.LooksFrame.java

public JComponent buildMain() {
    final JTabbedPane tabbedPane = new JTabbedPane(SwingConstants.TOP);

    tabbedPane.setUI(new CustomTabbedPaneUI());

    st = new StatusTab(configuration);
    tt = new TracesTab(configuration, this);
    gt = new GeneralTab(configuration, this);
    nt = new NavigationShareTab(configuration, this);
    tr = new TranscodingTab(configuration, this);
    ht = new HelpTab();

    tabbedPane.addTab(Messages.getString("LooksFrame.18"), st.build());
    tabbedPane.addTab(Messages.getString("LooksFrame.19"), tt.build());
    tabbedPane.addTab(Messages.getString("LooksFrame.20"), gt.build());
    tabbedPane.addTab(Messages.getString("LooksFrame.22"), nt.build());
    if (!configuration.isDisableTranscoding()) {
        tabbedPane.addTab(Messages.getString("LooksFrame.21"), tr.build());
    } else {//w ww .j a v  a  2  s .  c  om
        tr.build();
    }
    tabbedPane.addTab(Messages.getString("LooksFrame.24"), new HelpTab().build());
    tabbedPane.addTab(Messages.getString("LooksFrame.25"), new AboutTab().build());

    tabbedPane.addChangeListener(new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent e) {
            int selectedIndex = tabbedPane.getSelectedIndex();

            if (HELP_PAGES[selectedIndex] != null) {
                PMS.setHelpPage(HELP_PAGES[selectedIndex]);

                // Update the contents of the help tab itself
                ht.updateContents();
            }
        }
    });

    tabbedPane.setBorder(new EmptyBorder(5, 5, 5, 5));

    /*
     * Set the orientation of the tabbedPane.
     * Note: Do not use applyComponentOrientation() here because it
     * messes with the layout of several tabs.
     */
    ComponentOrientation orientation = ComponentOrientation.getOrientation(PMS.getLocale());
    tabbedPane.setComponentOrientation(orientation);

    return tabbedPane;
}

From source file:burp.BurpExtender.java

@Override
public void registerExtenderCallbacks(final IBurpExtenderCallbacks callbacks) {
    // keep a reference to our callbacks object
    this.callbacks = callbacks;

    callbacks.registerContextMenuFactory(new ContextMenuFactory(this, callbacks));

    // set our extension name
    callbacks.setExtensionName("Code Dx");

    for (int i = 0; i < refreshSpinner.length; i++)
        refreshSpinner[i] = new ImageIcon(BurpExtender.class.getResource("/" + i + ".png"));

    // create our UI
    SwingUtilities.invokeLater(new Runnable() {
        @Override/*from  ww w. j  a  v  a  2 s . co m*/
        public void run() {
            pane = new JScrollPane(createMainPanel());
            refreshAnimation = new ButtonAnimationThread(projectRefresh, refreshSpinner);

            callbacks.customizeUiComponent(pane);

            // add the custom tab to Burp's UI
            callbacks.addSuiteTab(BurpExtender.this);

            // add listener to update projects list when Code Dx tab selected
            Component parent = pane.getParent();
            if (parent instanceof JTabbedPane) {
                final JTabbedPane tabs = (JTabbedPane) parent;
                final ChangeListener tabChangeListener = new ChangeListener() {
                    @Override
                    public void stateChanged(ChangeEvent arg0) {
                        if (pane == tabs.getSelectedComponent() && !updating && !"".equals(serverUrl.getText())
                                && !"".equals(apiKey.getText())) {
                            Thread updateThread = new Thread() {
                                public void run() {
                                    updateTargets();
                                    updateProjects(true);
                                }
                            };
                            updateThread.start();
                        } else if (pane != tabs.getSelectedComponent()) {
                            NameValuePair project = getProject();
                            if (project != null)
                                callbacks.saveExtensionSetting(BurpExtender.PROJECT_KEY, project.getValue());
                        }
                    }

                };
                tabs.addChangeListener(tabChangeListener);
                //Remove the change listener when the extension is unloaded
                callbacks.registerExtensionStateListener(new IExtensionStateListener() {
                    @Override
                    public void extensionUnloaded() {
                        tabs.removeChangeListener(tabChangeListener);
                    }
                });
            }
        }
    });
}

From source file:com.emental.mindraider.ui.frames.MindRaiderMainWindow.java

private MindRaiderMainWindow() {
    super(MindRaider.getTitle(), Gfx.getGraphicsConfiguration());
    addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);/* www. j  ava2 s .com*/
        }
    });
    // catch resize
    addComponentListener(this);

    configuration = new ConfigurationBean();

    // drag & drop registration
    DropTarget dropTarget = new DropTarget(this, (DropTargetListener) this);
    this.setDropTarget(dropTarget);

    // warn on different java version
    // checkJavaVersion();

    singleton = this;

    setIconImage(IconsRegistry.getImage("programIcon.gif"));
    SplashScreen splash = new SplashScreen(this, false);
    splash.showSplashScreen();

    // kernel init
    MindRaider.preSetProfiles();
    // message in here because of locales
    logger.debug(Messages.getString("MindRaiderJFrame.bootingKernel"));

    // master control panel
    MindRaider.setMasterToolBar(new MasterToolBar());
    getContentPane().add(MindRaider.masterToolBar, BorderLayout.NORTH);

    // status bar
    getContentPane().add(StatusBar.getStatusBar(), BorderLayout.SOUTH);

    // build menu
    buildMenu(MindRaider.spidersGraph);
    // profile
    MindRaider.setProfiles();

    // left sidebar: folder/notebooks hierarchy, taxonomies, ...
    final JTabbedPane leftSidebar = new JTabbedPane(SwingConstants.BOTTOM);
    leftSidebar.setTabPlacement(SwingConstants.TOP);
    // TODO add icons to tabs
    leftSidebar.addTab(Messages.getString("MindRaiderJFrame.explorer"), ExplorerJPanel.getInstance());

    // TODO just blank panel
    //leftSidebar.addTab("Tags",new OutlookBarMain());

    leftSidebar.addTab(
            Messages.getString("MindRaiderJFrame.trash"), /* IconsRegistry.getImageIcon("trashFull.png"), */
            TrashJPanel.getInstance());

    leftSidebar.setSelectedIndex(0);
    leftSidebar.addChangeListener(new ChangeListener() {

        public void stateChanged(ChangeEvent arg0) {
            if (arg0.getSource() instanceof JTabbedPane) {
                if (leftSidebar.getSelectedIndex() == 1) {
                    // refresh trash
                    TrashJPanel.getInstance().refresh();
                }
            }
        }
    });

    // main panel: (notebook outline & RDF Navigator) + Control panel
    JPanel mainPanel = new JPanel();
    mainPanel.setLayout(new BorderLayout());
    mainPanel.add(OutlineJPanel.getInstance(), BorderLayout.CENTER);

    // split: left sidebar/main panel
    leftSidebarSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftSidebar, mainPanel);
    leftSidebarSplitPane.setOneTouchExpandable(true);
    leftSidebarSplitPane.setDividerLocation(200);
    leftSidebarSplitPane.setLastDividerLocation(200);
    leftSidebarSplitPane.setDividerSize(6);
    leftSidebarSplitPane.setContinuousLayout(true);
    getContentPane().add(leftSidebarSplitPane, BorderLayout.CENTER);

    Gfx.centerAndShowWindow(this, 1024, 768);

    MindRaider.postSetProfiles();

    if (!configuration.isShowSpidersTagSnailPane()) {
        OutlineJPanel.getInstance().hideSpiders();
    }

    splash.hideSplash();
}

From source file:userinterface.graph.GraphOptionsPanel.java

/** This method is called from within the constructor to
 * initialize the form./* w  w w .j  a v  a2  s.c om*/
 * WARNING: Do NOT modify this code. The content of this method is
 * always regenerated by the Form Editor.
 */
//javax.swing.JPanel jPanel6;
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
private void initComponents() {
    java.awt.GridBagConstraints gridBagConstraints;
    javax.swing.JTabbedPane tabbedPanel;

    tabbedPanel = new javax.swing.JTabbedPane();
    graphOptionsPanel = new javax.swing.JPanel();
    innerGraphOptionsPanel = new javax.swing.JPanel();
    axisOptionsPanel = new javax.swing.JPanel();
    innerAxesOptionsPanel = new javax.swing.JPanel();
    axesOptionPanelSplitPane = new javax.swing.JSplitPane();
    axesTopPanel = new javax.swing.JPanel();
    axesInnerTopPanel = new javax.swing.JPanel();
    axesLabel = new javax.swing.JLabel();
    axesListPanel = new javax.swing.JPanel();
    axesInnerListPanel = new javax.swing.JPanel();
    axesListScrollPane = new javax.swing.JScrollPane();
    axesBottomPanel = new javax.swing.JPanel();
    seriesOptionsPanel = new javax.swing.JPanel();
    seriesOptionPanelSplitPane = new javax.swing.JSplitPane();
    seriesTopPanel = new javax.swing.JPanel();
    seriesInnerTopPanel = new javax.swing.JPanel();
    seriesLabel = new javax.swing.JLabel();
    seriesListPanel = new javax.swing.JPanel();
    seriesInnerListPanel = new javax.swing.JPanel();
    seriesListScrollPane = new javax.swing.JScrollPane();
    seriesButtonPanel = new javax.swing.JPanel();
    addSeries = new javax.swing.JButton();
    removeSeries = new javax.swing.JButton();
    moveUp = new javax.swing.JButton();
    moveDown = new javax.swing.JButton();
    viewData = new javax.swing.JButton();
    seriesBottomPanel = new javax.swing.JPanel();
    displayOptionsPanel = new javax.swing.JPanel();
    innerDisplayOptionsPanel = new javax.swing.JPanel();

    setLayout(new java.awt.BorderLayout());

    tabbedPanel.addChangeListener(new javax.swing.event.ChangeListener() {
        public void stateChanged(javax.swing.event.ChangeEvent evt) {
            tabbedPanelStateChanged(evt);
        }
    });

    graphOptionsPanel.setLayout(new java.awt.BorderLayout());

    graphOptionsPanel.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
    innerGraphOptionsPanel.setLayout(new java.awt.BorderLayout());

    innerGraphOptionsPanel.add(graphPropertiesTable, java.awt.BorderLayout.CENTER);
    graphOptionsPanel.add(innerGraphOptionsPanel, java.awt.BorderLayout.CENTER);

    tabbedPanel.addTab("Graph", graphOptionsPanel);

    axisOptionsPanel.setLayout(new java.awt.BorderLayout());

    axisOptionsPanel.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
    innerAxesOptionsPanel.setLayout(new java.awt.BorderLayout());

    axesOptionPanelSplitPane.setDividerLocation(80);
    axesOptionPanelSplitPane.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
    axesTopPanel.setLayout(new java.awt.BorderLayout());

    axesTopPanel.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
    axesInnerTopPanel.setLayout(new java.awt.BorderLayout());

    axesLabel.setText("Select Axis:");
    axesInnerTopPanel.add(axesLabel, java.awt.BorderLayout.NORTH);

    axesListPanel.setLayout(new java.awt.GridBagLayout());

    axesInnerListPanel.setLayout(new java.awt.BorderLayout());

    axesListScrollPane.setMaximumSize(new java.awt.Dimension(32767, 120));
    axesListScrollPane.setMinimumSize(new java.awt.Dimension(20, 22));
    axesListScrollPane.setPreferredSize(new java.awt.Dimension(3, 120));
    axesListScrollPane.setViewportView(axesList);
    axesInnerListPanel.add(axesListScrollPane, java.awt.BorderLayout.CENTER);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 0.75;
    gridBagConstraints.weighty = 1.0;
    axesListPanel.add(axesInnerListPanel, gridBagConstraints);

    axesInnerTopPanel.add(axesListPanel, java.awt.BorderLayout.CENTER);

    axesTopPanel.add(axesInnerTopPanel, java.awt.BorderLayout.CENTER);

    axesOptionPanelSplitPane.setLeftComponent(axesTopPanel);

    axesBottomPanel.setLayout(new java.awt.BorderLayout());

    axesBottomPanel.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
    axesBottomPanel.add(axisPropertiesTable, BorderLayout.CENTER);

    axesOptionPanelSplitPane.setRightComponent(axesBottomPanel);

    innerAxesOptionsPanel.add(axesOptionPanelSplitPane, java.awt.BorderLayout.CENTER);

    axisOptionsPanel.add(innerAxesOptionsPanel, java.awt.BorderLayout.CENTER);

    tabbedPanel.addTab("Axes", axisOptionsPanel);

    seriesOptionsPanel.setLayout(new java.awt.BorderLayout());

    seriesOptionsPanel.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
    seriesOptionPanelSplitPane.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
    seriesTopPanel.setLayout(new java.awt.BorderLayout());

    seriesTopPanel.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
    seriesInnerTopPanel.setLayout(new java.awt.BorderLayout());

    seriesLabel.setText("Select Series:");
    seriesInnerTopPanel.add(seriesLabel, java.awt.BorderLayout.NORTH);

    seriesListPanel.setLayout(new java.awt.GridBagLayout());

    seriesInnerListPanel.setLayout(new java.awt.BorderLayout());

    seriesListScrollPane.setMaximumSize(new java.awt.Dimension(32767, 120));
    seriesListScrollPane.setMinimumSize(new java.awt.Dimension(20, 22));
    seriesListScrollPane.setPreferredSize(new java.awt.Dimension(3, 120));
    seriesListScrollPane.setViewportView(seriesList);

    seriesInnerListPanel.add(seriesListScrollPane, java.awt.BorderLayout.CENTER);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 0.75;
    gridBagConstraints.weighty = 1.0;
    seriesListPanel.add(seriesInnerListPanel, gridBagConstraints);

    seriesButtonPanel.setLayout(new java.awt.GridLayout(5, 1, 5, 5));

    seriesButtonPanel.setMaximumSize(new java.awt.Dimension(2147483647, 105));
    addSeries.setText("Add");
    addSeries.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
    addSeries.setMinimumSize(new java.awt.Dimension(5, 25));
    addSeries.setPreferredSize(new java.awt.Dimension(5, 25));
    addSeries.setIcon(GUIPrism.getIconFromImage("smallAdd.png"));
    addSeries.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            addSeriesActionPerformed(evt);
        }
    });

    seriesButtonPanel.add(addSeries);

    removeSeries.setText("Remove");
    removeSeries.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
    removeSeries.setMinimumSize(new java.awt.Dimension(5, 25));
    removeSeries.setPreferredSize(new java.awt.Dimension(5, 25));
    removeSeries.setIcon(GUIPrism.getIconFromImage("smallRemove.png"));
    removeSeries.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            removeSeriesActionPerformed(evt);
        }
    });

    seriesButtonPanel.add(removeSeries);

    moveUp.setText("Move Up");
    moveUp.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
    moveUp.setMinimumSize(new java.awt.Dimension(5, 25));
    moveUp.setPreferredSize(new java.awt.Dimension(5, 25));
    moveUp.setIcon(GUIPrism.getIconFromImage("smallArrowUp.png"));
    moveUp.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            moveUpActionPerformed(evt);
        }
    });

    seriesButtonPanel.add(moveUp);

    moveDown.setText("Move Down");
    moveDown.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
    moveDown.setMinimumSize(new java.awt.Dimension(5, 25));
    moveDown.setPreferredSize(new java.awt.Dimension(5, 25));
    moveDown.setIcon(GUIPrism.getIconFromImage("smallArrowDown.png"));
    moveDown.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            moveDownActionPerformed(evt);
        }
    });

    seriesButtonPanel.add(moveDown);

    if (theModel instanceof Graph)
        viewData.setText("Edit Data");
    else if (theModel instanceof Histogram || theModel instanceof Graph3D)
        viewData.setText("View Data");

    viewData.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
    viewData.setIcon(GUIPrism.getIconFromImage("smallEditData.png"));
    viewData.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            viewDataActionPerformed(evt);
        }
    });

    seriesButtonPanel.add(viewData);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
    gridBagConstraints.weightx = 0.25;
    gridBagConstraints.weighty = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(0, 5, 0, 0);
    seriesListPanel.add(seriesButtonPanel, gridBagConstraints);

    seriesInnerTopPanel.add(seriesListPanel, java.awt.BorderLayout.CENTER);

    seriesTopPanel.add(seriesInnerTopPanel, java.awt.BorderLayout.CENTER);

    seriesOptionPanelSplitPane.setLeftComponent(seriesTopPanel);

    seriesBottomPanel.setLayout(new java.awt.BorderLayout());

    seriesBottomPanel.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
    seriesBottomPanel.add(seriesPropertiesTable, BorderLayout.CENTER);
    seriesOptionPanelSplitPane.setRightComponent(seriesBottomPanel);

    seriesOptionsPanel.add(seriesOptionPanelSplitPane, java.awt.BorderLayout.CENTER);

    tabbedPanel.addTab("Series", seriesOptionsPanel);

    displayOptionsPanel.setLayout(new java.awt.BorderLayout());

    displayOptionsPanel.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
    innerDisplayOptionsPanel.setLayout(new java.awt.BorderLayout());

    innerDisplayOptionsPanel.add(displayPropertiesTable, java.awt.BorderLayout.CENTER);

    displayOptionsPanel.add(innerDisplayOptionsPanel, java.awt.BorderLayout.CENTER);

    tabbedPanel.addTab("Display", displayOptionsPanel);

    add(tabbedPanel, java.awt.BorderLayout.CENTER);

}

From source file:org.freeplane.core.resources.components.OptionPanel.java

/**
 * This method builds the preferences panel.
 * A list of IPropertyControl is iterated through and
 * if the IPropertyControl is an instance of TabProperty,
 * it creates a new "tab" that can be clicked to reveal the appropriate panel.
 * If the previous selected tab was saved on close,
 * the appropriate tab is reopened./*from  www . jav a2  s.  co  m*/
 *
 * @param controlsTree  This is the data that needs to be built
 */
public void buildPanel(final DefaultMutableTreeNode controlsTree) {
    final JPanel centralPanel = new JPanel();
    centralPanel.setLayout(new GridLayout(1, 1));
    final JTabbedPane tabbedPane = new JTabbedPane();
    tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
    FormLayout bottomLayout = null;
    DefaultFormBuilder bottomBuilder = null;
    initControls(controlsTree);
    final Iterator<IPropertyControl> iterator = controls.iterator();
    int tabIndex = 0;
    while (iterator.hasNext()) {
        final IPropertyControl control = iterator.next();
        if (control instanceof TabProperty) {
            final TabProperty newTab = (TabProperty) control;
            bottomLayout = new FormLayout(newTab.getName(), "");
            bottomBuilder = new DefaultFormBuilder(bottomLayout);
            bottomBuilder.setDefaultDialogBorder();
            final JScrollPane bottomComponent = new JScrollPane(bottomBuilder.getPanel());
            UITools.setScrollbarIncrement(bottomComponent);
            final String tabName = TextUtils.getOptionalText(newTab.getLabel());
            tabStringToIndexMap.put(tabName, tabIndex);
            tabIndexToStringMap.put(tabIndex, tabName);
            tabbedPane.addTab(tabName, bottomComponent);
            tabIndex++;
        } else {
            control.layout(bottomBuilder);
        }
    }
    tabbedPane.addChangeListener(new ChangeListener() {
        public void stateChanged(final ChangeEvent event) {
            final JTabbedPane c = (JTabbedPane) event.getSource();
            selectedPanel = tabIndexToStringMap.get(c.getSelectedIndex());
        }
    });
    centralPanel.add(tabbedPane);
    if (selectedPanel != null && tabStringToIndexMap.containsKey(selectedPanel)) {
        // Without the containsKey call the loading of the tab "behaviour"/"behavior" gives a nullpointer exception
        tabbedPane.setSelectedIndex(tabStringToIndexMap.get(selectedPanel));
    }
    topDialog.getContentPane().add(centralPanel, BorderLayout.CENTER);
    final JButton cancelButton = new JButton();
    MenuBuilder.setLabelAndMnemonic(cancelButton, TextUtils.getRawText("cancel"));
    cancelButton.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent arg0) {
            closeWindow();
        }
    });
    final JButton okButton = new JButton();
    MenuBuilder.setLabelAndMnemonic(okButton, TextUtils.getRawText("ok"));
    okButton.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent arg0) {
            if (validate()) {
                closeWindow();
                feedback.writeProperties(getOptionProperties());
            }
        }
    });
    topDialog.getRootPane().setDefaultButton(okButton);
    topDialog.getContentPane().add(ButtonBarFactory.buildOKCancelBar(cancelButton, okButton),
            BorderLayout.SOUTH);
}

From source file:org.nuclos.client.genericobject.GenericObjectCollectController.java

private void addTabbedPaneListener(LayoutRoot root) {
    List<JTabbedPane> lstTabs = new ArrayList<JTabbedPane>();
    searchTabbedPanes(root.getRootComponent(), lstTabs);
    for (JTabbedPane tabPane : lstTabs) {
        tabPane.addChangeListener(
                new JTabbedPaneChangeListener(GenericObjectCollectController.this.getPreferences()));
    }/*from www .j a  va 2  s  .  c  o  m*/
}

From source file:zxmax.tools.timerreview.gui.StartTimerWindow.java

private void initComponents() {
    // setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 450, 300);/* www  .j av  a 2  s  .  c om*/

    JTabbedPane tabTimers = new JTabbedPane();

    tabTimers.addTab(I18N.getLabel(this.getClass(), TAB_NEW_TIMER_LABEL), getPnlNewTimer());

    tabTimers.addTab(I18N.getLabel(this.getClass(), TAB_TIMER_LIST_LABEL), new JPanel());

    ChangeListener changeListener = new TabbedPaneChangeListener();

    tabTimers.addChangeListener(changeListener);

    getContentPane().add(tabTimers);

    validatorService = (ValidatorService) Register.get(ValidatorService.class);

    getBasicDao();

    addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent evt) {
            // do not close the application from here ...
        }

    });
}