/**
* Adds a ComboBox to select a boolean property
* @param text text to be shown on a label
* @param property property to be changed in Defaults
* @param cont container where input field must be added
*/
protected void addBooleanComboBox(String text, final String property, Container cont) {
JLabel label = new JLabel(text + ":");
JComboBox combo = new JComboBox(new Object[] { Boolean.TRUE.toString(), Boolean.FALSE.toString() });
combo.setName(property);
label.setLabelFor(combo);
combo.setSelectedItem(Defaults.get(property));
// Sets maximum size to minimal one, otherwise springLayout will stretch this
combo.setMaximumSize(new Dimension(combo.getMaximumSize().width, combo.getMinimumSize().height));
combo.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
Defaults.set(property, (String) e.getItem());
}
});
cont.add(label);
cont.add(combo);
}
DefaultsEditor.java 文件源码
java
阅读 46
收藏 0
点赞 0
评论 0
项目:jmt
作者:
评论列表
文章目录