Example usage for javax.swing JTabbedPane getTitleAt

List of usage examples for javax.swing JTabbedPane getTitleAt

Introduction

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

Prototype

public String getTitleAt(int index) 

Source Link

Document

Returns the tab title at index.

Usage

From source file:org.ash.detail.DetailPanels.java

/**
 * Initialize DetailFrame//from  w ww. j a  va2 s  . co m
 */
private void initialize() {

    this.setLayout(new BorderLayout());
    this.setVisible(true);

    this.cpuSplitPaneMainDetail = new JSplitPane();
    this.schedulerSplitPaneMainDetail = new JSplitPane();
    this.userIOSplitPaneMainDetail = new JSplitPane();
    this.systemIOSplitPaneMainDetail = new JSplitPane();
    this.concurrencySplitPaneMainDetail = new JSplitPane();
    this.applicationSplitPaneMainDetail = new JSplitPane();
    this.commitSplitPaneMainDetail = new JSplitPane();
    this.configurationSplitPaneMainDetail = new JSplitPane();
    this.administrativeSplitPaneMainDetail = new JSplitPane();
    this.networkSplitPaneMainDetail = new JSplitPane();
    this.queuningSplitPaneMainDetail = new JSplitPane();
    this.clusterSplitPaneMainDetail = new JSplitPane();
    this.otherSplitPaneMainDetail = new JSplitPane();

    this.cpuChartPanel = this.cpuStackedChartMainObjectDetail.createChartPanel();
    this.schedulerChartPanel = this.schedulerStackedChartMainObjectDetail.createChartPanel();
    this.userIOChartPanel = this.userIOStackedChartMainObjectDetail.createChartPanel();
    this.systemIOChartPanel = this.systemIOStackedChartMainObjectDetail.createChartPanel();
    this.concurrencyChartPanel = this.concurrencyStackedChartMainObjectDetail.createChartPanel();
    this.applicationChartPanel = this.applicationStackedChartMainObjectDetail.createChartPanel();
    this.commitChartPanel = this.commitStackedChartMainObjectDetail.createChartPanel();
    this.configurationChartPanel = this.configurationStackedChartMainObjectDetail.createChartPanel();
    this.administrativeChartPanel = this.administrativeStackedChartMainObjectDetail.createChartPanel();
    this.networkChartPanel = this.networkStackedChartMainObjectDetail.createChartPanel();
    this.queuningChartPanel = this.queuningStackedChartMainObjectDetail.createChartPanel();
    this.clusterChartPanel = this.clusterStackedChartMainObjectDetail.createChartPanel();
    this.otherChartPanel = this.otherStackedChartMainObjectDetail.createChartPanel();

    /** Gantt graph */
    this.cpuSqlsAndSessions = new GanttDetails(this.mainFrame, this.database,
            Options.getInstance().getResource("cpuLabel.text"));
    this.schedulerSqlsAndSessions = new GanttDetails(this.mainFrame, this.database,
            Options.getInstance().getResource("schedulerLabel.text"));
    this.userIOSqlsAndSessions = new GanttDetails(this.mainFrame, this.database,
            Options.getInstance().getResource("userIOLabel.text"));
    this.systemIOSqlsAndSessions = new GanttDetails(this.mainFrame, this.database,
            Options.getInstance().getResource("systemIOLabel.text"));
    this.concurrencySqlsAndSessions = new GanttDetails(this.mainFrame, this.database,
            Options.getInstance().getResource("concurrencyLabel.text"));
    this.applicationSqlsAndSessions = new GanttDetails(this.mainFrame, this.database,
            Options.getInstance().getResource("applicationsLabel.text"));
    this.commitSqlsAndSessions = new GanttDetails(this.mainFrame, this.database,
            Options.getInstance().getResource("commitLabel.text"));
    this.configurationSqlsAndSessions = new GanttDetails(this.mainFrame, this.database,
            Options.getInstance().getResource("configurationLabel.text"));
    this.administrativeSqlsAndSessions = new GanttDetails(this.mainFrame, this.database,
            Options.getInstance().getResource("administrativeLabel.text"));
    this.networkSqlsAndSessions = new GanttDetails(this.mainFrame, this.database,
            Options.getInstance().getResource("networkLabel.text"));
    this.queuningSqlsAndSessions = new GanttDetails(this.mainFrame, this.database,
            Options.getInstance().getResource("queueningLabel.text"));
    this.clusterSqlsAndSessions = new GanttDetails(this.mainFrame, this.database,
            Options.getInstance().getResource("clusterLabel.text"));
    this.otherSqlsAndSessions = new GanttDetails(this.mainFrame, this.database,
            Options.getInstance().getResource("otherLabel.text"));

    this.cpuSplitPaneMainDetail.setOrientation(JSplitPane.VERTICAL_SPLIT);
    this.cpuSplitPaneMainDetail.add(this.cpuChartPanel, "top");
    this.cpuSplitPaneMainDetail.add(this.cpuSqlsAndSessions, "bottom");
    this.cpuSplitPaneMainDetail.setDividerLocation(this.dividerLocation);
    this.cpuSplitPaneMainDetail.setOneTouchExpandable(true);

    this.schedulerSplitPaneMainDetail.setOrientation(JSplitPane.VERTICAL_SPLIT);
    this.schedulerSplitPaneMainDetail.add(this.schedulerChartPanel, "top");
    this.schedulerSplitPaneMainDetail.add(this.schedulerSqlsAndSessions, "bottom");
    this.schedulerSplitPaneMainDetail.setDividerLocation(this.dividerLocation);
    this.schedulerSplitPaneMainDetail.setOneTouchExpandable(true);

    this.userIOSplitPaneMainDetail.setOrientation(JSplitPane.VERTICAL_SPLIT);
    this.userIOSplitPaneMainDetail.add(this.userIOChartPanel, "top");
    this.userIOSplitPaneMainDetail.add(this.userIOSqlsAndSessions, "bottom");
    this.userIOSplitPaneMainDetail.setDividerLocation(this.dividerLocation);
    this.userIOSplitPaneMainDetail.setOneTouchExpandable(true);

    this.systemIOSplitPaneMainDetail.setOrientation(JSplitPane.VERTICAL_SPLIT);
    this.systemIOSplitPaneMainDetail.add(this.systemIOChartPanel, "top");
    this.systemIOSplitPaneMainDetail.add(this.systemIOSqlsAndSessions, "bottom");
    this.systemIOSplitPaneMainDetail.setDividerLocation(this.dividerLocation);
    this.systemIOSplitPaneMainDetail.setOneTouchExpandable(true);

    this.concurrencySplitPaneMainDetail.setOrientation(JSplitPane.VERTICAL_SPLIT);
    this.concurrencySplitPaneMainDetail.add(this.concurrencyChartPanel, "top");
    this.concurrencySplitPaneMainDetail.add(this.concurrencySqlsAndSessions, "bottom");
    this.concurrencySplitPaneMainDetail.setDividerLocation(this.dividerLocation);
    this.concurrencySplitPaneMainDetail.setOneTouchExpandable(true);

    this.applicationSplitPaneMainDetail.setOrientation(JSplitPane.VERTICAL_SPLIT);
    this.applicationSplitPaneMainDetail.add(this.applicationChartPanel, "top");
    this.applicationSplitPaneMainDetail.add(this.applicationSqlsAndSessions, "bottom");
    this.applicationSplitPaneMainDetail.setDividerLocation(this.dividerLocation);
    this.applicationSplitPaneMainDetail.setOneTouchExpandable(true);

    this.commitSplitPaneMainDetail.setOrientation(JSplitPane.VERTICAL_SPLIT);
    this.commitSplitPaneMainDetail.add(this.commitChartPanel, "top");
    this.commitSplitPaneMainDetail.add(this.commitSqlsAndSessions, "bottom");
    this.commitSplitPaneMainDetail.setDividerLocation(this.dividerLocation);
    this.commitSplitPaneMainDetail.setOneTouchExpandable(true);

    this.configurationSplitPaneMainDetail.setOrientation(JSplitPane.VERTICAL_SPLIT);
    this.configurationSplitPaneMainDetail.add(this.configurationChartPanel, "top");
    this.configurationSplitPaneMainDetail.add(this.configurationSqlsAndSessions, "bottom");
    this.configurationSplitPaneMainDetail.setDividerLocation(this.dividerLocation);
    this.configurationSplitPaneMainDetail.setOneTouchExpandable(true);

    this.administrativeSplitPaneMainDetail.setOrientation(JSplitPane.VERTICAL_SPLIT);
    this.administrativeSplitPaneMainDetail.add(this.administrativeChartPanel, "top");
    this.administrativeSplitPaneMainDetail.add(this.administrativeSqlsAndSessions, "bottom");
    this.administrativeSplitPaneMainDetail.setDividerLocation(this.dividerLocation);
    this.administrativeSplitPaneMainDetail.setOneTouchExpandable(true);

    this.networkSplitPaneMainDetail.setOrientation(JSplitPane.VERTICAL_SPLIT);
    this.networkSplitPaneMainDetail.add(this.networkChartPanel, "top");
    this.networkSplitPaneMainDetail.add(this.networkSqlsAndSessions, "bottom");
    this.networkSplitPaneMainDetail.setDividerLocation(this.dividerLocation);
    this.networkSplitPaneMainDetail.setOneTouchExpandable(true);

    this.queuningSplitPaneMainDetail.setOrientation(JSplitPane.VERTICAL_SPLIT);
    this.queuningSplitPaneMainDetail.add(this.queuningChartPanel, "top");
    this.queuningSplitPaneMainDetail.add(this.queuningSqlsAndSessions, "bottom");
    this.queuningSplitPaneMainDetail.setDividerLocation(this.dividerLocation);
    this.queuningSplitPaneMainDetail.setOneTouchExpandable(true);

    this.clusterSplitPaneMainDetail.setOrientation(JSplitPane.VERTICAL_SPLIT);
    this.clusterSplitPaneMainDetail.add(this.clusterChartPanel, "top");
    this.clusterSplitPaneMainDetail.add(this.clusterSqlsAndSessions, "bottom");
    this.clusterSplitPaneMainDetail.setDividerLocation(this.dividerLocation);
    this.clusterSplitPaneMainDetail.setOneTouchExpandable(true);

    this.otherSplitPaneMainDetail.setOrientation(JSplitPane.VERTICAL_SPLIT);
    this.otherSplitPaneMainDetail.add(this.otherChartPanel, "top");
    this.otherSplitPaneMainDetail.add(this.otherSqlsAndSessions, "bottom");
    this.otherSplitPaneMainDetail.setDividerLocation(this.dividerLocation);
    this.otherSplitPaneMainDetail.setOneTouchExpandable(true);

    this.tabsDetail.add(this.cpuSplitPaneMainDetail, Options.getInstance().getResource("cpuLabel.text"));
    this.tabsDetail.add(this.schedulerSplitPaneMainDetail,
            Options.getInstance().getResource("schedulerLabel.text"));
    this.tabsDetail.add(this.userIOSplitPaneMainDetail, Options.getInstance().getResource("userIOLabel.text"));
    this.tabsDetail.add(this.systemIOSplitPaneMainDetail,
            Options.getInstance().getResource("systemIOLabel.text"));
    this.tabsDetail.add(this.concurrencySplitPaneMainDetail,
            Options.getInstance().getResource("concurrencyLabel.text"));
    this.tabsDetail.add(this.applicationSplitPaneMainDetail,
            Options.getInstance().getResource("applicationsLabel.text"));
    this.tabsDetail.add(this.commitSplitPaneMainDetail, Options.getInstance().getResource("commitLabel.text"));
    this.tabsDetail.add(this.configurationSplitPaneMainDetail,
            Options.getInstance().getResource("configurationLabel.text"));
    this.tabsDetail.add(this.administrativeSplitPaneMainDetail,
            Options.getInstance().getResource("administrativeLabel.text"));
    this.tabsDetail.add(this.networkSplitPaneMainDetail,
            Options.getInstance().getResource("networkLabel.text"));
    this.tabsDetail.add(this.queuningSplitPaneMainDetail,
            Options.getInstance().getResource("queueningLabel.text"));
    this.tabsDetail.add(this.clusterSplitPaneMainDetail,
            Options.getInstance().getResource("clusterLabel.text"));
    this.tabsDetail.add(this.otherSplitPaneMainDetail, Options.getInstance().getResource("otherLabel.text"));

    this.cpuChartPanel.addListenerReleaseMouse(this.cpuSqlsAndSessions);
    this.schedulerChartPanel.addListenerReleaseMouse(this.schedulerSqlsAndSessions);
    this.userIOChartPanel.addListenerReleaseMouse(this.userIOSqlsAndSessions);
    this.systemIOChartPanel.addListenerReleaseMouse(this.systemIOSqlsAndSessions);
    this.concurrencyChartPanel.addListenerReleaseMouse(this.concurrencySqlsAndSessions);
    this.applicationChartPanel.addListenerReleaseMouse(this.applicationSqlsAndSessions);
    this.commitChartPanel.addListenerReleaseMouse(this.commitSqlsAndSessions);
    this.configurationChartPanel.addListenerReleaseMouse(this.configurationSqlsAndSessions);
    this.administrativeChartPanel.addListenerReleaseMouse(this.administrativeSqlsAndSessions);
    this.networkChartPanel.addListenerReleaseMouse(this.networkSqlsAndSessions);
    this.queuningChartPanel.addListenerReleaseMouse(this.queuningSqlsAndSessions);
    this.clusterChartPanel.addListenerReleaseMouse(this.clusterSqlsAndSessions);
    this.otherChartPanel.addListenerReleaseMouse(this.otherSqlsAndSessions);

    this.cpuChartPanel.addListenerReleaseMouse(this.statusBar);
    this.schedulerChartPanel.addListenerReleaseMouse(this.statusBar);
    this.userIOChartPanel.addListenerReleaseMouse(this.statusBar);
    this.systemIOChartPanel.addListenerReleaseMouse(this.statusBar);
    this.concurrencyChartPanel.addListenerReleaseMouse(this.statusBar);
    this.applicationChartPanel.addListenerReleaseMouse(this.statusBar);
    this.commitChartPanel.addListenerReleaseMouse(this.statusBar);
    this.configurationChartPanel.addListenerReleaseMouse(this.statusBar);
    this.administrativeChartPanel.addListenerReleaseMouse(this.statusBar);
    this.networkChartPanel.addListenerReleaseMouse((Object) this.statusBar);
    this.queuningChartPanel.addListenerReleaseMouse((Object) this.statusBar);
    this.clusterChartPanel.addListenerReleaseMouse((Object) this.statusBar);
    this.otherChartPanel.addListenerReleaseMouse((Object) this.statusBar);

    ChangeListener changeListener = new ChangeListener() {
        public void stateChanged(ChangeEvent changeEvent) {
            JTabbedPane sourceTabbedPane = (JTabbedPane) changeEvent.getSource();
            int index = sourceTabbedPane.getSelectedIndex();
            statusBar.updateLabelStringDetail(sourceTabbedPane.getTitleAt(index));
        }
    };
    tabsDetail.addChangeListener(changeListener);

    this.add(tabsDetail, BorderLayout.CENTER);
}

From source file:com.mirth.connect.client.ui.DashboardPanel.java

public DashboardPanel() {
    this.parent = PlatformUI.MIRTH_FRAME;

    haltableStates.add(DeployedState.DEPLOYING);
    haltableStates.add(DeployedState.UNDEPLOYING);
    haltableStates.add(DeployedState.STARTING);
    haltableStates.add(DeployedState.STOPPING);
    haltableStates.add(DeployedState.PAUSING);
    haltableStates.add(DeployedState.SYNCING);
    haltableStates.add(DeployedState.UNKNOWN);

    initComponents();//  ww w .  j a  va2  s.  co  m
    initLayout();

    loadTabPlugins();
    ChangeListener changeListener = new ChangeListener() {

        public void stateChanged(ChangeEvent changeEvent) {
            JTabbedPane sourceTabbedPane = (JTabbedPane) changeEvent.getSource();
            int index = sourceTabbedPane.getSelectedIndex();

            if (LoadedExtensions.getInstance().getDashboardTabPlugins().size() > 0) {
                loadPanelPlugin(LoadedExtensions.getInstance().getDashboardTabPlugins()
                        .get(sourceTabbedPane.getTitleAt(index)));
            }
        }
    };
    tabPane.addChangeListener(changeListener);

    defaultVisibleColumns = new LinkedHashSet<String>();

    makeStatusTable();
    loadTablePlugins();

    this.setDoubleBuffered(true);

    DashboardTreeTableModel model = (DashboardTreeTableModel) dashboardTable.getTreeTableModel();

    if (Preferences.userNodeForPackage(Mirth.class).getBoolean("channelGroupViewEnabled", true)) {
        tableModeGroupsButton.setSelected(true);
        tableModeGroupsButton.setContentFilled(true);
        tableModeChannelsButton.setContentFilled(false);
        model.setGroupModeEnabled(true);
    } else {
        tableModeChannelsButton.setSelected(true);
        tableModeChannelsButton.setContentFilled(true);
        tableModeGroupsButton.setContentFilled(false);
        model.setGroupModeEnabled(false);
    }
}

From source file:gui.LauncherFrame.java

/**
 * removes a tab that begins with the specified name.
 * /*from   w w w  .jav a2  s  . c om*/
 * @param tabbedPane - the tabbed pane to remove an entry from
 * @param name - the name (or begining of the name) of the tab
 * 
 * @return 1 if tab removed, 0 if not
 */
private int removeTextTab(javax.swing.JTabbedPane tabbedPane, String name) {
    int count = tabbedPane.getTabCount();
    for (int ix = 0; ix < count; ix++) {
        String tabname = tabbedPane.getTitleAt(ix);
        if (tabname.startsWith(name)) {
            tabbedPane.removeTabAt(ix);
            debug.print(DebugMessage.StatusType.Info, "Removed tab: " + tabname);
            return 1;
        }
    }

    return 0;
}

From source file:net.rptools.maptool.launcher.MapToolLauncher.java

/**
 * This method is called from within the constructor to initialize the form
 * components.//from   w  ww.j  a  v a 2  s .  co  m
 */
private void initComponents() {
    // Lee: for aesthetics and Linux won't display window controls on an untitled window.
    final String version = CopiedFromOtherJars.getVersion();
    setTitle(CopiedFromOtherJars.getText("msg.title.mainWindow", version)); //$NON-NLS-1$

    if (jbPathText == null)
        jbPathText = CopiedFromOtherJars.getText("msg.info.setJavaVersion"); //$NON-NLS-1$
    if (jbMTJarText == null)
        jbMTJarText = CopiedFromOtherJars.getText("msg.info.selectMapToolJar"); //$NON-NLS-1$
    if (mapToolJarName == null)
        mapToolJarName = CopiedFromOtherJars.getText("msg.info.selectMapToolJar"); //$NON-NLS-1$

    final Container cp = getContentPane();
    cp.setLayout(new BorderLayout());

    final JPanel basicPanel = buildBasicPanel();
    final JPanel langPanel = buildLanguagePanel();
    final JPanel advancedPanel = buildAdvancedPanel();
    final JPanel tsPanel = buildTroubleshootingPanel();

    mtlOptions.addTab(CopiedFromOtherJars.getText("msg.tab.basic"), basicPanel); //$NON-NLS-1$
    mtlOptions.addTab(CopiedFromOtherJars.getText("msg.tab.language"), langPanel); //$NON-NLS-1$
    mtlOptions.addTab(CopiedFromOtherJars.getText("msg.tab.advanced"), advancedPanel); //$NON-NLS-1$
    mtlOptions.addTab(CopiedFromOtherJars.getText("msg.tab.troubleshoot"), tsPanel); //$NON-NLS-1$

    cp.add(mtlOptions, BorderLayout.CENTER);
    cp.add(jtfCommand, BorderLayout.SOUTH);

    // Lee: user must register MT executable
    jbLaunch.setEnabled(
            !mapToolJarName.equalsIgnoreCase(CopiedFromOtherJars.getText("msg.info.selectMapToolJar"))); //$NON-NLS-1$

    jbLaunch.setText(CopiedFromOtherJars.getText("msg.info.launchMapTool")); //$NON-NLS-1$
    jbLaunch.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            try {
                jbLaunchActionPerformed(evt);
            } catch (final IOException e) {
                e.printStackTrace();
            }
        }
    });

    jtfCommand.setEditable(false);
    jtfCommand.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));
    jtfCommand.setText(CopiedFromOtherJars.getText("msg.info.cmdLineShownHere")); //$NON-NLS-1$
    jtfCommand.addFocusListener(new FocusListener() {
        @Override
        public void focusGained(FocusEvent arg0) {
            jtfCommand.selectAll();
        }

        @Override
        public void focusLost(FocusEvent arg0) {
            jtfCommand.setCaretPosition(0);
        }
    });

    jcbKeepOpen.setSelected(false);
    jcbKeepOpen.setText(CopiedFromOtherJars.getText("msg.info.keepLauncherOpen")); //$NON-NLS-1$
    jcbKeepOpen.setToolTipText(CopiedFromOtherJars.getText("msg.tooltip.keepLauncherOpen")); //$NON-NLS-1$

    final JPanel lowerPanel = new JPanel();
    lowerPanel.setLayout(new GridLayout(3, 1));
    lowerPanel.setBorder(new LineBorder(Color.BLACK));
    lowerPanel.add(jbLaunch);
    lowerPanel.add(jcbKeepOpen);
    lowerPanel.add(jtfCommand);
    cp.add(lowerPanel, BorderLayout.SOUTH);

    mtlOptions.addChangeListener(new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent e) {
            final JTabbedPane source = (JTabbedPane) e.getSource();
            final String tabName = source.getTitleAt(source.getSelectedIndex());

            if (jbLaunch.isEnabled()) {
                jbLaunch.requestFocusInWindow();
            } else {
                if (tabName.equals(CopiedFromOtherJars.getText("msg.tab.basic"))) { //$NON-NLS-1$
                    jbMTJar.requestFocusInWindow();
                } else if (tabName.equals(CopiedFromOtherJars.getText("msg.tab.language"))) { //$NON-NLS-1$
                    // This should work as long as there's at least one language in the list.
                    langGroup.getElements().nextElement().requestFocusInWindow();
                } else if (tabName.equals(CopiedFromOtherJars.getText("msg.tab.advanced"))) { //$NON-NLS-1$
                    jcbConsole.requestFocusInWindow();
                    jtfArgs.setText(extraArgs);
                } else {
                    jcbEnableAssertions.requestFocusInWindow();
                }
            }
        }
    });
    Dimension d = new Dimension(advancedPanel.getPreferredSize().width, 25);
    jtfArgs.setPreferredSize(d);
    //      mtlOptions.setPreferredSize(new Dimension(350, getPreferredSize().height));
    d.width = -1;
    d.height = -1;
    JLabel tabLabel = null;
    int tabs = mtlOptions.getTabCount();
    while (tabs-- > 0) {
        Component tab = mtlOptions.getTabComponentAt(tabs);
        if (tab == null) {
            if (tabLabel == null)
                tabLabel = new JLabel();
            tabLabel.setText(mtlOptions.getTitleAt(tabs));
            tab = tabLabel;
        }
        Dimension dim = tab.getPreferredSize();
        d.width = Math.max(dim.width, d.width);
        d.height = Math.max(dim.height, d.height);
    }
    // Set width to width of largest tab * number of tabs, then add 20%.
    d.width = d.width * 120 / 100 * mtlOptions.getTabCount();
    setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    setIconImage(icon.getImage());

    // To prevent the tabs from wrapping or scrolling
    setMinimumSize(new Dimension(d.width, getSize().height));
    pack();
    setResizable(true);
}

From source file:GUI.MainWindow.java

private void ViewModeTabPaneStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_ViewModeTabPaneStateChanged
    JTabbedPane sourceTabbedPane = (JTabbedPane) evt.getSource();
    int index = sourceTabbedPane.getSelectedIndex();
    String title = sourceTabbedPane.getTitleAt(index);
    System.out.println("Tab changed to: " + sourceTabbedPane.getTitleAt(index));

    Object layout = RightPanelCardLayout.getLayout();
    if (layout instanceof java.awt.CardLayout) {
        java.awt.CardLayout cl = (java.awt.CardLayout) layout;
        if (title.equalsIgnoreCase("Vuln View")) {
            // Show the vuln view card
            cl.show(RightPanelCardLayout, "vulnView");

        } else if (title.equalsIgnoreCase("Host View")) {
            DefaultMutableTreeNode hostRoot = new TreeUtils()
                    .convertVulnViewToHostView((DefaultMutableTreeNode) this.VulnTree.getModel().getRoot());
            DefaultTreeModel dtm = ((DefaultTreeModel) this.HostTree.getModel());
            dtm.setRoot(hostRoot);//from  w  ww  . j  ava 2 s  .c o  m
            dtm.reload(hostRoot);
            // Expand all nodes to make everything visible
            new TreeUtils().expandAll(this.HostTree);
            // Show the host view card
            cl.show(RightPanelCardLayout, "hostView");
        }
    }

    //cardLayout.show(cardPanel, "CardToShow");
    //java.awt.CardLayout cl = (java.awt.CardLayout)(RightPanelCardLayout.getLayout()) ;
    //        

}

From source file:com.net2plan.gui.tools.GUINetworkDesign.java

@Override
public void configure(JPanel contentPane) {
    this.currentNetPlan = new NetPlan();

    BidiMap<NetworkLayer, Integer> mapLayer2VisualizationOrder = new DualHashBidiMap<>();
    Map<NetworkLayer, Boolean> layerVisibilityMap = new HashMap<>();
    for (NetworkLayer layer : currentNetPlan.getNetworkLayers()) {
        mapLayer2VisualizationOrder.put(layer, mapLayer2VisualizationOrder.size());
        layerVisibilityMap.put(layer, true);
    }//  w ww . j  ava 2s . co  m
    this.vs = new VisualizationState(currentNetPlan, mapLayer2VisualizationOrder, layerVisibilityMap,
            MAXSIZEUNDOLISTPICK);

    topologyPanel = new TopologyPanel(this, JUNGCanvas.class);

    JPanel leftPane = new JPanel(new BorderLayout());
    JPanel logSection = configureLeftBottomPanel();
    if (logSection == null) {
        leftPane.add(topologyPanel, BorderLayout.CENTER);
    } else {
        JSplitPane splitPaneTopology = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
        splitPaneTopology.setTopComponent(topologyPanel);
        splitPaneTopology.setBottomComponent(logSection);
        splitPaneTopology.addPropertyChangeListener(new ProportionalResizeJSplitPaneListener());
        splitPaneTopology.setBorder(new LineBorder(contentPane.getBackground()));
        splitPaneTopology.setOneTouchExpandable(true);
        splitPaneTopology.setDividerSize(7);
        leftPane.add(splitPaneTopology, BorderLayout.CENTER);
    }
    contentPane.add(leftPane, "grow");

    viewEditTopTables = new ViewEditTopologyTablesPane(GUINetworkDesign.this, new BorderLayout());

    reportPane = new ViewReportPane(GUINetworkDesign.this, JSplitPane.VERTICAL_SPLIT);

    setCurrentNetPlanDoNotUpdateVisualization(currentNetPlan);
    Pair<BidiMap<NetworkLayer, Integer>, Map<NetworkLayer, Boolean>> res = VisualizationState
            .generateCanvasDefaultVisualizationLayerInfo(getDesign());
    vs.setCanvasLayerVisibilityAndOrder(getDesign(), res.getFirst(), res.getSecond());

    /* Initialize the undo/redo manager, and set its initial design */
    this.undoRedoManager = new UndoRedoManager(this, MAXSIZEUNDOLISTCHANGES);
    this.undoRedoManager.addNetPlanChange();

    onlineSimulationPane = new OnlineSimulationPane(this);
    executionPane = new OfflineExecutionPanel(this);
    whatIfAnalysisPane = new WhatIfAnalysisPane(this);

    // Closing windows
    WindowUtils.clearFloatingWindows();

    final JTabbedPane tabPane = new JTabbedPane();
    tabPane.add(WindowController.WindowToTab.getTabName(WindowController.WindowToTab.network),
            viewEditTopTables);
    tabPane.add(WindowController.WindowToTab.getTabName(WindowController.WindowToTab.offline), executionPane);
    tabPane.add(WindowController.WindowToTab.getTabName(WindowController.WindowToTab.online),
            onlineSimulationPane);
    tabPane.add(WindowController.WindowToTab.getTabName(WindowController.WindowToTab.whatif),
            whatIfAnalysisPane);
    tabPane.add(WindowController.WindowToTab.getTabName(WindowController.WindowToTab.report), reportPane);

    // Installing customized mouse listener
    MouseListener[] ml = tabPane.getListeners(MouseListener.class);

    for (int i = 0; i < ml.length; i++) {
        tabPane.removeMouseListener(ml[i]);
    }

    // Left click works as usual, right click brings up a pop-up menu.
    tabPane.addMouseListener(new MouseAdapter() {
        public void mousePressed(MouseEvent e) {
            JTabbedPane tabPane = (JTabbedPane) e.getSource();

            int tabIndex = tabPane.getUI().tabForCoordinate(tabPane, e.getX(), e.getY());

            if (tabIndex >= 0 && tabPane.isEnabledAt(tabIndex)) {
                if (tabIndex == tabPane.getSelectedIndex()) {
                    if (tabPane.isRequestFocusEnabled()) {
                        tabPane.requestFocus();

                        tabPane.repaint(tabPane.getUI().getTabBounds(tabPane, tabIndex));
                    }
                } else {
                    tabPane.setSelectedIndex(tabIndex);
                }

                if (!tabPane.isEnabled() || SwingUtilities.isRightMouseButton(e)) {
                    final JPopupMenu popupMenu = new JPopupMenu();

                    final JMenuItem popWindow = new JMenuItem("Pop window out");
                    popWindow.addActionListener(e1 -> {
                        final int selectedIndex = tabPane.getSelectedIndex();
                        final String tabName = tabPane.getTitleAt(selectedIndex);
                        final JComponent selectedComponent = (JComponent) tabPane.getSelectedComponent();

                        // Pops up the selected tab.
                        final WindowController.WindowToTab windowToTab = WindowController.WindowToTab
                                .parseString(tabName);

                        if (windowToTab != null) {
                            switch (windowToTab) {
                            case offline:
                                WindowController.buildOfflineWindow(selectedComponent);
                                WindowController.showOfflineWindow(true);
                                break;
                            case online:
                                WindowController.buildOnlineWindow(selectedComponent);
                                WindowController.showOnlineWindow(true);
                                break;
                            case whatif:
                                WindowController.buildWhatifWindow(selectedComponent);
                                WindowController.showWhatifWindow(true);
                                break;
                            case report:
                                WindowController.buildReportWindow(selectedComponent);
                                WindowController.showReportWindow(true);
                                break;
                            default:
                                return;
                            }
                        }

                        tabPane.setSelectedIndex(0);
                    });

                    // Disabling the pop up button for the network state tab.
                    if (WindowController.WindowToTab.parseString(tabPane
                            .getTitleAt(tabPane.getSelectedIndex())) == WindowController.WindowToTab.network) {
                        popWindow.setEnabled(false);
                    }

                    popupMenu.add(popWindow);

                    popupMenu.show(e.getComponent(), e.getX(), e.getY());
                }
            }
        }
    });

    // Building windows
    WindowController.buildTableControlWindow(tabPane);
    WindowController.showTablesWindow(false);

    addAllKeyCombinationActions();
    updateVisualizationAfterNewTopology();
}

From source file:com.mirth.connect.client.ui.ChannelPanel.java

public void initPanelPlugins() {
    loadPanelPlugins();//  www . java  2  s.  c  om
    switchBottomPane();

    ChangeListener changeListener = new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent changeEvent) {
            JTabbedPane sourceTabbedPane = (JTabbedPane) changeEvent.getSource();
            int index = sourceTabbedPane.getSelectedIndex();
            loadPanelPlugin(sourceTabbedPane.getTitleAt(index));
        }
    };
    tabPane.addChangeListener(changeListener);
}

From source file:org.apache.jmeter.visualizers.RespTimeGraphVisualizer.java

/**
 * Initialize the GUI./*w w w .  j a  va2 s .c o  m*/
 */
private void init() { // WARNING: called from ctor so must not be overridden (i.e. must be private or final)
    this.setLayout(new BorderLayout());

    // MAIN PANEL
    JPanel mainPanel = new JPanel();
    Border margin = new EmptyBorder(10, 10, 5, 10);
    Border margin2 = new EmptyBorder(10, 10, 5, 10);

    mainPanel.setBorder(margin);
    mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
    mainPanel.add(makeTitlePanel());

    JPanel settingsPane = new VerticalPanel();
    settingsPane.setBorder(margin2);

    graphPanel = new RespTimeGraphChart();
    graphPanel.setPreferredSize(new Dimension(DEFAULT_WIDTH, DEFAULT_HEIGTH));

    settingsPane.add(createGraphActionsPane());
    settingsPane.add(createGraphSettingsPane());
    settingsPane.add(createGraphTitlePane());
    settingsPane.add(createLinePane());
    settingsPane.add(createGraphDimensionPane());
    JPanel axisPane = new JPanel(new BorderLayout());
    axisPane.add(createGraphXAxisPane(), BorderLayout.WEST);
    axisPane.add(createGraphYAxisPane(), BorderLayout.CENTER);
    settingsPane.add(axisPane);
    settingsPane.add(createLegendPane());

    tabbedGraph.addTab(JMeterUtils.getResString("aggregate_graph_tab_settings"), settingsPane); //$NON-NLS-1$
    tabbedGraph.addTab(JMeterUtils.getResString("aggregate_graph_tab_graph"), graphPanel); //$NON-NLS-1$

    // If clic on the Graph tab, make the graph (without apply interval or filter)
    ChangeListener changeListener = new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent changeEvent) {
            JTabbedPane srcTab = (JTabbedPane) changeEvent.getSource();
            int index = srcTab.getSelectedIndex();
            if (srcTab.getTitleAt(index).equals(JMeterUtils.getResString("aggregate_graph_tab_graph"))) { //$NON-NLS-1$
                actionMakeGraph();
            }
        }
    };
    tabbedGraph.addChangeListener(changeListener);

    this.add(mainPanel, BorderLayout.NORTH);
    this.add(tabbedGraph, BorderLayout.CENTER);

}

From source file:org.apache.jmeter.visualizers.StatGraphVisualizer.java

/**
 * Main visualizer setup./*from  w  ww  . j a v  a 2 s  .  c o  m*/
 */
private void init() { // WARNING: called from ctor so must not be overridden (i.e. must be private or final)
    this.setLayout(new BorderLayout());

    // MAIN PANEL
    JPanel mainPanel = new JPanel();
    Border margin = new EmptyBorder(10, 10, 5, 10);
    Border margin2 = new EmptyBorder(10, 10, 5, 10);

    mainPanel.setBorder(margin);
    mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
    mainPanel.add(makeTitlePanel());

    myJTable = new JTable(model);
    JMeterUtils.applyHiDPI(myJTable);
    // Fix centering of titles
    myJTable.getTableHeader().setDefaultRenderer(new HeaderAsPropertyRenderer(COLUMNS_MSG_PARAMETERS));
    myJTable.setPreferredScrollableViewportSize(new Dimension(500, 70));
    RendererUtils.applyRenderers(myJTable, RENDERERS);
    myScrollPane = new JScrollPane(myJTable);

    settingsPane = new VerticalPanel();
    settingsPane.setBorder(margin2);

    graphPanel = new AxisGraph();
    graphPanel.setPreferredSize(new Dimension(defaultWidth, defaultHeight));

    settingsPane.add(createGraphActionsPane());
    settingsPane.add(createGraphColumnPane());
    settingsPane.add(createGraphTitlePane());
    settingsPane.add(createGraphDimensionPane());
    JPanel axisPane = new JPanel(new BorderLayout());
    axisPane.add(createGraphXAxisPane(), BorderLayout.WEST);
    axisPane.add(createGraphYAxisPane(), BorderLayout.CENTER);
    settingsPane.add(axisPane);
    settingsPane.add(createLegendPane());

    tabbedGraph.addTab(JMeterUtils.getResString("aggregate_graph_tab_settings"), settingsPane); //$NON-NLS-1$
    tabbedGraph.addTab(JMeterUtils.getResString("aggregate_graph_tab_graph"), graphPanel); //$NON-NLS-1$

    // If clic on the Graph tab, make the graph (without apply interval or filter)
    ChangeListener changeListener = new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent changeEvent) {
            JTabbedPane srcTab = (JTabbedPane) changeEvent.getSource();
            int index = srcTab.getSelectedIndex();
            if (srcTab.getTitleAt(index).equals(JMeterUtils.getResString("aggregate_graph_tab_graph"))) { //$NON-NLS-1$
                actionMakeGraph();
            }
        }
    };
    tabbedGraph.addChangeListener(changeListener);

    spane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    spane.setLeftComponent(myScrollPane);
    spane.setRightComponent(tabbedGraph);
    spane.setResizeWeight(.2);
    spane.setBorder(null); // see bug jdk 4131528
    spane.setContinuousLayout(true);

    this.add(mainPanel, BorderLayout.NORTH);
    this.add(spane, BorderLayout.CENTER);
}

From source file:org.eclipse.jubula.rc.swing.listener.RecordActions.java

/**
 * select tab// w w w. ja v a 2  s .  c o m
 * @param jtpn JTabbedPane
 * @param id IComponentIdentifier
 * @param a Action
 */
protected void selectTab(JTabbedPane jtpn, IComponentIdentifier id, Action a) {
    List tpnValues = new LinkedList();
    String tpnTitle = StringParsing.singleQuoteText(jtpn.getTitleAt(jtpn.getSelectedIndex()));
    tpnValues.add(tpnTitle);
    tpnValues.add(Constants.REC_OPERATOR);

    String logName = createLogicalName(jtpn, id);

    createCAP(a, id, tpnValues, logName);
}