Search in sources :

Example 56 with CardLayout

use of java.awt.CardLayout in project intellij-community by JetBrains.

the class CardLayoutSerializer method readLayout.

void readLayout(Element element, LwContainer container) {
    final int hGap = LwXmlReader.getOptionalInt(element, UIFormXmlConstants.ATTRIBUTE_HGAP, 0);
    final int vGap = LwXmlReader.getOptionalInt(element, UIFormXmlConstants.ATTRIBUTE_VGAP, 0);
    container.setLayout(new CardLayout(hGap, vGap));
    String defaultCard = LwXmlReader.getOptionalString(element, UIFormXmlConstants.ATTRIBUTE_SHOW, null);
    container.putClientProperty(UIFormXmlConstants.LAYOUT_CARD, defaultCard);
}
Also used : CardLayout(java.awt.CardLayout)

Example 57 with CardLayout

use of java.awt.CardLayout in project otapij by FellowTraveler.

the class AddressBookDialog method initValues.

private void initValues() {
    ContactTableModel.removeCols(jTable5);
    switch(mode) {
        case 1:
            {
                jRadioButton1.setSelected(true);
                ((ContactDetailsTableModel) jTable6.getModel()).setColumnNames(new String[] { "Account List" });
                System.out.println("In case1");
            }
            break;
        case 2:
            {
                jRadioButton2.setSelected(true);
                ((ContactDetailsTableModel) jTable6.getModel()).setColumnNames(new String[] { "Nym List" });
            }
            break;
        case 3:
            break;
        default:
            break;
    }
    ((ContactTableModel) jTable5.getModel()).setValue(AddressBookHelper.getContactList());
    jPanel3.setLayout(new CardLayout());
    jPanel3.add(new BlankPanel(), "BlankPanel");
    jPanel3.add(new ContactNymPanel(), "ContactNymPanel");
    jPanel3.add(new ContactAcctPanel(), "ContactAcctPanel");
    jTable6.getSelectionModel().addListSelectionListener(new ListSelectionListener() {

        public void valueChanged(ListSelectionEvent e) {
            if (e.getValueIsAdjusting()) {
                return;
            }
            if (jTable6.getSelectedRow() >= 0) {
                CardLayout cardLayout = (CardLayout) jPanel3.getLayout();
                if (mode == 1) {
                    cardLayout.show(jPanel3, "ContactAcctPanel");
                    contactDetails = AddressBookHelper.getContactDetails(contactID, mode);
                    if (contactDetails != null) {
                        ContactAcctPanel.setValues(jTable6.getSelectedRow(), contactID);
                        ContactAcctPanel.populateDetails(AddressBookHelper.getContactAccDetails(contactDetails.getContact(), jTable6.getSelectedRow()));
                    }
                // Set details panel here
                } else if (mode == 2) {
                    cardLayout.show(jPanel3, "ContactNymPanel");
                    contactDetails = AddressBookHelper.getContactDetails(contactID, mode);
                    if (contactDetails != null) {
                        ContactNymPanel.setValues(jTable6.getSelectedRow(), contactID);
                        ContactNymPanel.populateDetails(AddressBookHelper.getContactNymDetails(contactDetails.getContact(), jTable6.getSelectedRow()));
                    }
                } else {
                    cardLayout.show(jPanel3, "BlankPanel");
                }
            }
        }
    });
    jTable5.getSelectionModel().addListSelectionListener(new ListSelectionListener() {

        public void valueChanged(ListSelectionEvent e) {
            if (e.getValueIsAdjusting()) {
                return;
            }
            if (jTable5.getSelectedRow() >= 0) {
                if (!jRadioButton1.isSelected() && !jRadioButton2.isSelected()) {
                    JOptionPane.showMessageDialog(null, "Please select mode", "Mode Error", JOptionPane.ERROR_MESSAGE);
                    return;
                }
                if (jRadioButton2.isSelected()) {
                    jButton2.setEnabled(false);
                    jButton3.setEnabled(true);
                    ((ContactDetailsTableModel) jTable6.getModel()).setColumnNames(new String[] { "Nym List" });
                    mode = 2;
                } else if (jRadioButton1.isSelected()) {
                    jButton2.setEnabled(true);
                    jButton3.setEnabled(false);
                    ((ContactDetailsTableModel) jTable6.getModel()).setColumnNames(new String[] { "Account List" });
                    mode = 1;
                }
                contactID = (String) jTable5.getModel().getValueAt(jTable5.getSelectedRow(), 1);
                ContactDetails contactDetails = AddressBookHelper.getContactDetails(contactID, mode);
                populateContactDetails(contactDetails, mode);
            }
        }
    });
}
Also used : ContactTableModel(com.moneychanger.ui.model.ContactTableModel) CardLayout(java.awt.CardLayout) ContactNymPanel(com.moneychanger.ui.panels.ContactNymPanel) ContactDetails(com.moneychanger.core.dataobjects.ContactDetails) ListSelectionEvent(javax.swing.event.ListSelectionEvent) BlankPanel(com.moneychanger.ui.panels.BlankPanel) ContactAcctPanel(com.moneychanger.ui.panels.ContactAcctPanel) ListSelectionListener(javax.swing.event.ListSelectionListener) ContactDetailsTableModel(com.moneychanger.ui.model.ContactDetailsTableModel)

Example 58 with CardLayout

use of java.awt.CardLayout in project otapij by FellowTraveler.

the class MainPage method jButton21ActionPerformed.

//GEN-LAST:event_jButton20ActionPerformed
private void jButton21ActionPerformed(java.awt.event.ActionEvent evt) {
    //GEN-FIRST:event_jButton21ActionPerformed
    try {
        if (jTable4.getSelectedRow() < 0) {
            JOptionPane.showMessageDialog(this, "Please select server to delete", "Error", JOptionPane.ERROR_MESSAGE);
            return;
        }
        int userSelection = JOptionPane.showConfirmDialog(this, "Deleting server will remove all accounts associated with server.\nAre you sure you want to delete server", "Warning", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
        System.out.println("userSelection:" + userSelection);
        if (userSelection == 0) {
            boolean status = StorageHelper.removeOtherTabServer((String) jTable4.getModel().getValueAt(jTable4.getSelectedRow(), 2), (String) jTable4.getModel().getValueAt(jTable4.getSelectedRow(), 1));
            if (status) {
                JOptionPane.showMessageDialog(null, "Server deleted successfully", "Server Delete Success", JOptionPane.INFORMATION_MESSAGE);
                loadOtherTabServers();
                ((OtherTabAccountModel) jTable3.getModel()).clearValue();
                CardLayout topLayout = (CardLayout) (jPanel27.getLayout());
                CardLayout bottomlayout = (CardLayout) (jPanel28.getLayout());
                topLayout.show(jPanel27, "BlankTop");
                bottomlayout.show(jPanel28, "BlankBottom");
            } else {
                JOptionPane.showMessageDialog(null, "Server could not be deleted because of storage failure", "Error", JOptionPane.ERROR_MESSAGE);
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : CardLayout(java.awt.CardLayout) OtherTabAccountModel(com.moneychanger.ui.model.OtherTabAccountModel) Point(java.awt.Point) AWTException(java.awt.AWTException)

Example 59 with CardLayout

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

the class BreakpointsPanel method initialize.

private void initialize() {
    this.setLayout(new CardLayout());
    this.setSize(474, 251);
    this.setName(Constant.messages.getString("brk.panel.title"));
    // 'red X' icon
    this.setIcon(new ImageIcon(BreakpointsPanel.class.getResource("/resource/icon/16/101.png")));
    this.setDefaultAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_B, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask() | Event.ALT_MASK | Event.SHIFT_MASK, false));
    this.setMnemonic(Constant.messages.getChar("brk.panel.mnemonic"));
    this.add(getPanelCommand(), getPanelCommand().getName());
}
Also used : CardLayout(java.awt.CardLayout) ImageIcon(javax.swing.ImageIcon)

Example 60 with CardLayout

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

the class LicenseFrame method getJPanel1.

/**
	 * This method initializes jPanel1
	 *
	 * @return javax.swing.JPanel
	 */
private JPanel getJPanel1() {
    if (jPanel1 == null) {
        jPanel1 = new JPanel();
        jPanel1.setLayout(new CardLayout());
        jPanel1.add(getJScrollPane(), getJScrollPane().getName());
    }
    return jPanel1;
}
Also used : JPanel(javax.swing.JPanel) CardLayout(java.awt.CardLayout)

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