|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent com.cosylab.gui.components.SimpleDateSelector
public class SimpleDateSelector
This class provides user-friendly entry of dates. The component consists of three combo boxes containing year, month and day values. All values are validated and always display a valid date. This is then provided by getDate and setDate methods. User can listen to PropertyChangeEvent to get notifications when a date was changed When setting or getting the date from or to java.util.Date class, only YEAR, MONTH and DAY_OF_MONTH properties are set.
GregorianCalendar class is used to calculate the
dates. Since only the number of years is unlimited, it is set to 20 by
default, allowing years 2000 through 2019 inclusively to be chosen.
This can, however, be modified.
,
Serialized FormNested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
javax.swing.JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
java.awt.Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary |
---|
Fields inherited from class javax.swing.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 java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface com.cosylab.gui.property.editors.PropertyEditor |
---|
PROPERTY_VALUE_NAME |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
SimpleDateSelector()
Default constructor for SimpleDateSelector. |
|
SimpleDateSelector(java.util.Date date)
Constructor for SimpleDateSelector. |
|
SimpleDateSelector(java.util.Date date,
int fromYear,
int yearRange)
Constructor for SimpleDateSelector. |
|
SimpleDateSelector(int fromYear,
int yearRange)
Constructor for SimpleDateSelector. |
|
SimpleDateSelector(int day,
int month,
int year)
Constructor for SimpleDateSelector. |
|
SimpleDateSelector(int day,
int month,
int year,
int fromYear,
int yearRange)
Constructor for SimpleDateSelector. |
Method Summary | |
---|---|
java.util.Date |
getDate()
Returns the currently selected date as java.util.Date. |
int |
getDay()
Returns number of the selected day in current month, starting with 1. |
java.lang.String |
getDescription()
Returns the description for this editor. |
int |
getMonth()
Returns the index of the currently selected month starting with 1. |
int |
getNumberOfYears()
Returns the number of year to display in the year selector. |
java.lang.Object |
getPropertyValue()
Returns the value contained in this editor. |
int |
getStartingYear()
Returns the starting year to display in the year selector. |
int |
getYear()
Returns the currently selected year. |
static void |
main(java.lang.String[] args)
Run test applet. |
void |
setCompactView(boolean compact)
|
void |
setDate(java.util.Date date)
Sets the date to display. |
void |
setDay(int day)
Sets the day to the specified index. |
void |
setDescription(java.lang.String description)
|
void |
setEnabled(boolean how)
Sets the enabled state of this component. |
void |
setLabelsVisible(boolean visible)
Shows / hides the Year/Month/Day labels |
void |
setMonth(int month)
Sets the currently selected month. |
void |
setNumberOfYears(int range)
Sets the number of years to display in the year selector. |
boolean |
setPropertyValue(java.lang.Object value)
PropertyEditor should set the value specified and display it accordingly. |
void |
setStartingYear(int from)
Sets the starting year to be displayed in the year selector. |
void |
setYear(int year)
Sets the currently selected year. |
void |
setYearRange(int from,
int range)
Sets new available year range. |
Methods inherited from class javax.swing.JComponent |
---|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI |
Methods inherited from class java.awt.Container |
---|
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
Methods inherited from class java.awt.Component |
---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.cosylab.gui.property.editors.PropertyEditor |
---|
addPropertyChangeListener, removePropertyChangeListener |
Constructor Detail |
---|
public SimpleDateSelector()
public SimpleDateSelector(java.util.Date date)
date
- Date Initial date to set.public SimpleDateSelector(java.util.Date date, int fromYear, int yearRange)
date
- Date Initial date to set.fromYear
- int Initial starting year.yearRange
- int Number of years to allow.public SimpleDateSelector(int fromYear, int yearRange)
fromYear
- int Initial starting year.yearRange
- int Number of years to allow.public SimpleDateSelector(int day, int month, int year)
day
- intmonth
- intyear
- intpublic SimpleDateSelector(int day, int month, int year, int fromYear, int yearRange)
day
- intmonth
- intyear
- intfromYear
- intyearRange
- intMethod Detail |
---|
public java.util.Date getDate()
public int getDay()
public int getMonth()
public int getYear()
public int getNumberOfYears()
public int getStartingYear()
public void setDate(java.util.Date date)
date
- java.util.Datepublic void setDay(int day)
java.util.Calendar
class, first day of month is specified
as 1. If the day set is outside allowed range, the value will be set to
the nearest allowed value.
day
- intpublic void setLabelsVisible(boolean visible)
visible
- the visibility valuepublic void setMonth(int month)
month
- intpublic void setYear(int year)
year
- intpublic void setEnabled(boolean how)
setEnabled
in class javax.swing.JComponent
how
- booleanpublic void setStartingYear(int from)
from
- intpublic void setNumberOfYears(int range)
range
- intpublic void setYearRange(int from, int range)
from
- intrange
- intpublic java.lang.Object getPropertyValue()
PropertyEditor
getPropertyValue
in interface PropertyEditor
public boolean setPropertyValue(java.lang.Object value)
PropertyEditor
setPropertyValue
in interface PropertyEditor
value
- Value to set
public java.lang.String getDescription()
PropertyEditor
If editor is unable to display the description, it must return null. This will allow for automatic creation of description and properly wrap the methods. If editor can display description but its value has not yet been defined, this method should return empty string.
getDescription
in interface PropertyEditor
public void setDescription(java.lang.String description)
setDescription
in interface PropertyEditor
public void setCompactView(boolean compact)
public static void main(java.lang.String[] args)
args
- command line parameters
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |