public class Date_selector_dialog extends Popup_dialog implements Date_selector
Date_selector
and a Popup_dialog
to provide a
standalone, popup dialog for choosing dates. The dialog is a free-floating top-level window. You can drag it around by the title bar and close it by clicking on the "close" icon.
The class does implement the Date_selector
interface, but bear in mind that the window closes when the user
selects a date. Unlike the Titled_date_selector
wrapper class, both of the action events are sent to
listeners, however. Create one the hard way like this:
Date_selector calendar = new Date_selector_panel(selector); calendar = new Navigable_date_selector(calendar); // add navigation Date_selector_dialog chooser = new Date_selector_dialog(parent_frame, calendar); //... Date d = chooser.select(); // Pops up chooser; returns selected Date.You can leave out the navigation bar by omitting the second line of the previous example. The following convenience constructor has exactly the same effect as the earlier code:
Date_selector_dialog chooser = new Date_selector_dialog(parent_frame);
<pre>
You can also pop up the dialog like this:
<pre>
chooser.setVisible(true); // blocks until dialog closed
Date d = chooser.get_selected_date();
</pre>
This class is a stand-alone dialog. For a version
that you can embed into another window, see Date_selector_panel
.
@see Date_selector
@see Date_selector_panel
@see Navigable_date_selector
@see Titled_date_selector
Popup_dialog
,
Serialized Formjavax.swing.JDialog.AccessibleJDialog
java.awt.Dialog.AccessibleAWTDialog, java.awt.Dialog.ModalExclusionType, java.awt.Dialog.ModalityType
java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
accessibleContext, rootPane, rootPaneCheckingEnabled
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
CHANGE_ACTION, COMMIT_ACTION, SELECT_ACTION
Constructor and Description |
---|
Date_selector_dialog(java.awt.Dialog parent) |
Date_selector_dialog(java.awt.Dialog parent,
Date_selector to_wrap) |
Date_selector_dialog(java.awt.Frame parent)
Creates a dialog box with the indicated parent that holds a standard
Date_selector_panel (as created using the no-arg constructor). |
Date_selector_dialog(java.awt.Frame parent,
Date_selector to_wrap)
Creates a dialog box with the indicated parent that holds the indicated Date_selector.
|
Modifier and Type | Method and Description |
---|---|
void |
addActionListener(java.awt.event.ActionListener l)
Add an action listner for both
Date_selector.CHANGE_ACTION and Date_selector.SELECT_ACTION action
events. |
java.util.Date |
get_current_date()
Get the current date.
|
java.util.Date |
get_selected_date()
For use when you pop up a dialog using
setVisible(true) rather than select() . |
int |
get(int f)
Must work just like
Calendar.get(int) |
int |
getCloseAction() |
javax.swing.JComponent |
getComponent() |
void |
removeActionListener(java.awt.event.ActionListener l)
Remove a previously-added listener
|
void |
roll(int f,
boolean up)
Must work just like
Calendar.roll(int,boolean) |
java.util.Date |
select()
Pops up the chooser and blocks until the user selects a date.
|
void |
set_selected_date(java.util.Date d) |
void |
setCloseAction(int i) |
getContentPane
addImpl, createRootPane, dialogInit, getAccessibleContext, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
addNotify, getModalityType, getTitle, hide, isModal, isResizable, isUndecorated, setBackground, setModal, setModalityType, setOpacity, setResizable, setShape, setTitle, setUndecorated, setVisible, show, toBack
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeNotify, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImage, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, toFront
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, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
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, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, 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, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public Date_selector_dialog(java.awt.Frame parent)
Date_selector_panel
(as created using the no-arg constructor).public Date_selector_dialog(java.awt.Dialog parent)
public Date_selector_dialog(java.awt.Frame parent, Date_selector to_wrap)
public Date_selector_dialog(java.awt.Dialog parent, Date_selector to_wrap)
public java.util.Date get_selected_date()
setVisible(true)
rather than select()
.get_selected_date
in interface Date_selector
public java.util.Date get_current_date()
get_current_date
in interface Date_selector
public void set_selected_date(java.util.Date d)
set_selected_date
in interface Date_selector
public void addActionListener(java.awt.event.ActionListener l)
Date_selector.CHANGE_ACTION
and Date_selector.SELECT_ACTION
action
events.addActionListener
in interface Date_selector
public void removeActionListener(java.awt.event.ActionListener l)
removeActionListener
in interface Date_selector
public java.util.Date select()
public void roll(int f, boolean up)
Date_selector
Calendar.roll(int,boolean)
roll
in interface Date_selector
public int get(int f)
Date_selector
Calendar.get(int)
get
in interface Date_selector
public int getCloseAction()
public void setCloseAction(int i)
i
- public javax.swing.JComponent getComponent()
getComponent
in interface Date_selector