use of javax.swing.JCheckBox in project qi4j-sdk by Qi4j.
the class Main method main.
public static void main(String[] args) throws Exception {
SingletonAssembler assembler = new SingletonAssembler() {
public void assemble(ModuleAssembly module) throws AssemblyException {
module.transients(BoundPersonComposite.class);
module.transients(AddressTransient.class);
module.values(CityValue.class, CountryValue.class);
new SwingBindingAssembler().assemble(module);
}
};
module = assembler.module();
Address address1 = createAddress("Vista Damai", "Jalan Tun Razak");
Address address2 = createAddress("Mutiara", "Jalan Ceylon");
TransientBuilder<BoundPersonComposite> builder = module.newTransientBuilder(BoundPersonComposite.class);
PersonComposite prototype = builder.prototype();
prototype.address().set(address1);
prototype.firstName().set("Niclas");
final BoundPersonComposite p1 = builder.newInstance();
prototype.address().set(address2);
prototype.firstName().set("Edward");
final BoundPersonComposite p2 = builder.newInstance();
final StateModel<BoundPersonComposite> model = module.newObject(StateModel.class, BoundPersonComposite.class);
Form form = new Form<BoundPersonComposite>(model);
JFrame frame = new JFrame("testing");
frame.add(form, BorderLayout.CENTER);
JPanel checkBoxPanel = new JPanel();
checkBoxPanel.setFocusable(true);
checkBoxPanel.addFocusListener(new FocusListener() {
public void focusGained(FocusEvent e) {
System.out.println("Gained!");
}
public void focusLost(FocusEvent e) {
System.out.println("LOst!");
}
});
JCheckBox sw = new JCheckBox("Toggle");
sw.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (((JCheckBox) e.getSource()).isSelected()) {
model.use(p1);
System.out.println(p1.firstName().get());
} else {
model.use(p2);
System.out.println(p2.firstName().get());
}
}
});
checkBoxPanel.add(sw);
frame.add(checkBoxPanel, BorderLayout.EAST);
frame.pack();
System.out.println(model);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
use of javax.swing.JCheckBox in project pcgen by PCGen.
the class PCGenFrame method maybeShowWarningConfirm.
@Override
public Boolean maybeShowWarningConfirm(String title, String message, String checkBoxText, final PropertyContext context, final String contextProp) {
if (!context.getBoolean(contextProp, true)) {
return null;
}
final JCheckBox checkBox = new JCheckBox(checkBoxText, true);
checkBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
context.setBoolean(contextProp, checkBox.isSelected());
}
});
JPanel panel = buildMessageLabelPanel(message, checkBox);
int ret = JOptionPane.showConfirmDialog(this, panel, title, JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
return ret == JOptionPane.YES_OPTION;
}
use of javax.swing.JCheckBox in project zaproxy by zaproxy.
the class OptionsScannerPanel method getChkHandleAntiCSRFTokens.
private JCheckBox getChkHandleAntiCSRFTokens() {
if (chkHandleAntiCrsfTokens == null) {
chkHandleAntiCrsfTokens = new JCheckBox();
chkHandleAntiCrsfTokens.setText(Constant.messages.getString("ascan.options.anticsrf.label"));
}
return chkHandleAntiCrsfTokens;
}
use of javax.swing.JCheckBox in project zaproxy by zaproxy.
the class OptionsScannerPanel method getChkInjectPluginIdInHeader.
private JCheckBox getChkInjectPluginIdInHeader() {
if (chkInjectPluginIdInHeader == null) {
chkInjectPluginIdInHeader = new JCheckBox();
chkInjectPluginIdInHeader.setText(Constant.messages.getString("ascan.options.pluginHeader.label"));
}
return chkInjectPluginIdInHeader;
}
use of javax.swing.JCheckBox in project zaproxy by zaproxy.
the class OptionsScannerPanel method getChkPromptInAttackMode.
private JCheckBox getChkPromptInAttackMode() {
if (chkPromptInAttackMode == null) {
chkPromptInAttackMode = new JCheckBox(Constant.messages.getString("ascan.options.attackPrompt.label"));
chkPromptInAttackMode.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
getChkRescanInAttackMode().setEnabled(!chkPromptInAttackMode.isSelected());
}
});
}
return chkPromptInAttackMode;
}
Aggregations