cdx.scorebot.util.swing
Class CalendarHourComboBox

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by cdx.scorebot.util.swing.CalendarHourComboBox
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible
Direct Known Subclasses:
CalendarHourComboBoxBound

public class CalendarHourComboBox
extends javax.swing.JPanel

A custom component that mimics a combo box, displaying a perpetual calendar rather than a 'list'.

Author:
Jane Griscti jane@janeg.ca, David Underhill dound07@gmail.com
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
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
protected  javax.swing.JTextField calTxtHour
           
 
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 java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
CalendarHourComboBox()
          Create a new calendar combo-box object set with today's date.
CalendarHourComboBox(java.util.Calendar cal)
          Create a new calendar combo-box object set with the given date.
CalendarHourComboBox(java.util.Calendar cal, int width)
          Create a new calendar combo-box object set with the given date.
CalendarHourComboBox(java.util.Calendar cal, int width, java.text.SimpleDateFormat format)
          Create a new calendar combo-box object set with the given date.
CalendarHourComboBox(java.util.Calendar cal, int width, java.text.SimpleDateFormat format, boolean collapseOnSelection)
          Create a new calendar combo-box object set with the given date.
CalendarHourComboBox(int width)
          Create a new calendar combo-box object set with today's date.
 
Method Summary
 void addCalendarComboBoxListener(CalendarComboBoxListener listener)
          Register a listener for this object
 java.util.Calendar getDate()
           
 java.util.GregorianCalendar getDateGC()
           
 Timestamp getTimestamp()
          Gets the timestamp this holds
 void notifyListenersOfSelectionChange()
          Notifies all listeners that a value selection has been made
 void removeCalendarComboBoxListener(CalendarComboBoxListener listener)
          Remove a registered listener from this object
 void setBackground(java.awt.Color color)
           
 void setDate(java.util.Date newDate)
          Sets the current date and updates the UI to reflect the new date.
 void setDate(java.util.GregorianCalendar newDate)
          Sets the current date and updates the UI to reflect the new date.
 void setEnabled(boolean enabled)
          set whether this component is enabled for user input or not
 void setTimestamp(Timestamp t)
          Sets the timestamp this holds
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
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, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, 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, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
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
 

Field Detail

calTxtHour

protected final javax.swing.JTextField calTxtHour
Constructor Detail

CalendarHourComboBox

public CalendarHourComboBox()
Create a new calendar combo-box object set with today's date.


CalendarHourComboBox

public CalendarHourComboBox(int width)
Create a new calendar combo-box object set with today's date.


CalendarHourComboBox

public CalendarHourComboBox(java.util.Calendar cal)
Create a new calendar combo-box object set with the given date.

Parameters:
cal - a calendar object
See Also:
GregorianCalendar

CalendarHourComboBox

public CalendarHourComboBox(java.util.Calendar cal,
                            int width)
Create a new calendar combo-box object set with the given date.

Parameters:
cal - a calendar object
width - how wide the components are in columns
See Also:
GregorianCalendar

CalendarHourComboBox

public CalendarHourComboBox(java.util.Calendar cal,
                            int width,
                            java.text.SimpleDateFormat format)
Create a new calendar combo-box object set with the given date.

Parameters:
cal - a calendar object
width - how wide the components are in columns
format - how to display the selected date
See Also:
GregorianCalendar

CalendarHourComboBox

public CalendarHourComboBox(java.util.Calendar cal,
                            int width,
                            java.text.SimpleDateFormat format,
                            boolean collapseOnSelection)
Create a new calendar combo-box object set with the given date.

Parameters:
cal - a calendar object
width - how wide the components are in columns
format - how to display the selected date
collapseOnSelection - if true, then when a date is selected by the user the combo box will collapse
See Also:
GregorianCalendar
Method Detail

getTimestamp

public Timestamp getTimestamp()
Gets the timestamp this holds


setTimestamp

public void setTimestamp(Timestamp t)
Sets the timestamp this holds


getDate

public java.util.Calendar getDate()

getDateGC

public java.util.GregorianCalendar getDateGC()

setDate

public void setDate(java.util.Date newDate)
Sets the current date and updates the UI to reflect the new date.

Parameters:
newDate - the new date as a Date object.

setDate

public void setDate(java.util.GregorianCalendar newDate)
Sets the current date and updates the UI to reflect the new date.

Parameters:
newDate - the new date as a GregorianCalendar object.
See Also:
GregorianCalendar

setEnabled

public void setEnabled(boolean enabled)
set whether this component is enabled for user input or not

Overrides:
setEnabled in class javax.swing.JComponent
Parameters:
enabled - true if enabled

addCalendarComboBoxListener

public void addCalendarComboBoxListener(CalendarComboBoxListener listener)
Register a listener for this object

Parameters:
listener - the object which is listening

notifyListenersOfSelectionChange

public void notifyListenersOfSelectionChange()
Notifies all listeners that a value selection has been made


removeCalendarComboBoxListener

public void removeCalendarComboBoxListener(CalendarComboBoxListener listener)
Remove a registered listener from this object

Parameters:
listener - the object which is listening to be removed

setBackground

public void setBackground(java.awt.Color color)
Overrides:
setBackground in class javax.swing.JComponent