org.am.snitch.otherparty
Class CalendarBean

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Dialog
                  extended by javax.swing.JDialog
                      extended by org.am.snitch.otherparty.CalendarBean
All Implemented Interfaces:
MouseListener, ImageObserver, MenuContainer, PropertyChangeListener, Serializable, EventListener, Accessible, RootPaneContainer, WindowConstants

public class CalendarBean
extends JDialog
implements PropertyChangeListener, MouseListener

JCalendar is a bean for entering a date by choosing the year, month and day.

Version:
1.2
Author:
Kai Toedter
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JDialog
JDialog.AccessibleJDialog
 
Nested classes/interfaces inherited from class java.awt.Dialog
Dialog.AccessibleAWTDialog
 
Nested classes/interfaces inherited from class java.awt.Window
Window.AccessibleAWTWindow
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected  com.toedter.calendar.JDayChooser dayChooser
          the day chooser
protected  Locale locale
          the locale
protected  com.toedter.calendar.JMonthChooser monthChooser
          the month chooser
protected  boolean weekOfYearVisible
          indicates if weeks of year shall be visible
protected  com.toedter.calendar.JYearChooser yearChooser
          the year chhoser
 
Fields inherited from class javax.swing.JDialog
accessibleContext, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
CalendarBean(JTextField textField, JFrame parent)
          Default JCalendar constructor.
 
Method Summary
 Calendar getCalendar()
          Returns the calendar property.
 String getDate()
          Returns a Date object.
 com.toedter.calendar.JDayChooser getDayChooser()
          Gets the dayChooser attribute of the JCalendar object
 Color getDecorationBackgroundColor()
          Returns the color of the decoration (day names and weeks).
 Locale getLocale()
          Returns the locale.
 com.toedter.calendar.JMonthChooser getMonthChooser()
          Gets the monthChooser attribute of the JCalendar object
 String getName()
          Returns "JCalendar".
 Color getSundayForeground()
          Returns the Sunday foreground.
 Color getWeekdayForeground()
          Returns the weekday foreground.
 com.toedter.calendar.JYearChooser getYearChooser()
          Gets the yearChooser attribute of the JCalendar object
 boolean isDecorationBackgroundVisible()
          Gets the visibility of the decoration background.
 boolean isDecorationBordersVisible()
          Gets the visibility of the decoration border.
 boolean isEnabled()
          Returns true, if enabled.
 boolean isWeekOfYearVisible()
          Indicates if the weeks of year are visible..
 void mouseClicked(MouseEvent e)
           
 void mouseEntered(MouseEvent e)
           
 void mouseExited(MouseEvent e)
           
 void mousePressed(MouseEvent e)
           
 void mouseReleased(MouseEvent e)
           
 void propertyChange(PropertyChangeEvent evt)
          JCalendar is a PropertyChangeListener, for its day, month and year chooser.
 void setBackground(Color bg)
          Sets the background color.
 void setCalendar(Calendar c)
          Sets the calendar property.
 void setDate(Date date)
          Sets the date.
 void setDecorationBackgroundColor(Color decorationBackgroundColor)
          Sets the background of days and weeks of year buttons.
 void setDecorationBackgroundVisible(boolean decorationBackgroundVisible)
          Sets the decoration background visible.
 void setDecorationBordersVisible(boolean decorationBordersVisible)
          Sets the decoration borders visible.
 void setEnabled(boolean enabled)
          Enable or disable the JCalendar.
 void setFont(Font font)
          Sets the font property.
 void setForeground(Color fg)
          Sets the foreground color.
 void setLocale(Locale l)
          Sets the locale property.
 void setSundayForeground(Color sundayForeground)
          Sets the Sunday foreground.
 void setWeekdayForeground(Color weekdayForeground)
          Sets the weekday foreground.
 void setWeekOfYearVisible(boolean isweekOfYearVisible)
          Sets the week of year visible.
 
Methods inherited from class javax.swing.JDialog
addImpl, createRootPane, dialogInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.awt.Dialog
addNotify, getTitle, hide, isModal, isResizable, isUndecorated, setModal, setResizable, setTitle, setUndecorated, show
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, finalize, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, isActive, isAlwaysOnTop, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setAlwaysOnTop, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationByPlatform, setLocationRelativeTo, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, 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, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBounds, setComponentOrientation, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

dayChooser

protected com.toedter.calendar.JDayChooser dayChooser
the day chooser


weekOfYearVisible

protected boolean weekOfYearVisible
indicates if weeks of year shall be visible


locale

protected Locale locale
the locale


monthChooser

protected com.toedter.calendar.JMonthChooser monthChooser
the month chooser


yearChooser

protected com.toedter.calendar.JYearChooser yearChooser
the year chhoser

Constructor Detail

CalendarBean

public CalendarBean(JTextField textField,
                    JFrame parent)
Default JCalendar constructor.

Parameters:
textField - JTextField The place where the result Date will be attached
Method Detail

getCalendar

public Calendar getCalendar()
Returns the calendar property.

Returns:
the value of the calendar property.

getDayChooser

public com.toedter.calendar.JDayChooser getDayChooser()
Gets the dayChooser attribute of the JCalendar object

Returns:
the dayChooser value

getLocale

public Locale getLocale()
Returns the locale.

Overrides:
getLocale in class Window
Returns:
the value of the locale property.
See Also:
setLocale(java.util.Locale)

getMonthChooser

public com.toedter.calendar.JMonthChooser getMonthChooser()
Gets the monthChooser attribute of the JCalendar object

Returns:
the monthChooser value

getName

public String getName()
Returns "JCalendar".

Overrides:
getName in class Component
Returns:
"JCalendar"

getYearChooser

public com.toedter.calendar.JYearChooser getYearChooser()
Gets the yearChooser attribute of the JCalendar object

Returns:
the yearChooser value

isWeekOfYearVisible

public boolean isWeekOfYearVisible()
Indicates if the weeks of year are visible..

Returns:
boolean true, if weeks of year are visible

propertyChange

public void propertyChange(PropertyChangeEvent evt)
JCalendar is a PropertyChangeListener, for its day, month and year chooser.

Specified by:
propertyChange in interface PropertyChangeListener
Parameters:
evt - the property change event

setBackground

public void setBackground(Color bg)
Sets the background color.

Overrides:
setBackground in class Component
Parameters:
bg - the new background

setCalendar

public void setCalendar(Calendar c)
Sets the calendar property. This is a bound property.

Parameters:
c - the new calendar
See Also:
getCalendar()

setEnabled

public void setEnabled(boolean enabled)
Enable or disable the JCalendar.

Overrides:
setEnabled in class Component
Parameters:
enabled - the new enabled value

isEnabled

public boolean isEnabled()
Returns true, if enabled.

Overrides:
isEnabled in class Component
Returns:
true, if enabled.

setFont

public void setFont(Font font)
Sets the font property.

Overrides:
setFont in class Container
Parameters:
font - the new font

setForeground

public void setForeground(Color fg)
Sets the foreground color.

Overrides:
setForeground in class Component
Parameters:
fg - the new foreground

setLocale

public void setLocale(Locale l)
Sets the locale property. This is a bound property.

Overrides:
setLocale in class Component
Parameters:
l - the new locale value
See Also:
getLocale()

setWeekOfYearVisible

public void setWeekOfYearVisible(boolean isweekOfYearVisible)
Sets the week of year visible.

Parameters:
isweekOfYearVisible - true, if weeks of year shall be visible

isDecorationBackgroundVisible

public boolean isDecorationBackgroundVisible()
Gets the visibility of the decoration background.

Returns:
true, if the decoration background is visible.

setDecorationBackgroundVisible

public void setDecorationBackgroundVisible(boolean decorationBackgroundVisible)
Sets the decoration background visible.

Parameters:
decorationBackgroundVisible - true, if the decoration background should be visible.

isDecorationBordersVisible

public boolean isDecorationBordersVisible()
Gets the visibility of the decoration border.

Returns:
true, if the decoration border is visible.

setDecorationBordersVisible

public void setDecorationBordersVisible(boolean decorationBordersVisible)
Sets the decoration borders visible.

Parameters:
decorationBordersVisible - true, if the decoration borders should be visible.

getDecorationBackgroundColor

public Color getDecorationBackgroundColor()
Returns the color of the decoration (day names and weeks).

Returns:
the color of the decoration (day names and weeks).

setDecorationBackgroundColor

public void setDecorationBackgroundColor(Color decorationBackgroundColor)
Sets the background of days and weeks of year buttons.

Parameters:
decorationBackgroundColor - the background color

getSundayForeground

public Color getSundayForeground()
Returns the Sunday foreground.

Returns:
Color the Sunday foreground.

getWeekdayForeground

public Color getWeekdayForeground()
Returns the weekday foreground.

Returns:
Color the weekday foreground.

setSundayForeground

public void setSundayForeground(Color sundayForeground)
Sets the Sunday foreground.

Parameters:
sundayForeground - the sundayForeground to set

setWeekdayForeground

public void setWeekdayForeground(Color weekdayForeground)
Sets the weekday foreground.

Parameters:
weekdayForeground - the weekdayForeground to set

getDate

public String getDate()
Returns a Date object.

Returns:
a date object constructed from the calendar property.

setDate

public void setDate(Date date)
Sets the date. Fires the property change "date".

Parameters:
date - the new date.

mouseClicked

public void mouseClicked(MouseEvent e)
Specified by:
mouseClicked in interface MouseListener

mouseEntered

public void mouseEntered(MouseEvent e)
Specified by:
mouseEntered in interface MouseListener

mouseExited

public void mouseExited(MouseEvent e)
Specified by:
mouseExited in interface MouseListener

mousePressed

public void mousePressed(MouseEvent e)
Specified by:
mousePressed in interface MouseListener

mouseReleased

public void mouseReleased(MouseEvent e)
Specified by:
mouseReleased in interface MouseListener


Copyright © 2008 Axel Maroudas All Rights Reserved.