Inline variable and allow disabling/enabling the config button
This commit is contained in:
parent
a39acf3a22
commit
da2b3ff633
@ -291,7 +291,7 @@ public class ArrayEditor extends JPanel implements PropertyEditor {
|
||||
((GenericObjectEditor) e).setClassType(valueClass);
|
||||
}
|
||||
e.setValue(value);
|
||||
JPanel cellPanel = new JPanel() {
|
||||
return new JPanel() {
|
||||
|
||||
@Override
|
||||
public void paintComponent(Graphics g) {
|
||||
@ -315,7 +315,6 @@ public class ArrayEditor extends JPanel implements PropertyEditor {
|
||||
return newPref;
|
||||
}
|
||||
};
|
||||
return cellPanel;
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ public class ObjectArrayEditor<T> extends JPanel implements PropertyEditor {
|
||||
private JList<T> objectList;
|
||||
private DefaultListModel<T> listModel;
|
||||
private PropertyChangeSupport propChangeSupport;
|
||||
private JButton configButton;
|
||||
|
||||
public ObjectArrayEditor(Class<T> type) {
|
||||
listModel = new DefaultListModel<>();
|
||||
@ -53,7 +54,6 @@ public class ObjectArrayEditor<T> extends JPanel implements PropertyEditor {
|
||||
c.weighty = 0.0;
|
||||
add(removeButton, c);
|
||||
|
||||
JButton configButton;
|
||||
configButton = new JButton("Config");
|
||||
c.gridx = 2;
|
||||
c.gridy = 2;
|
||||
@ -129,11 +129,8 @@ public class ObjectArrayEditor<T> extends JPanel implements PropertyEditor {
|
||||
public Object getValue() {
|
||||
if (listModel == null) {
|
||||
return null;
|
||||
}
|
||||
if (true == false) {
|
||||
return true;
|
||||
} else {
|
||||
// Convert the listmodel to an array of strings and return it.
|
||||
// Convert the listmodel to an array of T and return it.
|
||||
int length = listModel.getSize();
|
||||
Object result = Array.newInstance(value.getClass().getComponentType(), length);
|
||||
for (int i = 0; i < length; i++) {
|
||||
@ -210,4 +207,8 @@ public class ObjectArrayEditor<T> extends JPanel implements PropertyEditor {
|
||||
}
|
||||
propChangeSupport.removePropertyChangeListener(l);
|
||||
}
|
||||
|
||||
public void toggleConfigButton() {
|
||||
this.configButton.setEnabled(!configButton.isEnabled());
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user