Search in sources :

Example 11 with CardLayout

use of java.awt.CardLayout in project AndroidWiFiADB by pedrovgs.

the class CardLayoutDevices method createAndShowGUI.

public void createAndShowGUI() {
    cards = new JPanel(new CardLayout());
    createNoDevicesPanel();
    createTableDevices();
    cards.add(panelDevices, CARD_DEVICES);
    cards.add(panelNoDevices, CARD_NO_DEVICES);
    parentContainer.add(cards, BorderLayout.PAGE_START);
    setupUi();
}
Also used : JPanel(javax.swing.JPanel) CardLayout(java.awt.CardLayout)

Example 12 with CardLayout

use of java.awt.CardLayout in project zaproxy by zaproxy.

the class ContextAuthorizationPanel method initialize.

/**
	 * Initialize the panel.
	 */
private void initialize() {
    this.setLayout(new CardLayout());
    this.setName(getContextIndex() + ": " + PANEL_NAME);
    this.setLayout(new GridBagLayout());
    this.setBorder(new EmptyBorder(2, 2, 2, 2));
    this.add(new JLabel(LABEL_DESCRIPTION), LayoutHelper.getGBC(0, 0, 2, 0.0D, new Insets(0, 0, 20, 0)));
    // Basic Authorization detection
    Insets insets = new Insets(2, 5, 2, 5);
    this.add(new JLabel(FIELD_LABEL_INTRO), LayoutHelper.getGBC(0, 1, 2, 0.0D, new Insets(0, 0, 5, 0)));
    JPanel configContainerPanel = new JPanel(new GridBagLayout());
    configContainerPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, FontUtils.getFont(FontUtils.Size.standard), java.awt.Color.black));
    this.add(configContainerPanel, LayoutHelper.getGBC(0, 2, 2, 0.0D));
    configContainerPanel.add(new JLabel(FIELD_LABEL_STATUS_CODE), LayoutHelper.getGBC(0, 2, 1, 0.0D));
    statusCodeComboBox = new JComboBox<>(STATUS_CODES);
    configContainerPanel.add(statusCodeComboBox, LayoutHelper.getGBC(1, 2, 1, 1.0D, insets));
    configContainerPanel.add(new JLabel(FIELD_LABEL_HEADER_PATTERN), LayoutHelper.getGBC(0, 3, 1, 0.0D));
    headerPatternText = new JTextField();
    configContainerPanel.add(headerPatternText, LayoutHelper.getGBC(1, 3, 1, 1.0D, insets));
    configContainerPanel.add(new JLabel(FIELD_LABEL_BODY_PATTERN), LayoutHelper.getGBC(0, 4, 1, 0.0D));
    bodyPatternText = new JTextField();
    configContainerPanel.add(bodyPatternText, LayoutHelper.getGBC(1, 4, 1, 1.0D, insets));
    logicalOperatorComboBox = new JComboBox<>(new String[] { FIELD_VALUE_AND_COMPOSITION, FIELD_VALUE_OR_COMPOSITION });
    configContainerPanel.add(logicalOperatorComboBox, LayoutHelper.getGBC(0, 5, 2, 0.0D, new Insets(2, 0, 2, 5)));
    // Padding
    this.add(new JLabel(), LayoutHelper.getGBC(0, 99, 2, 1.0D, 1.0D));
}
Also used : CardLayout(java.awt.CardLayout) JPanel(javax.swing.JPanel) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) JLabel(javax.swing.JLabel) EmptyBorder(javax.swing.border.EmptyBorder) JTextField(javax.swing.JTextField)

Example 13 with CardLayout

use of java.awt.CardLayout in project zaproxy by zaproxy.

the class ContextAuthenticationPanel method initialize.

/**
	 * Initialize the panel.
	 */
private void initialize() {
    this.setLayout(new CardLayout());
    this.setName(buildName(getContextIndex()));
    this.setLayout(new GridBagLayout());
    this.setBorder(new EmptyBorder(2, 2, 2, 2));
    this.add(new JLabel(LABEL_DESCRIPTION), LayoutHelper.getGBC(0, 0, 1, 1.0D));
    // Method type combo box
    this.add(new JLabel(FIELD_LABEL_TYPE_SELECT), LayoutHelper.getGBC(0, 1, 1, 1.0D, new Insets(20, 0, 5, 5)));
    this.add(getAuthenticationMethodsComboBox(), LayoutHelper.getGBC(0, 2, 1, 1.0D));
    // Method config panel container
    this.add(getConfigContainerPanel(), LayoutHelper.getGBC(0, 3, 1, 1.0d, new Insets(10, 0, 10, 0)));
    // Logged In/Out indicators
    this.add(new JLabel(FIELD_LABEL_LOGGED_IN_INDICATOR), LayoutHelper.getGBC(0, 4, 1, 1.0D));
    this.add(getLoggedInIndicaterRegexField(), LayoutHelper.getGBC(0, 5, 1, 1.0D));
    this.add(new JLabel(FIELD_LABEL_LOGGED_OUT_INDICATOR), LayoutHelper.getGBC(0, 6, 1, 1.0D));
    this.add(getLoggedOutIndicaterRegexField(), LayoutHelper.getGBC(0, 7, 1, 1.0D));
    // Padding
    this.add(new JLabel(), LayoutHelper.getGBC(0, 99, 1, 1.0D, 1.0D));
}
Also used : CardLayout(java.awt.CardLayout) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) JLabel(javax.swing.JLabel) EmptyBorder(javax.swing.border.EmptyBorder)

Example 14 with CardLayout

use of java.awt.CardLayout in project pcgen by PCGen.

the class PreferencesDialog method getCenter.

@Override
protected JComponent getCenter() {
    jSplitPane1 = new FlippingSplitPane();
    prefsTree = new javax.swing.JTree();
    prefsTree.setRootVisible(false);
    prefsTree.setShowsRootHandles(true);
    cardLayout = new CardLayout();
    prefsPane = new JPanel(cardLayout);
    prefsPane.add(new JPanel(), EMPTY);
    addWindowListener(new java.awt.event.WindowAdapter() {

        @Override
        public void windowClosing(java.awt.event.WindowEvent e) {
            close();
        }
    });
    jSplitPane1.setLeftComponent(new JScrollPane(prefsTree, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED));
    prefsTree.addTreeSelectionListener(evt -> PrefsTreeActionPerformed());
    jSplitPane1.setRightComponent(prefsPane);
    return jSplitPane1;
}
Also used : JScrollPane(javax.swing.JScrollPane) CardLayout(java.awt.CardLayout) JPanel(javax.swing.JPanel)

Example 15 with CardLayout

use of java.awt.CardLayout in project pcgen by PCGen.

the class PreferencesPluginsPanel method getCenter.

@Override
protected JComponent getCenter() {
    DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode("Root");
    DefaultMutableTreeNode characterNode;
    DefaultMutableTreeNode pcGenNode;
    DefaultMutableTreeNode appearanceNode;
    DefaultMutableTreeNode gameModeNode;
    panelList = new ArrayList<>(15);
    // Build the settings panel
    settingsPanel = new JPanel();
    settingsPanel.setLayout(new CardLayout());
    settingsPanel.setPreferredSize(new Dimension(780, 420));
    // Build the selection tree
    characterNode = new DefaultMutableTreeNode(in_character);
    settingsPanel.add(buildEmptyPanel("", LanguageBundle.getString("in_Prefs_charTip")), in_character);
    characterStatsPanel = new CharacterStatsPanel(this);
    addPanelToTree(characterNode, characterStatsPanel);
    hitPointsPanel = new HitPointsPanel();
    addPanelToTree(characterNode, hitPointsPanel);
    houseRulesPanel = new HouseRulesPanel();
    addPanelToTree(characterNode, houseRulesPanel);
    monsterPanel = new MonsterPanel();
    addPanelToTree(characterNode, monsterPanel);
    defaultsPanel = new DefaultsPanel();
    addPanelToTree(characterNode, defaultsPanel);
    rootNode.add(characterNode);
    appearanceNode = new DefaultMutableTreeNode(in_appearance);
    settingsPanel.add(buildEmptyPanel("", LanguageBundle.getString("in_Prefs_appearanceTip")), in_appearance);
    colorsPanel = new ColorsPanel();
    addPanelToTree(appearanceNode, colorsPanel);
    displayOptionsPanel = new DisplayOptionsPanel();
    addPanelToTree(appearanceNode, displayOptionsPanel);
    levelUpPanel = new LevelUpPanel();
    addPanelToTree(appearanceNode, levelUpPanel);
    lookAndFeelPanel = new LookAndFeelPanel(this);
    addPanelToTree(appearanceNode, lookAndFeelPanel);
    //		tabsPanel = new TabsPanel();
    //		addPanelToTree(appearanceNode, tabsPanel);
    rootNode.add(appearanceNode);
    pcGenNode = new DefaultMutableTreeNode(Constants.APPLICATION_NAME);
    settingsPanel.add(buildEmptyPanel("", LanguageBundle.getString("in_Prefs_pcgenTip")), Constants.APPLICATION_NAME);
    equipmentPanel = new EquipmentPanel();
    addPanelToTree(pcGenNode, equipmentPanel);
    languagePanel = new LanguagePanel();
    addPanelToTree(pcGenNode, languagePanel);
    locationPanel = new LocationPanel();
    addPanelToTree(pcGenNode, locationPanel);
    inputPanel = new InputPanel();
    addPanelToTree(pcGenNode, inputPanel);
    outputPanel = new OutputPanel();
    addPanelToTree(pcGenNode, outputPanel);
    sourcesPanel = new SourcesPanel();
    addPanelToTree(pcGenNode, sourcesPanel);
    rootNode.add(pcGenNode);
    String in_gamemode = LanguageBundle.getString("in_mnuSettingsCampaign");
    gameModeNode = new DefaultMutableTreeNode(in_gamemode);
    settingsPanel.add(buildEmptyPanel("", LanguageBundle.getString("in_mnuSettingsCampaignTip")), in_gamemode);
    copySettingsPanel = new CopySettingsPanel();
    addPanelToTree(gameModeNode, copySettingsPanel);
    rootNode.add(gameModeNode);
    DefaultMutableTreeNode pluginNode = new DefaultMutableTreeNode(//$NON-NLS-1$
    LanguageBundle.getString("in_Prefs_plugins"));
    addPluginPanes(rootNode, pluginNode);
    settingsModel = new DefaultTreeModel(rootNode);
    settingsTree = new JTree(settingsModel);
    settingsTree.setBorder(BorderFactory.createEmptyBorder(0, 3, 0, 0));
    settingsTree.setRootVisible(false);
    settingsTree.setShowsRootHandles(true);
    settingsTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    settingsScroll = new JScrollPane(settingsTree, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    // Turn off the icons
    DefaultTreeCellRenderer renderer = new DefaultTreeCellRenderer();
    renderer.setLeafIcon(null);
    renderer.setOpenIcon(null);
    renderer.setClosedIcon(null);
    settingsTree.setCellRenderer(renderer);
    // Expand all of the branch nodes
    settingsTree.expandPath(new TreePath(characterNode.getPath()));
    settingsTree.expandPath(new TreePath(pcGenNode.getPath()));
    settingsTree.expandPath(new TreePath(appearanceNode.getPath()));
    settingsTree.expandPath(new TreePath(gameModeNode.getPath()));
    settingsTree.expandPath(new TreePath(pluginNode.getPath()));
    // Add the listener which switches panels when a node of the tree is selected
    settingsTree.addTreeSelectionListener(new TreeSelectionListener() {

        @Override
        public void valueChanged(TreeSelectionEvent e) {
            DefaultMutableTreeNode node = (DefaultMutableTreeNode) settingsTree.getLastSelectedPathComponent();
            if (node == null) {
                return;
            }
            CardLayout cl = (CardLayout) (settingsPanel.getLayout());
            cl.show(settingsPanel, String.valueOf(node));
        }
    });
    // Build the split pane
    splitPane = new FlippingSplitPane(JSplitPane.HORIZONTAL_SPLIT, settingsScroll, settingsPanel, "Prefs");
    splitPane.setOneTouchExpandable(true);
    splitPane.setDividerSize(10);
    return splitPane;
}
Also used : JPanel(javax.swing.JPanel) LocationPanel(pcgen.gui2.prefs.LocationPanel) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) SourcesPanel(pcgen.gui2.prefs.SourcesPanel) OutputPanel(pcgen.gui2.prefs.OutputPanel) TreeSelectionListener(javax.swing.event.TreeSelectionListener) HitPointsPanel(pcgen.gui2.prefs.HitPointsPanel) CopySettingsPanel(pcgen.gui2.prefs.CopySettingsPanel) DefaultTreeCellRenderer(javax.swing.tree.DefaultTreeCellRenderer) HouseRulesPanel(pcgen.gui2.prefs.HouseRulesPanel) DisplayOptionsPanel(pcgen.gui2.prefs.DisplayOptionsPanel) LevelUpPanel(pcgen.gui2.prefs.LevelUpPanel) ColorsPanel(pcgen.gui2.prefs.ColorsPanel) LanguagePanel(pcgen.gui2.prefs.LanguagePanel) EquipmentPanel(pcgen.gui2.prefs.EquipmentPanel) JScrollPane(javax.swing.JScrollPane) CardLayout(java.awt.CardLayout) CharacterStatsPanel(pcgen.gui2.prefs.CharacterStatsPanel) InputPanel(pcgen.gui2.prefs.InputPanel) Dimension(java.awt.Dimension) DefaultTreeModel(javax.swing.tree.DefaultTreeModel) FlippingSplitPane(pcgen.gui2.tools.FlippingSplitPane) JTree(javax.swing.JTree) DefaultsPanel(pcgen.gui2.prefs.DefaultsPanel) TreePath(javax.swing.tree.TreePath) MonsterPanel(pcgen.gui2.prefs.MonsterPanel) LookAndFeelPanel(pcgen.gui2.prefs.LookAndFeelPanel) TreeSelectionEvent(javax.swing.event.TreeSelectionEvent)

Aggregations

CardLayout (java.awt.CardLayout)92 JPanel (javax.swing.JPanel)37 BorderLayout (java.awt.BorderLayout)16 JLabel (javax.swing.JLabel)14 JScrollPane (javax.swing.JScrollPane)12 Dimension (java.awt.Dimension)9 GridBagLayout (java.awt.GridBagLayout)8 Insets (java.awt.Insets)8 JButton (javax.swing.JButton)7 ImageIcon (javax.swing.ImageIcon)6 ListSelectionEvent (javax.swing.event.ListSelectionEvent)6 JSplitPane (javax.swing.JSplitPane)5 ListSelectionListener (javax.swing.event.ListSelectionListener)5 FlowLayout (java.awt.FlowLayout)4 Font (java.awt.Font)4 Point (java.awt.Point)4 JList (javax.swing.JList)4 EmptyBorder (javax.swing.border.EmptyBorder)4 AWTException (java.awt.AWTException)3 GridBagConstraints (java.awt.GridBagConstraints)3