JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.util.calendar
Class MonthTable

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JTable
                          |
                          +--com.klg.jclass.util.calendar.MonthTable
All Implemented Interfaces:
Accessible, CalendarComponent, CellEditorListener, EventListener, ImageObserver, ListSelectionListener, MenuContainer, MouseListener, Scrollable, Serializable, TableColumnModelListener, TableModelListener

public class MonthTable
extends JTable
implements CalendarComponent, MouseListener

MonthTable is used to display a Table of selectable months for use with a calendar.

See Also:
Serialized Form

Nested Class Summary
protected  class MonthTable.MonthModel
          Build data model wrapper around DateSymbols that builds a 2x6 table of the months for picking.
protected  class MonthTable.Renderer
          Use a table cell renderer to draw current month in reverse video.
 
Nested classes inherited from class javax.swing.JTable
JTable.AccessibleJTable
 
Nested classes inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected  com.klg.jclass.util.JCListenerList actionListeners
           
protected  com.klg.jclass.util.value.JCValueModel calendarModel
           
protected  Locale locale
           
protected  MonthTable.MonthModel monthModel
           
protected  String[] months
           
protected  int selectedMonth
           
protected  int tableCellWidth
           
protected  boolean userSetMonths
           
 
Fields inherited from class javax.swing.JTable
AUTO_RESIZE_ALL_COLUMNS, AUTO_RESIZE_LAST_COLUMN, AUTO_RESIZE_NEXT_COLUMN, AUTO_RESIZE_OFF, AUTO_RESIZE_SUBSEQUENT_COLUMNS, autoCreateColumnsFromModel, autoResizeMode, cellEditor, cellSelectionEnabled, columnModel, dataModel, defaultEditorsByColumnClass, defaultRenderersByColumnClass, editingColumn, editingRow, editorComp, gridColor, preferredViewportSize, rowHeight, rowMargin, rowSelectionAllowed, selectionBackground, selectionForeground, selectionModel, showHorizontalLines, showVerticalLines, tableHeader
 
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
MonthTable(com.klg.jclass.util.value.JCValueModel model, Locale l)
          Construct a MonthTable with the given value model and locale.
MonthTable(com.klg.jclass.util.value.JCValueModel model, Locale l, String[] months)
          Construct a MonthTable with the given value model, locale, and month names.
 
Method Summary
 void addActionListener(ActionListener l)
          Add listener to receive action event when data is changed by the user.
 void addNotify()
          Calls configureEnclosingScrollPane aswell as setting up the table row height based on the font metrics.
protected  void adjustSize()
          Adjust the size of the table.
protected  void calculateCellSize()
          Calculates the cell size.
 com.klg.jclass.util.value.JCValueModel getCalendarModel()
          Get the value model being used.
 Locale getLocale()
          Get the locale being used.
 Dimension getPreferredSize()
          Get the preferred size.
 com.klg.jclass.util.calendar.JCCalendar getSpecialDates()
          Get the special dates being used by the DayTable.
 com.klg.jclass.util.calendar.JCCalendar getSpecialDates(com.klg.jclass.util.calendar.JCCalendar sd)
          Deprecated. As the parameter is unused, should use getSpecialDates()
 void mouseClicked(MouseEvent e)
          Mouse clicked.
 void mouseEntered(MouseEvent e)
          Mouse Entered.
 void mouseExited(MouseEvent e)
          Mouse Exited.
 void mousePressed(MouseEvent e)
          Mouse pressed.
 void mouseReleased(MouseEvent e)
          Mouse released.
 void removeActionListener(ActionListener l)
          remove listener to receive action event when data is changed by the user.
 void setCalendarModel(com.klg.jclass.util.value.JCValueModel model)
          Set the value model to use.
 void setFont(Font font)
          Override setFont to adjust the size of the table.
 void setLocale(Locale l)
          Set the locale to use.
 void setSpecialDates(com.klg.jclass.util.calendar.JCCalendar sd)
          This component ignores special dates.
 
Methods inherited from class javax.swing.JTable
addColumn, addColumnSelectionInterval, addRowSelectionInterval, changeSelection, clearSelection, columnAdded, columnAtPoint, columnMarginChanged, columnMoved, columnRemoved, columnSelectionChanged, configureEnclosingScrollPane, convertColumnIndexToModel, convertColumnIndexToView, createDefaultColumnModel, createDefaultColumnsFromModel, createDefaultDataModel, createDefaultEditors, createDefaultRenderers, createDefaultSelectionModel, createDefaultTableHeader, createScrollPaneForTable, doLayout, editCellAt, editCellAt, editingCanceled, editingStopped, getAccessibleContext, getAutoCreateColumnsFromModel, getAutoResizeMode, getCellEditor, getCellEditor, getCellRect, getCellRenderer, getCellSelectionEnabled, getColumn, getColumnClass, getColumnCount, getColumnModel, getColumnName, getColumnSelectionAllowed, getDefaultEditor, getDefaultRenderer, getDragEnabled, getEditingColumn, getEditingRow, getEditorComponent, getGridColor, getIntercellSpacing, getModel, getPreferredScrollableViewportSize, getRowCount, getRowHeight, getRowHeight, getRowMargin, getRowSelectionAllowed, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedColumn, getSelectedColumnCount, getSelectedColumns, getSelectedRow, getSelectedRowCount, getSelectedRows, getSelectionBackground, getSelectionForeground, getSelectionModel, getShowHorizontalLines, getShowVerticalLines, getSurrendersFocusOnKeystroke, getTableHeader, getToolTipText, getUI, getUIClassID, getValueAt, initializeLocalVars, isCellEditable, isCellSelected, isColumnSelected, isEditing, isRowSelected, moveColumn, paramString, prepareEditor, prepareRenderer, processKeyBinding, removeColumn, removeColumnSelectionInterval, removeEditor, removeNotify, removeRowSelectionInterval, resizeAndRepaint, rowAtPoint, selectAll, setAutoCreateColumnsFromModel, setAutoResizeMode, setCellEditor, setCellSelectionEnabled, setColumnModel, setColumnSelectionAllowed, setColumnSelectionInterval, setDefaultEditor, setDefaultRenderer, setDragEnabled, setEditingColumn, setEditingRow, setGridColor, setIntercellSpacing, setModel, setPreferredScrollableViewportSize, setRowHeight, setRowHeight, setRowMargin, setRowSelectionAllowed, setRowSelectionInterval, setSelectionBackground, setSelectionForeground, setSelectionMode, setSelectionModel, setShowGrid, setShowHorizontalLines, setShowVerticalLines, setSurrendersFocusOnKeystroke, setTableHeader, setUI, setValueAt, sizeColumnsToFit, sizeColumnsToFit, tableChanged, unconfigureEnclosingScrollPane, updateUI, valueChanged
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setForeground, 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, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, 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, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, 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

locale

protected Locale locale

tableCellWidth

protected int tableCellWidth

calendarModel

protected com.klg.jclass.util.value.JCValueModel calendarModel

monthModel

protected MonthTable.MonthModel monthModel

selectedMonth

protected int selectedMonth

months

protected String[] months

userSetMonths

protected boolean userSetMonths

actionListeners

protected com.klg.jclass.util.JCListenerList actionListeners
Constructor Detail

MonthTable

public MonthTable(com.klg.jclass.util.value.JCValueModel model,
                  Locale l)
Construct a MonthTable with the given value model and locale.

Parameters:
model - The new calendar value model
l - The locale to use

MonthTable

public MonthTable(com.klg.jclass.util.value.JCValueModel model,
                  Locale l,
                  String[] months)
Construct a MonthTable with the given value model, locale, and month names.

Parameters:
model - The new calendar value model
l - The locale to use
months - A list of months to use (null means use locale specific names)
Method Detail

setLocale

public void setLocale(Locale l)
Set the locale to use.

Specified by:
setLocale in interface CalendarComponent
Overrides:
setLocale in class Component
Parameters:
l - The new locale to use.

getLocale

public Locale getLocale()
Get the locale being used.

Overrides:
getLocale in class Component
Returns:
The current locale being used.

setFont

public void setFont(Font font)
Override setFont to adjust the size of the table.

Overrides:
setFont in class JComponent
Parameters:
font - The new font.

setCalendarModel

public void setCalendarModel(com.klg.jclass.util.value.JCValueModel model)
Set the value model to use.

Specified by:
setCalendarModel in interface CalendarComponent
Parameters:
model - The new calendar value model

getCalendarModel

public com.klg.jclass.util.value.JCValueModel getCalendarModel()
Get the value model being used.

Returns:
The current calendar value model.

setSpecialDates

public void setSpecialDates(com.klg.jclass.util.calendar.JCCalendar sd)
This component ignores special dates.

Specified by:
setSpecialDates in interface CalendarComponent
Parameters:
sd - The new list of special dates stored within a JCCalendar object

getSpecialDates

public com.klg.jclass.util.calendar.JCCalendar getSpecialDates(com.klg.jclass.util.calendar.JCCalendar sd)
Deprecated. As the parameter is unused, should use getSpecialDates()

Get the special dates being used by the DayTable.

Parameters:
sd - Unused
Returns:
The current list of special dates stored within a JCCalendar object

getSpecialDates

public com.klg.jclass.util.calendar.JCCalendar getSpecialDates()
Get the special dates being used by the DayTable.

Returns:
The current list of special dates stored within a JCCalendar object

addActionListener

public void addActionListener(ActionListener l)
Add listener to receive action event when data is changed by the user.

Specified by:
addActionListener in interface CalendarComponent
Parameters:
l - The action listener to be added.

removeActionListener

public void removeActionListener(ActionListener l)
remove listener to receive action event when data is changed by the user.

Specified by:
removeActionListener in interface CalendarComponent
Parameters:
l - The action listener to be removed.

addNotify

public void addNotify()
Calls configureEnclosingScrollPane aswell as setting up the table row height based on the font metrics.

Overrides:
addNotify in class JTable

adjustSize

protected void adjustSize()
Adjust the size of the table.


calculateCellSize

protected void calculateCellSize()
Calculates the cell size. The cell widths and heights are caculated separately. The table height will be six times the cell width and two times the cell height.


getPreferredSize

public Dimension getPreferredSize()
Get the preferred size.

Overrides:
getPreferredSize in class JComponent
Returns:
The preferred size calculated from the the preferred sizes of each of the cells.
See Also:
calculateCellSize()

mousePressed

public void mousePressed(MouseEvent e)
Mouse pressed.

Specified by:
mousePressed in interface MouseListener
Parameters:
e - The event generated

mouseClicked

public void mouseClicked(MouseEvent e)
Mouse clicked.

Specified by:
mouseClicked in interface MouseListener
Parameters:
e - The event generated

mouseReleased

public void mouseReleased(MouseEvent e)
Mouse released.

Specified by:
mouseReleased in interface MouseListener
Parameters:
e - The event generated

mouseEntered

public void mouseEntered(MouseEvent e)
Mouse Entered.

Specified by:
mouseEntered in interface MouseListener
Parameters:
e - The event generated

mouseExited

public void mouseExited(MouseEvent e)
Mouse Exited.

Specified by:
mouseExited in interface MouseListener
Parameters:
e - The event generated

Copyright © 2004 Quest Software Inc..
All rights reserved.