Search in sources :

Example 1 with JTabbedPane

use of javax.swing.JTabbedPane in project Smack by igniterealtime.

the class EnhancedDebugger method createDebug.

/**
     * Creates the debug process, which is a GUI window that displays XML traffic.
     */
private void createDebug() {
    // We'll arrange the UI into six tabs. The first tab contains all data, the second
    // client generated XML, the third server generated XML, the fourth allows to send 
    // ad-hoc messages and the fifth contains connection information.
    tabbedPane = new JTabbedPane();
    // Add the All Packets, Sent, Received and Interpreted panels
    addBasicPanels();
    // Add the panel to send ad-hoc messages
    addAdhocPacketPanel();
    // Add the connection information panel
    addInformationPanel();
    // Create a thread that will listen for all incoming packets and write them to
    // the GUI. This is what we call "interpreted" packet data, since it's the packet
    // data as Smack sees it and not as it's coming in as raw XML.
    packetReaderListener = new StanzaListener() {

        SimpleDateFormat dateFormatter = new SimpleDateFormat("HH:mm:ss:SS");

        @Override
        public void processStanza(final Stanza packet) {
            SwingUtilities.invokeLater(new Runnable() {

                @Override
                public void run() {
                    addReadPacketToTable(dateFormatter, packet);
                }
            });
        }
    };
    // Create a thread that will listen for all outgoing packets and write them to
    // the GUI.
    packetWriterListener = new StanzaListener() {

        SimpleDateFormat dateFormatter = new SimpleDateFormat("HH:mm:ss:SS");

        @Override
        public void processStanza(final Stanza packet) {
            SwingUtilities.invokeLater(new Runnable() {

                @Override
                public void run() {
                    addSentPacketToTable(dateFormatter, packet);
                }
            });
        }
    };
    // Create a thread that will listen for any connection closed event
    connListener = new AbstractConnectionListener() {

        @Override
        public void connectionClosed() {
            SwingUtilities.invokeLater(new Runnable() {

                @Override
                public void run() {
                    statusField.setValue("Closed");
                    EnhancedDebuggerWindow.connectionClosed(EnhancedDebugger.this);
                }
            });
        }

        @Override
        public void connectionClosedOnError(final Exception e) {
            SwingUtilities.invokeLater(new Runnable() {

                @Override
                public void run() {
                    statusField.setValue("Closed due to an exception");
                    EnhancedDebuggerWindow.connectionClosedOnError(EnhancedDebugger.this, e);
                }
            });
        }

        @Override
        public void reconnectingIn(final int seconds) {
            SwingUtilities.invokeLater(new Runnable() {

                @Override
                public void run() {
                    statusField.setValue("Attempt to reconnect in " + seconds + " seconds");
                }
            });
        }

        @Override
        public void reconnectionSuccessful() {
            SwingUtilities.invokeLater(new Runnable() {

                @Override
                public void run() {
                    statusField.setValue("Reconnection stablished");
                    EnhancedDebuggerWindow.connectionEstablished(EnhancedDebugger.this);
                }
            });
        }

        @Override
        public void reconnectionFailed(Exception e) {
            SwingUtilities.invokeLater(new Runnable() {

                @Override
                public void run() {
                    statusField.setValue("Reconnection failed");
                }
            });
        }
    };
}
Also used : JTabbedPane(javax.swing.JTabbedPane) Stanza(org.jivesoftware.smack.packet.Stanza) StanzaListener(org.jivesoftware.smack.StanzaListener) AbstractConnectionListener(org.jivesoftware.smack.AbstractConnectionListener) SimpleDateFormat(java.text.SimpleDateFormat) BadLocationException(javax.swing.text.BadLocationException) NotConnectedException(org.jivesoftware.smack.SmackException.NotConnectedException) TransformerException(javax.xml.transform.TransformerException) TransformerConfigurationException(javax.xml.transform.TransformerConfigurationException)

Example 2 with JTabbedPane

use of javax.swing.JTabbedPane in project pcgen by PCGen.

the class PreferencesPluginsPanel method addPluginPanes.

private void addPluginPanes(DefaultMutableTreeNode rootNode, DefaultMutableTreeNode pluginNode) {
    if (pluginsPanel == null) {
        pluginsPanel = new PreferencesPluginsPanel();
    }
    JTabbedPane tpane = new JTabbedPane();
    tpane.add(pluginsPanel.toString(), pluginsPanel);
    //$NON-NLS-1$
    settingsPanel.add(tpane, LanguageBundle.getString("in_Prefs_plugins"));
    rootNode.add(pluginNode);
}
Also used : JTabbedPane(javax.swing.JTabbedPane)

Example 3 with JTabbedPane

use of javax.swing.JTabbedPane in project pcgen by PCGen.

the class MainAbout method initComponents.

/**
	 * This method is called from within the constructor to
	 * initialize the form.
	 */
private void initComponents() {
    JTabbedPane mainPane = new JTabbedPane();
    //$NON-NLS-1$
    mainPane.add(LanguageBundle.getString("in_abt_credits"), buildCreditsPanel());
    //$NON-NLS-1$
    mainPane.add(LanguageBundle.getString("in_abt_libraries"), buildIncludesPanel());
    //$NON-NLS-1$
    mainPane.add(LanguageBundle.getString("in_abt_license"), buildLicensePanel());
    //$NON-NLS-1$
    mainPane.add(LanguageBundle.getString("in_abt_awards"), buildAwardsPanel());
    //$NON-NLS-1$
    mainPane.add(LanguageBundle.getString("in_abt_sponsors"), buildSponsorsPanel());
    setLayout(new BorderLayout());
    add(mainPane, BorderLayout.CENTER);
    mainPane.setPreferredSize(new Dimension(640, 480));
}
Also used : BorderLayout(java.awt.BorderLayout) JTabbedPane(javax.swing.JTabbedPane) Dimension(java.awt.Dimension)

Example 4 with JTabbedPane

use of javax.swing.JTabbedPane in project pcgen by PCGen.

the class OverlandPlugin method toolMenuItem.

/**
	 * Sets the index for the pane 
	 * @param evt
	 */
private void toolMenuItem(ActionEvent evt) {
    JTabbedPane tp = GMGenSystemView.getTabPane();
    IntStream.range(0, tp.getTabCount()).filter(i -> tp.getComponentAt(i) instanceof OverPanel).forEach(tp::setSelectedIndex);
}
Also used : IntStream(java.util.stream.IntStream) FocusOrStateChangeOccurredMessage(pcgen.pluginmgr.messages.FocusOrStateChangeOccurredMessage) InteractivePlugin(pcgen.pluginmgr.InteractivePlugin) JOptionPane(javax.swing.JOptionPane) Component(java.awt.Component) ActionEvent(java.awt.event.ActionEvent) OverPanel(plugin.overland.gui.OverPanel) File(java.io.File) AddMenuItemToGMGenToolsMenuMessage(gmgen.pluginmgr.messages.AddMenuItemToGMGenToolsMenuMessage) PCGenMessage(pcgen.pluginmgr.PCGenMessage) RequestAddTabToGMGenMessage(gmgen.pluginmgr.messages.RequestAddTabToGMGenMessage) GMGenSystemView(gmgen.GMGenSystemView) JMenuItem(javax.swing.JMenuItem) SettingsHandler(pcgen.core.SettingsHandler) Utility(pcgen.gui2.tools.Utility) JTabbedPane(javax.swing.JTabbedPane) PCGenMessageHandler(pcgen.pluginmgr.PCGenMessageHandler) LanguageBundle(pcgen.system.LanguageBundle) JTabbedPane(javax.swing.JTabbedPane) OverPanel(plugin.overland.gui.OverPanel)

Example 5 with JTabbedPane

use of javax.swing.JTabbedPane in project ACS by ACS-Community.

the class RemoteResponseWindow method getResultPanel.

/**
 * Return the ResultPanel property value.
 * @return javax.swing.JTabbedPane
 */
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private javax.swing.JTabbedPane getResultPanel() {
    if (ivjResultPanel == null) {
        try {
            ivjResultPanel = new javax.swing.JTabbedPane();
            ivjResultPanel.setName("ResultPanel");
            ivjResultPanel.insertTab("Text output", null, getTextPanel(), null, 0);
            ivjResultPanel.insertTab("Trend", null, getTrendPanel(), null, 1);
            ivjResultPanel.insertTab("Operations", null, getOperations(), null, 2);
            // set trend as default
            ivjResultPanel.setSelectedIndex(1);
            // text output switch
            ivjResultPanel.addChangeListener(new ChangeListener() {

                // This method is called whenever the selected tab changes
                public void stateChanged(ChangeEvent evt) {
                    JTabbedPane pane = (JTabbedPane) evt.getSource();
                    // Get current tab
                    textOutputTabSelected = (pane.getSelectedIndex() == 0);
                }
            });
        // user code begin {1}
        // user code end
        } catch (java.lang.Throwable ivjExc) {
            // user code begin {2}
            // user code end
            handleException(ivjExc);
        }
    }
    return ivjResultPanel;
}
Also used : ChangeEvent(javax.swing.event.ChangeEvent) JTabbedPane(javax.swing.JTabbedPane) JTabbedPane(javax.swing.JTabbedPane) ChangeListener(javax.swing.event.ChangeListener)

Aggregations

JTabbedPane (javax.swing.JTabbedPane)254 JPanel (javax.swing.JPanel)131 BorderLayout (java.awt.BorderLayout)74 JScrollPane (javax.swing.JScrollPane)68 JButton (javax.swing.JButton)61 JLabel (javax.swing.JLabel)61 Dimension (java.awt.Dimension)54 ActionEvent (java.awt.event.ActionEvent)41 ActionListener (java.awt.event.ActionListener)37 GridLayout (java.awt.GridLayout)31 ChangeListener (javax.swing.event.ChangeListener)30 ChangeEvent (javax.swing.event.ChangeEvent)29 GridBagLayout (java.awt.GridBagLayout)27 JCheckBox (javax.swing.JCheckBox)27 Insets (java.awt.Insets)26 JFrame (javax.swing.JFrame)26 JSplitPane (javax.swing.JSplitPane)26 GridBagConstraints (java.awt.GridBagConstraints)25 JComponent (javax.swing.JComponent)25 ImageIcon (javax.swing.ImageIcon)23