英特內軟體股份有限公司


jcx.jform.tools
Class jcalendar

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--jcx.jform.tools.jcalendar
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class jcalendar
extends javax.swing.JComponent
implements java.awt.event.ActionListener

bDateChooser is a simple Date choosing component with similar functionality to JFileChooser and JColorChooser. It can be used as a component, to be inserted into a client layout, or can display it's own Dialog through use of the showDialog method.

bDateChooser can be initialized to the current date using the no argument constructor, or initialized to a predefined date by passing an instance of Calendar to the constructor.

Using the bDateChooser dialog works in a similar manner to JFileChooser or JColorChooser. The showDialog method returns an int that equates to the public variables ACCEPT_OPTION, CANCEL_OPTION or ERROR_OPTION.

bDateChooser chooser = new bDateChooser();
if (chooser.showDialog(this, "Select a date...") == bDateChooser.ACCEPT_OPTION) {
  Calendar selectedDate = chooser.getSelectedDate();
  // process date here...
}

To use bDateChooser as a component within a GUI, users should subclass bDateChooser and override the acceptSelection and cancelSelection methods to process the corresponding user selection.

The current date can be retrieved by calling getSelectedDate method.

See Also:
Serialized Form

Inner classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
Field Summary
static int ACCEPT_OPTION
          Value returned by showDialog upon pressing the "okay" button.
static int CANCEL_OPTION
          Value returned by showDialog upon pressing the "cancel" button.
static int ERROR_OPTION
          Value returned by showDialog upon an error.
 
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
jcalendar()
          This constructor creates a new instance of bDateChooser initialized to the current date.
jcalendar(java.util.Calendar c)
          Creates a new instance of bDateChooser initialized to the given Calendar.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          Used to process events from the previous month, previous year, next month, next year, okay and cancel buttons.
static void init(bdisplay bd, java.lang.String name)
          J-form 的表單中的文字物件可以設定 自定格式 本物件為一個日曆,只要在自定格式加入一行.
static void init(bdisplay bd, java.lang.String name, java.lang.String format)
          J-form 的表單中的文字物件可以設定 自定格式 本物件為一個日曆,只要在自定格式加入一行.
static void init(bdisplay bd, java.lang.String name, java.lang.String format, java.util.Calendar c)
          J-form 的表單中的文字物件可以設定 自定格式 本物件為一個日曆,只要在自定格式加入一行.
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getUIClassID, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setLayout, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ERROR_OPTION

public static final int ERROR_OPTION
Value returned by showDialog upon an error.

ACCEPT_OPTION

public static final int ACCEPT_OPTION
Value returned by showDialog upon pressing the "okay" button.

CANCEL_OPTION

public static final int CANCEL_OPTION
Value returned by showDialog upon pressing the "cancel" button.
Constructor Detail

jcalendar

public jcalendar()
This constructor creates a new instance of bDateChooser initialized to the current date.

jcalendar

public jcalendar(java.util.Calendar c)
Creates a new instance of bDateChooser initialized to the given Calendar.
Method Detail

init

public static void init(bdisplay bd,
                        java.lang.String name)
J-form 的表單中的文字物件可以設定 自定格式 本物件為一個日曆,只要在自定格式加入一行.
  if(value==START){
    jcx.jform.tools.jcalendar.init(this,"field1");
  } else {

  } 
 
如果物件的標題第一個字是 & ,以小 button 呼叫月曆視窗
Parameters:
bd - 傳入 this 即可.
name - 即時更動之物件名稱.
Returns:
none.

init

public static void init(bdisplay bd,
                        java.lang.String name,
                        java.lang.String format)
J-form 的表單中的文字物件可以設定 自定格式 本物件為一個日曆,只要在自定格式加入一行.
  if(value==START){
    jcx.jform.tools.jcalendar.init(this,"field1");
  } else {

  } 
 
如果物件的標題第一個字是 & ,以小 button 呼叫月曆視窗
Parameters:
bd - 傳入 this 即可.
name - 即時更動之物件名稱.
format - 傳回的日期格式 yymmdd YYYYmmdd yy/mm/dd 皆可.
Returns:
none.

init

public static void init(bdisplay bd,
                        java.lang.String name,
                        java.lang.String format,
                        java.util.Calendar c)
J-form 的表單中的文字物件可以設定 自定格式 本物件為一個日曆,只要在自定格式加入一行.
  if(value==START){
    jcx.jform.tools.jcalendar.init(this,"field1");
  } else {

  } 
 
如果物件的標題第一個字是 & ,以小 button 呼叫月曆視窗
Parameters:
bd - 傳入 this 即可.
name - 即時更動之物件名稱.
format - 傳回的日期格式 yymmdd YYYYmmdd yy/mm/dd 皆可.
c - 預設的日期.
Returns:
none.

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Used to process events from the previous month, previous year, next month, next year, okay and cancel buttons. Users should call super.actionPerformed(ActionEvent) if overriding this method.
Specified by:
actionPerformed in interface java.awt.event.ActionListener

英特內軟體股份有限公司