public class Navigable_date_selector extends javax.swing.JPanel implements Date_selector, java.awt.event.ActionListener
Date_selector
that adds a navigation bar to manipulate the wrapped selector. See
Date_selector_panel
for a description and picture of date selectors.
The navigation-bar arrows in the current implementation are images loaded as a "resource" from the CLASSPATH. Four files are used:
$CLASSPATH/images/10px.red.arrow.right.double.gifwhere $CLASSPATH is any directory on your CLASSPATH. If the
$CLASSPATH/images/10px.red.arrow.left.double.gif
$CLASSPATH/images/10px.red.arrow.right.gif
$CLASSPATH/images/10px.red.arrow.left.gif
Date_selector_panel
can't find the image file, it uses character representations (
">"
, ">>"
, "<"
, "<<"
). The main problem with
this approach is that you can't change the color of the arrows without changing the image files. On the plus side,
arbitrary images can be used for the movement icons. Future versions of this class will provide some way for you to
specify that the arrows be rendered internally in colors that you specify at run time.javax.swing.JPanel.AccessibleJPanel
javax.swing.JComponent.AccessibleJComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
CHANGE_ACTION, COMMIT_ACTION, SELECT_ACTION
Constructor and Description |
---|
Navigable_date_selector()
Convenience constructor.
|
Navigable_date_selector(Date_selector selector)
Wrap an existing Date_selector to add a a navigation bar modifies the wrapped Date_selector.
|
Navigable_date_selector(Date_selector selector,
java.awt.Color background_color)
Create a navigable date selector by wrapping the indicated one.
|
Navigable_date_selector(Date_selector selector,
java.lang.String okayText) |
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent e) |
void |
addActionListener(java.awt.event.ActionListener l) |
void |
change_navigation_bar_color(java.awt.Color background_color) |
java.util.Date |
get_current_date() |
java.util.Date |
get_selected_date() |
int |
get(int f)
Must work just like
Calendar.get(int) |
javax.swing.JComponent |
getComponent() |
boolean |
isShowNavigationButtons() |
boolean |
isShowOkButton() |
void |
removeActionListener(java.awt.event.ActionListener l) |
void |
roll(int f,
boolean up)
Must work just like
Calendar.roll(int,boolean) |
void |
set_selected_date(java.util.Date d) |
void |
setEnabled(boolean b) |
void |
setFont(java.awt.Font font) |
void |
setForeground(java.awt.Color fg) |
void |
setOKText(java.lang.String okay) |
void |
setShowNavigationButtons(boolean showNavButtons) |
void |
setShowOkButton(boolean showOkButton) |
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, 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, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, 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, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
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, transferFocusDownCycle, validate, validateTree
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, 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, transferFocusBackward, transferFocusUpCycle
public Navigable_date_selector(Date_selector selector)
public Navigable_date_selector(Date_selector selector, java.lang.String okayText)
public Navigable_date_selector(Date_selector selector, java.awt.Color background_color)
selector
- the raw date selector to wrap;background_color
- the background color of the navigation bar (or null for transparent). The default color is
com.holub.ui.Colors#LIGHT_YELLOW
.JComponent.setBackground(java.awt.Color)
public Navigable_date_selector()
Date_selector_panel
using the no-arg constructor.public void setFont(java.awt.Font font)
setFont
in class javax.swing.JComponent
public void setForeground(java.awt.Color fg)
setForeground
in class javax.swing.JComponent
public void setEnabled(boolean b)
setEnabled
in class javax.swing.JComponent
public void change_navigation_bar_color(java.awt.Color background_color)
public void addActionListener(java.awt.event.ActionListener l)
addActionListener
in interface Date_selector
public void removeActionListener(java.awt.event.ActionListener l)
removeActionListener
in interface Date_selector
public java.util.Date get_selected_date()
get_selected_date
in interface Date_selector
public java.util.Date get_current_date()
get_current_date
in interface Date_selector
public void set_selected_date(java.util.Date d)
set_selected_date
in interface Date_selector
public void roll(int f, boolean up)
Date_selector
Calendar.roll(int,boolean)
roll
in interface Date_selector
public int get(int f)
Date_selector
Calendar.get(int)
get
in interface Date_selector
public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed
in interface java.awt.event.ActionListener
e
- ActionListener.actionPerformed(java.awt.event.ActionEvent)
public javax.swing.JComponent getComponent()
getComponent
in interface Date_selector
public boolean isShowOkButton()
public void setShowOkButton(boolean showOkButton)
public boolean isShowNavigationButtons()
public void setShowNavigationButtons(boolean showNavButtons)
public void setOKText(java.lang.String okay)