public class GUIPropertyInteger
extends java.lang.Object
implements javax.swing.event.ChangeListener
notification target
may be specified in order to be informed as soon as the
value has been changed.
JPanel testPanel = new Panel(); // create parent panel
testPanel.setLayout(new BoxLayout(testPanel, BoxLayout.PAGE_AXIS));
GUIPropertyInteger age = new GUIPropertyInteger("Age", 0, 0, 100);
testPanel.add(age.getPropertyPanel()); // add one property
GUIPropertyInteger height = new GUIPropertyInteger("Height", "Height in cm", 0, 50, 250);
testPanel.add(height.getPropertyPanel()); // add another property
return testPanel;
getValue
,
getPropertyPanel
Modifier and Type | Field and Description |
---|---|
protected boolean |
myEditable |
protected int |
myWidth |
Constructor and Description |
---|
GUIPropertyInteger(java.lang.String name,
int defaultValue,
int minValue,
int maxValue)
Creates an integer property without a discription and notification.
|
GUIPropertyInteger(java.lang.String name,
int defaultValue,
int minValue,
int maxValue,
GuiNotificationTarget target)
Creates an integer property without a discription.
|
GUIPropertyInteger(java.lang.String name,
java.lang.String description,
int defaultValue,
GuiNotificationTarget target,
int width,
boolean editable)
Creates an integer property without a minimal and minimal value.
|
GUIPropertyInteger(java.lang.String name,
java.lang.String description,
int defaultValue,
int minValue,
int maxValue)
Creates an integer property without notification.
|
GUIPropertyInteger(java.lang.String name,
java.lang.String description,
int defaultValue,
int minValue,
int maxValue,
GuiNotificationTarget target,
int width,
boolean editable)
Creates an integer property.
|
Modifier and Type | Method and Description |
---|---|
void |
disable()
Prevents that this property may be manipulated via the GUI panel.
|
void |
enable()
Re-activates the possibility to manipulate this property via the GUI
panel.
|
javax.swing.JPanel |
getPropertyPanel()
Creates GUI panel containg this property, ready to display in some
settings dialog.
|
int |
getValue()
The method to be invoked when the value of this property is to be used.
|
boolean |
isEnabled()
Checks whether the spinner is currently enabled or disabled.
|
void |
setValue(int value)
Sets the value of this property
|
void |
stateChanged(javax.swing.event.ChangeEvent e)
The method automatically invoked when changing the spinner status.
|
public GUIPropertyInteger(java.lang.String name, int defaultValue, int minValue, int maxValue)
name
- the name of this propertydefaultValue
- the default value of this propertyminValue
- the minimal value that can be assigned to this propertymaxValue
- the maximal value that can be assigned to this propertypublic GUIPropertyInteger(java.lang.String name, java.lang.String description, int defaultValue, int minValue, int maxValue)
name
- the name of this propertydescription
- of this property (to be displayed as a tool tip)defaultValue
- the default value of this propertyminValue
- the minimal value that can be assigned to this propertymaxValue
- the maximal value that can be assigned to this propertypublic GUIPropertyInteger(java.lang.String name, int defaultValue, int minValue, int maxValue, GuiNotificationTarget target)
name
- the name of this propertydefaultValue
- the default value of this propertyminValue
- the minimal value that can be assigned to this propertymaxValue
- the maximal value that can be assigned to this propertytarget
- the object to be notified as soon the state of this property
changespublic GUIPropertyInteger(java.lang.String name, java.lang.String description, int defaultValue, int minValue, int maxValue, GuiNotificationTarget target, int width, boolean editable)
name
- the name of this propertydescription
- of this property (to be displayed as a tool tip)defaultValue
- the default value of this propertyminValue
- the minimal value that can be assigned to this propertymaxValue
- the maximal value that can be assigned to this propertytarget
- the object to be notified as soon the state of this property
changespublic GUIPropertyInteger(java.lang.String name, java.lang.String description, int defaultValue, GuiNotificationTarget target, int width, boolean editable)
name
- the name of this propertydescription
- of this property (to be displayed as a tool tip)defaultValue
- the default value of this propertytarget
- the object to be notified as soon the state of this property
changespublic void stateChanged(javax.swing.event.ChangeEvent e)
stateChanged
in interface javax.swing.event.ChangeListener
e
- The passed change event (not used).public int getValue()
public boolean isEnabled()
true
if is enabled, false
otherwisepublic void disable()
enable()
public void enable()
disable()
public void setValue(int value)
value
- doublepublic javax.swing.JPanel getPropertyPanel()