public class CalendarDialog
extends javax.swing.JComponent
CalendarDialogクラスは、日付入力を支援するダイアログを提供します。 カレンダダイアログ生成時は、表示形式を指定してCalendarDialog を構築します。 カレンダーダイアログのスタイルは、下記の項目を複数選択可能です('|'で結合)。 STYLE_BEFORE_YEAR_DISABLE : 前年ボタンを無効にする STYLE_BEFORE_MONTH_DISABLE : 前月ボタンを無効にする STYLE_TODAY_DISABLE : 本日ボタンを無効にする STYLE_AFTER_MONTH_DISABLE : 翌月ボタンを無効にする STYLE_AFTER_YEAR_DISABLE : 翌年ボタンを無効にする STYLE_POPUP_SELECT_DATE : 日付入力ダイアログの初期カーソルをテキストフィールドに設定された値にする 例:前・翌年ボタン無効の場合 CalendarDialog ( calendarField, CalendarDialog.STYLE_BEFORE_YEAR_DISABLE | CalendarDialog.STYLE_AFTER_YEAR_DISABLE ) オブジェクトを生成するとモーダルなカレンダーダイアログを表示します。 dialog.showDialog()でカレンダーダイアログをOpenします。 返り値はAPPROVE_OPTION,CANCEL_OPTION,ERROR_OPTIONの3通りで APPROVE_OPTION 日付が入力された(OKボタンを押された、ダブルクリックされた) CANCEL_OPTION キャンセルボタンが押された、日付を選択されずにウィンドウが閉じられた ERROR_OPTION エラーになった。(上記のいずれも実行されていない状態) ダイアログの操作方法は下記の通りです。 ・日付を決定する - 「OK」ボタンを押下する - EnterキーをかSPACEキー押下する - 日付をダブルクリックする ・日付入力をキャンセルする - 「キャンセル」ボタンを押下する - Escキーを押下する - ダイアログを閉じる - ダイアログがフォーカスを失う ・日付を移動する - マウスで日付をクリックする - カーソルキーを押下する ・前月・翌月に移動する - 「<」「>」ボタンを押下する - マウスで前月・翌月域の日付をクリックする - カーソルキーで前月・翌月域へ移動する - Ctrl+カーソルキー(左・右)を押下する ・前年・翌年に移動する - 「<<」「>>」ボタンを押下する ・本日へ移動する - 「■」ボタンを押下する - Homeキーを押下する
修飾子とタイプ | クラスと説明 |
---|---|
static class |
CalendarDialog.TimeType
時刻設定区分
|
修飾子とタイプ | フィールドと説明 |
---|---|
static int |
APPROVE_OPTION
イエスやOKが押されたとき
|
static int |
CANCEL_OPTION
キャンセルを押したときの返り値
|
static int |
ERROR_OPTION
エラーが起きたとき
|
static int |
POINT_ON_LEFT_BOTTOM
表示位置のベースポジション区分
|
static int |
POINT_ON_LEFT_TOP
表示位置のベースポジション区分
|
static int |
POINT_ON_RIGHT_BOTTOM
表示位置のベースポジション区分
|
static int |
POINT_ON_RIGHT_TOP
表示位置のベースポジション区分
|
static int |
STYLE_AFTER_MONTH_DISABLE
翌月ボタンを無効にする
|
static int |
STYLE_AFTER_YEAR_DISABLE
翌年ボタンを無効にする
|
static int |
STYLE_BEFORE_MONTH_DISABLE
前月ボタンを無効にする
|
static int |
STYLE_BEFORE_YEAR_DISABLE
前年ボタンを無効にする
|
static int |
STYLE_POPUP_SELECT_DATE
日付入力ダイアログの初期カーソルをテキストフィールドに設定された値にする
|
static int |
STYLE_TODAY_DISABLE
本日ボタンを無効にする
|
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
コンストラクタと説明 |
---|
CalendarDialog()
カレンダーの初期化
|
CalendarDialog(java.util.Date d)
カレンダーの初期化
|
CalendarDialog(java.util.Date d,
CalendarDialog.TimeType timetype)
カレンダーの初期化
|
CalendarDialog(java.util.Date d,
int style)
カレンダーの初期化
|
CalendarDialog(java.util.Date d,
int style,
java.awt.event.ActionListener listener,
CalendarDialog.TimeType timetype)
カレンダーの初期化
|
修飾子とタイプ | メソッドと説明 |
---|---|
java.util.Date |
getSelectedDate()
ダイアログ上で選択された日付を返す
|
int |
showDialog(java.awt.Component parent)
ダイアログを表示する
表示の契機となるアイコンやボタン等のオブジェクトのそばに表示される
|
int |
showDialog(java.awt.Component parent,
int pointOn)
ダイアログを表示する
表示の契機となるアイコンやボタン等のオブジェクトのそばに表示される
|
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, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, 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, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
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, transferFocusDownCycle, validate, validateTree
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, getAccessibleContext, 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, 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, transferFocusBackward, transferFocusUpCycle
public static final int POINT_ON_LEFT_TOP
public static final int POINT_ON_LEFT_BOTTOM
public static final int POINT_ON_RIGHT_TOP
public static final int POINT_ON_RIGHT_BOTTOM
public static final int STYLE_BEFORE_YEAR_DISABLE
public static final int STYLE_BEFORE_MONTH_DISABLE
public static final int STYLE_TODAY_DISABLE
public static final int STYLE_AFTER_MONTH_DISABLE
public static final int STYLE_AFTER_YEAR_DISABLE
public static final int STYLE_POPUP_SELECT_DATE
public static final int CANCEL_OPTION
public static final int APPROVE_OPTION
public static final int ERROR_OPTION
public CalendarDialog()
public CalendarDialog(java.util.Date d)
d
- カレンダーの初期表示する日付public CalendarDialog(java.util.Date d, CalendarDialog.TimeType timetype)
d
- カレンダーの初期表示する日付timetype
- カレンダーの時刻表示区分public CalendarDialog(java.util.Date d, int style)
d
- カレンダーの初期表示する日付style
- CalendarDialogの表示形式public CalendarDialog(java.util.Date d, int style, java.awt.event.ActionListener listener, CalendarDialog.TimeType timetype)
d
- カレンダーの初期表示する日付style
- CalendarDialogの表示形式listener
- OKボタンが押されたときのActionListenerpublic java.util.Date getSelectedDate()
public int showDialog(java.awt.Component parent)
parent
- 表示元の親コンポーネント。表示元となるアイコンやボタンのオブジェクトを指定すること。public int showDialog(java.awt.Component parent, int pointOn)
parent
- 表示元の親コンポーネント。表示元となるアイコンやボタンのオブジェクトを指定すること。pointOn
- ダイアログの四隅のどこを表示元にあわせて表示するかの指定。