use of javax.swing.JCheckBox in project zaproxy by zaproxy.
the class StandardFieldsDialog method addCheckBoxField.
public void addCheckBoxField(int tabIndex, String fieldLabel, boolean value) {
if (!isTabbed()) {
throw new IllegalArgumentException("Not initialised as a tabbed dialog - must use method without tab parameters");
}
if (tabIndex < 0 || tabIndex >= this.tabPanels.size()) {
throw new IllegalArgumentException("Invalid tab index: " + tabIndex);
}
JCheckBox field = new JCheckBox();
field.setSelected(value);
this.addField(this.tabPanels.get(tabIndex), this.tabOffsets.get(tabIndex), fieldLabel, field, field, 0.0D);
this.incTabOffset(tabIndex);
}
use of javax.swing.JCheckBox in project zaproxy by zaproxy.
the class OptionsStatsPanel method getInMemoryStatsEnabledField.
private JCheckBox getInMemoryStatsEnabledField() {
if (inMemoryStatsEnabledField == null) {
inMemoryStatsEnabledField = new JCheckBox();
inMemoryStatsEnabledField.setText(Constant.messages.getString("stats.options.mem.enabled"));
inMemoryStatsEnabledField.setVerticalAlignment(javax.swing.SwingConstants.TOP);
inMemoryStatsEnabledField.setVerticalTextPosition(javax.swing.SwingConstants.TOP);
}
return inMemoryStatsEnabledField;
}
use of javax.swing.JCheckBox in project nhin-d by DirectProject.
the class CAPanel method initUI.
protected void initUI() {
setLayout(new BorderLayout());
//setBorder(new SoftBevelBorder(BevelBorder.LOWERED));
setBorder(new CompoundBorder(new SoftBevelBorder(BevelBorder.LOWERED), new EmptyBorder(5, 5, 5, 5)));
createCA = new JRadioButton("Create New CA");
loadCA = new JRadioButton("Load CA");
ButtonGroup group = new ButtonGroup();
group.add(createCA);
group.add(loadCA);
createCA.setSelected(true);
JPanel radioPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
radioPanel.add(createCA);
radioPanel.add(loadCA);
JPanel fieldsPanel = new JPanel();
fieldsPanel.setLayout(new GridLayout(3, 3, 10, 10));
cnField = new TextEntryField("CN:");
fieldsPanel.add(cnField);
countryField = new TextEntryField("Country:");
fieldsPanel.add(countryField);
stateField = new TextEntryField("State:");
fieldsPanel.add(stateField);
locField = new TextEntryField("Location:");
fieldsPanel.add(locField);
orgField = new TextEntryField("Org:");
fieldsPanel.add(orgField);
emailField = new TextEntryField("Email:");
fieldsPanel.add(emailField);
expField = new SpinEntryField("Experiation (Days):", 365);
fieldsPanel.add(expField);
keyStr = new DropDownEntry("Key Strength:", new Object[] { 1024, 2048, 4096 });
fieldsPanel.add(keyStr);
passField = new PasswordField("Password:");
fieldsPanel.add(passField);
JPanel topPanel = new JPanel(new BorderLayout());
topPanel.add(radioPanel, BorderLayout.NORTH);
topPanel.add(fieldsPanel, BorderLayout.CENTER);
add(topPanel, BorderLayout.NORTH);
new FlowLayout(FlowLayout.LEFT);
certFileField = new FileField("Certificate Authority File:", "");
keyFileField = new FileField("Private Key File:", "");
JPanel filePanel = new JPanel(new GridLayout(1, 2));
filePanel.add(certFileField);
filePanel.add(keyFileField);
loadCert = new JButton("Load");
loadCert.setVisible(false);
createCert = new JButton("Create");
clear = new JButton("Clear");
clear.setVisible(false);
clear = new JButton("Clear");
genCert = new JButton("Create Leaf Cert");
genCert.setVisible(false);
signCSR = new JButton("Sign CSR");
signCSR.setVisible(false);
addToAltSubjects = new JCheckBox("Add Email To Alt Subject Names");
addToAltSubjects.setVisible(false);
addToAltSubjects.setSelected(true);
allowedToSign = new JCheckBox("Allowed To Sign Certificates");
allowedToSign.setVisible(false);
keyEnc = new JCheckBox("Key Encipherment Use");
keyEnc.setVisible(false);
keyEnc.setSelected(true);
digitalSig = new JCheckBox("Digital Signature Use");
digitalSig.setVisible(false);
keyEnc.setSelected(true);
JPanel addAltPanel = new JPanel(new GridLayout(2, 2));
addAltPanel.setPreferredSize(new Dimension(450, addAltPanel.getPreferredSize().height));
//addAltPanel.add(addToAltSubjects);
addAltPanel.add(allowedToSign);
addAltPanel.add(keyEnc);
addAltPanel.add(digitalSig);
JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
buttonPanel.add(addAltPanel);
buttonPanel.add(loadCert);
buttonPanel.add(createCert);
buttonPanel.add(clear);
buttonPanel.add(genCert);
buttonPanel.add(signCSR);
JPanel combineAltAndButtonPanel = new JPanel(new BorderLayout());
//combineAltAndButtonPanel.add(addAltPanel, BorderLayout.WEST);
combineAltAndButtonPanel.add(buttonPanel, BorderLayout.EAST);
JPanel bottomPannel = new JPanel(new BorderLayout());
bottomPannel.add(filePanel, BorderLayout.NORTH);
bottomPannel.add(combineAltAndButtonPanel, BorderLayout.SOUTH);
this.add(bottomPannel, BorderLayout.SOUTH);
}
use of javax.swing.JCheckBox in project jdk8u_jdk by JetBrains.
the class WrongKeyTypedConsumedTest method start.
public void start() {
setSize(200, 200);
setVisible(true);
validate();
JFrame frame = new JFrame("The Frame");
Set ftk = new HashSet();
ftk.add(AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_DOWN, 0));
frame.getContentPane().setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, ftk);
JCheckBox checkbox = new JCheckBox("test");
frame.getContentPane().add(checkbox, BorderLayout.NORTH);
JTextArea textarea = new JTextArea(40, 10);
frame.getContentPane().add(textarea);
frame.pack();
frame.setVisible(true);
Util.waitForIdle(robot);
if (!frame.isActive()) {
throw new RuntimeException("Test Fialed: frame isn't active");
}
// verify if checkbox has focus
if (!checkbox.isFocusOwner()) {
checkbox.requestFocusInWindow();
Util.waitForIdle(robot);
if (!checkbox.isFocusOwner()) {
throw new RuntimeException("Test Failed: checkbox doesn't have focus");
}
}
// press VK_DOWN
robot.keyPress(KeyEvent.VK_DOWN);
robot.delay(50);
robot.keyRelease(KeyEvent.VK_DOWN);
robot.delay(50);
Util.waitForIdle(robot);
// verify if text area has focus
if (!textarea.isFocusOwner()) {
throw new RuntimeException("Test Failed: focus wasn't transfered to text area");
}
// press '1'
robot.keyPress(KeyEvent.VK_1);
robot.delay(50);
robot.keyRelease(KeyEvent.VK_1);
robot.delay(50);
Util.waitForIdle(robot);
// verify if KEY_TYPED arrived
if (!"1".equals(textarea.getText())) {
throw new RuntimeException("Test Failed: text area text is \"" + textarea.getText() + "\", not \"1\"");
}
System.out.println("Test Passed");
}
use of javax.swing.JCheckBox in project jdk8u_jdk by JetBrains.
the class bug8032667 method getCheckBox.
static JCheckBox getCheckBox(String text, boolean selected) {
JCheckBox checkBox = new JCheckBox(text);
checkBox.setSelected(selected);
checkBox.setSize(new Dimension(width, height));
return checkBox;
}
Aggregations