use of replete.gui.controls.mnemonics.MButton in project n2a by frothga.
the class ParameterSpecEditDialog method init.
private void init(ParameterSpecification spec) {
setIconImage(ImageUtil.getImage("edit.gif").getImage());
MButton btnChange = new MButton("Ch&ange", ImageUtil.getImage("run.gif"));
btnChange.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String validationMsg = pnlSpecDef.getValidationMsg();
if (validationMsg != null) {
Dialogs.showError(ParameterSpecEditDialog.this, validationMsg);
return;
}
result = CHANGE;
closeDialog();
}
});
MButton btnCancel = new MButton("&Cancel", ImageUtil.getImage("cancel.gif"));
btnCancel.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
closeDialog();
}
});
try {
ParamSpecGlob selected = null;
List<ParamSpecGlob> specChoices = new ArrayList<ParamSpecGlob>();
for (Class<? extends ParameterSpecification> clazz : specPanels.keySet()) {
ParamSpecGlob glob = new ParamSpecGlob(clazz);
specChoices.add(glob);
if (clazz.equals(spec.getClass())) {
selected = glob;
}
}
cboSpecs = new JComboBox(specChoices.toArray());
cboSpecs.setSelectedItem(selected);
cboSpecs.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
ParamSpecGlob glob = (ParamSpecGlob) cboSpecs.getSelectedItem();
change(glob.paramSpecClass);
}
});
} catch (Exception e) {
e.printStackTrace();
}
Lay.BLtg(this, "N", Lay.FL("L", Lay.lb("Specification Type:", "fg=white"), cboSpecs, "mb=[1b,black],bg=5B8FFF"), "C", pnlContainer = Lay.p("eb=10"), "S", Lay.FL("R", btnChange, btnCancel), "size=[400,300],center");
setDefaultButton(btnChange);
origSpec = spec;
change(spec.getClass());
}
Aggregations