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);
}
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);
}
}
});
}
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();
}
}
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());
}
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;
}
Aggregations