public class PreferencesSheet extends Object
Modifier and Type | Field and Description |
---|---|
protected PreferencesEditor |
editor
PreferencesEditor hosting this sheet.
|
protected boolean |
filled
Field private to the PreferencesEditor hosting this sheet.
|
protected String |
label
Caption of this sheet used by the
PreferencesEditor . |
protected String |
name
ID of this sheet.
|
protected PreferencesSheetPane |
pane
Panel implementing the GUI of this sheet.
|
Modifier | Constructor and Description |
---|---|
protected |
PreferencesSheet()
Constructs a preferences sheet nothaving an ID
and a caption.
|
|
PreferencesSheet(String name,
String label)
Constructs a preferences sheet having specified ID and caption.
|
Modifier and Type | Method and Description |
---|---|
void |
applyPreferences(Preferences prefs)
``Applies'' the preferences found in specified object which are
relevant to this sheet.
|
protected void |
badField(JTextField field)
Validation helper: beeps, move keyboard focus to specified text field
and selects all text contained in this field.
|
protected void |
badText(JTextArea text)
Validation helper: beeps, move keyboard focus to specified text area
and selects all text contained in this area.
|
protected double |
checkDoubleField(JTextField field,
double min,
double max,
double invalid)
Validation helper: checks that specified field contains a valid double.
|
protected int |
checkIntField(JTextField field,
int min,
int max,
int invalid)
Validation helper: checks that specified field contains a valid
integer.
|
protected PreferencesSheetPane |
createPane()
Creates and returns the panel implementing the GUI of this sheet.
|
void |
fillPane(Preferences prefs)
Fills
pane using preferences found in specified object. |
void |
focusPane()
Requests focus for the first component contained in
pane . |
String |
getLabel()
Returns the caption of this sheet.
|
String |
getName()
Returns the unique ID of this sheet.
|
PreferencesSheetPane |
getPane()
Returns the panel implementing the GUI of this sheet.
|
protected void |
selectPane()
Validation helper: tells #preferencesEditor to display this sheet,
unless this is already the case.
|
void |
setLabel(String label)
Changes the caption of this sheet to specified value.
|
String |
toString()
Returns the caption of this sheet.
|
boolean |
validatePane(Preferences prefs)
Validates preferences specified by the user using
pane and
updates specified object to reflect the changes made by the user. |
protected String name
protected String label
PreferencesEditor
.protected PreferencesEditor editor
protected boolean filled
protected PreferencesSheetPane pane
public PreferencesSheet(String name, String label)
protected PreferencesSheet()
public String getName()
public void setLabel(String label)
public String getLabel()
public String toString()
getLabel()
.public PreferencesSheetPane getPane()
createPane()
if needed to.protected PreferencesSheetPane createPane()
public void focusPane()
pane
.
Default implementation does nothing at all.public void fillPane(Preferences prefs)
pane
using preferences found in specified object.public boolean validatePane(Preferences prefs)
pane
and
updates specified object to reflect the changes made by the user.prefs
- object updated to reflect the changes made by the usertrue
if preferences specified by the user
are valid; false
otherwise.public void applyPreferences(Preferences prefs)
protected int checkIntField(JTextField field, int min, int max, int invalid)
badField(JTextField)
is used to report the error.field
- text field containing the value to be checkedmin
- smallest valid value (inclusive)max
- largest valid value (inclusive)invalid
- value returned by this function when the content of
specified text field is found to be invalidprotected double checkDoubleField(JTextField field, double min, double max, double invalid)
badField(JTextField)
is used to report the error.field
- text field containing the value to be checkedmin
- smallest valid value (inclusive)max
- largest valid value (inclusive)invalid
- value returned by this function when the content of
specified text field is found to be invalidprotected void badField(JTextField field)
protected void badText(JTextArea text)
protected void selectPane()