|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectComponent
Container
JComponent
FormatChooser
public class FormatChooser
Selects the pattern to use for formating numbers, angles or dates.
This widget can be used with one of Format objects working with pattern, like
DecimalFormat, SimpleDateFormat or AngleFormat.
| display/geotk-widgets-swing (download) | View source code for this class |
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class JComponent |
|---|
JComponent.AccessibleJComponent |
| Nested classes/interfaces inherited from class Container |
|---|
Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class Component |
|---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary | |
|---|---|
protected Format |
format
The format to configure by this FormatChooser. |
| Fields inherited from class JComponent |
|---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class Component |
|---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
FormatChooser(Format format)
Constructs a pattern chooser for the given format. |
|
| Method Summary | |
|---|---|
void |
commitEdit()
Forces the current value to be taken from the editable fields and set them as the current values. |
Format |
getFormat()
Returns the current format. |
String |
getPattern()
Returns the localized pattern for the current format. |
Object |
getSampleValue()
Returns the sample value to format as a "preview" text. |
void |
setFormat(Format format)
Sets the format to configure. |
void |
setPattern(String pattern)
Sets the localized pattern for the current format. |
void |
setSampleValue(Object value)
Sets the sample value to format as a "preview" text. |
boolean |
showDialog(Component owner,
String title)
Shows a dialog box requesting input from the user. |
| Methods inherited from class Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected Format format
FormatChooser.
| Constructor Detail |
|---|
public FormatChooser(Format format)
throws IllegalArgumentException
format - The format to configure. The default implementation accepts instance of
DecimalFormat, SimpleDateFormat or AngleFormat.
IllegalArgumentException - if the format is invalid.| Method Detail |
|---|
public Format getFormat()
public void setFormat(Format format)
throws IllegalArgumentException
DecimalFormat, SimpleDateFormat or AngleFormat. If
more format classes are wanted, then the methods getPattern() and
setPattern(java.lang.String) need to be overridden.
format - The format to congifure.
IllegalArgumentException - if the format is invalid.public Object getSampleValue()
null.
public void setSampleValue(Object value)
throws IllegalArgumentException
getFormat().
value - The value to format in previews, or null.
IllegalArgumentException - if the value can't be formatted.
public String getPattern()
throws IllegalStateException
DecimalFormat, SimpleDateFormat
and AngleFormat instances.
IllegalStateException - is the current format is not one of recognized type.
public void setPattern(String pattern)
throws IllegalStateException,
IllegalArgumentException
DecimalFormat, SimpleDateFormat
and AngleFormat instances.
pattern - The pattern for the current format.
IllegalStateException - is the current format is not one of recognized type.
IllegalArgumentException - if the specified pattern is invalid.
public void commitEdit()
throws ParseException
This method is typically invoked after Dialog.showDialog(Component, String)
returned true and before to read the values from the dialog widget.
commitEdit in interface DialogParseException - If at least one values couldn't be commited.JFormattedTextField.commitEdit(),
JSpinner.commitEdit()
public boolean showDialog(Component owner,
String title)
owner. If owner is contained into a JDesktopPane,
the dialog box will appears as an internal frame.
Multi-threading
Geotk implementations allow this method to be invoked from any thread. If the caller
thread is not the Swing thread, then the execution of this method will be
registered in the AWT Event Queue and the caller thread will block until completion.
showDialog in interface Dialogowner - The parent component for the dialog box, or null if there is no parent.title - The dialog box title.
true if user pressed the "Ok" button, or false otherwise
(e.g. pressing "Cancel" or closing the dialog box from the title bar).
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||