MDateSelector

mseries.plaf.basic
Class BasicCalendarPanelUI

java.lang.Object
  extended by javax.swing.plaf.ComponentUI
      extended by mseries.plaf.basic.BasicCalendarPanelUI
Direct Known Subclasses:
MetalCalendarPanelUI, MotifCalendarPanelUI, WindowsCalendarPanelUI

public class BasicCalendarPanelUI
extends ComponentUI

The BASIC look and feel UIDelegate for the CalendarPanel. It is envisaged that this is subclasses to provide something more acceptable. A Windows and Metal one are provided. A Look and Feel delegate for the CalenderPanel. This version renders the selected date with a raised border and dashed focus indicator. TAB moves around the calendar, Shift-Tab jumps out to the next component. The arrow keys move around the panel stopping (i.e. not rolling over) at the ends.


Nested Class Summary
protected  class BasicCalendarPanelUI.ArrowKeyAction
          Inner class to handle presses of the arrow keys
 
Field Summary
protected  Color background
           
protected  CalendarPanel calendarPanel
           
protected  int cellHeight
           
protected  int cellWidth
           
protected  int DAYS
           
protected  FocusListener focusHandler
           
protected  Font font
           
protected  Color foreground
           
protected  KeyListener keyHandler
           
protected  MouseListener mouseHandler
           
protected  Color selectedBackground
           
protected  Color selectedForeground
           
protected  int WEEKS
           
 
Constructor Summary
BasicCalendarPanelUI()
           
 
Method Summary
protected  FocusListener createFocusHandler()
           
protected  KeyListener createKeyHandler()
          KeyHandler factory method, this implementation handles the push of the TAB and SHIFT-TAB key
protected  MouseListener createMouseHandler()
          Creates the mouse listener for the panel.
static ComponentUI createUI(JComponent x)
          This method is called by the UIManager to get an instance of this class and must be overridden in subclasses.
protected  void drawFocusedEffect(Graphics g, boolean focused, boolean selected)
          Draws the dashed rectangle around the number in the cell which is selected when the calendar panel has focus.
 void drawLegend(Graphics g, String legend)
          This is where the legend, the day is drawn
protected  void drawSelectedEffect(Graphics g, boolean selected)
           
protected  Dimension getCellSize()
           
protected  void installDefaults()
           
protected  void installListeners()
           
 void installUI(JComponent c)
           
 boolean isOpaque()
           
protected  void moveToNextCell(int inc, boolean roll)
          Calculates the next cell that contains a valid date and therefore can be selected
 void paint(Graphics g, JComponent c)
           
protected  void uninstallDefaults()
           
protected  void uninstallListeners()
           
 void uninstallUI(JComponent c)
           
 void update(Graphics g, JComponent c)
           
 
Methods inherited from class javax.swing.plaf.ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, getBaseline, getBaselineResizeBehavior, getMaximumSize, getMinimumSize, getPreferredSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

background

protected Color background

foreground

protected Color foreground

selectedBackground

protected Color selectedBackground

selectedForeground

protected Color selectedForeground

calendarPanel

protected CalendarPanel calendarPanel

keyHandler

protected KeyListener keyHandler

mouseHandler

protected MouseListener mouseHandler

focusHandler

protected FocusListener focusHandler

cellWidth

protected int cellWidth

cellHeight

protected int cellHeight

DAYS

protected int DAYS

WEEKS

protected int WEEKS

font

protected Font font
Constructor Detail

BasicCalendarPanelUI

public BasicCalendarPanelUI()
Method Detail

createUI

public static ComponentUI createUI(JComponent x)
This method is called by the UIManager to get an instance of this class and must be overridden in subclasses.


installUI

public void installUI(JComponent c)
Overrides:
installUI in class ComponentUI

uninstallUI

public void uninstallUI(JComponent c)
Overrides:
uninstallUI in class ComponentUI

installDefaults

protected void installDefaults()

uninstallDefaults

protected void uninstallDefaults()

installListeners

protected void installListeners()

uninstallListeners

protected void uninstallListeners()

update

public void update(Graphics g,
                   JComponent c)
Overrides:
update in class ComponentUI

paint

public void paint(Graphics g,
                  JComponent c)
Overrides:
paint in class ComponentUI

drawSelectedEffect

protected void drawSelectedEffect(Graphics g,
                                  boolean selected)

drawLegend

public void drawLegend(Graphics g,
                       String legend)
This is where the legend, the day is drawn


drawFocusedEffect

protected void drawFocusedEffect(Graphics g,
                                 boolean focused,
                                 boolean selected)
Draws the dashed rectangle around the number in the cell which is selected when the calendar panel has focus. Over ride this method in a subclass to change the appearance.


createMouseHandler

protected MouseListener createMouseHandler()
Creates the mouse listener for the panel.


createKeyHandler

protected KeyListener createKeyHandler()
KeyHandler factory method, this implementation handles the push of the TAB and SHIFT-TAB key

Returns:
a KeyListener Object

createFocusHandler

protected FocusListener createFocusHandler()

getCellSize

protected Dimension getCellSize()

moveToNextCell

protected void moveToNextCell(int inc,
                              boolean roll)
Calculates the next cell that contains a valid date and therefore can be selected

Parameters:
inc - minus -1 moves back one day, +1 forward wrapping around at both the start and end of the month
roll - true if the selection rols to the next row at the end

isOpaque

public boolean isOpaque()

MDateSelector

Copyright © 2001-2007 M Newstead. All Rights Reserved.