public class JGraspDialog extends JDialog
Modifier and Type | Class and Description |
---|---|
static class |
JGraspDialog.Location
Positioning locations.
|
JDialog.AccessibleJDialog
Dialog.AccessibleAWTDialog, Dialog.ModalExclusionType, Dialog.ModalityType
Window.AccessibleAWTWindow, Window.Type
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
accessibleContext, rootPane, rootPaneCheckingEnabled
DEFAULT_MODALITY_TYPE
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
JGraspDialog(GraphicsConfiguration gc)
Creates a new JGraspDialog.
|
JGraspDialog(Window owner)
Creates a new JGraspDialog.
|
JGraspDialog(Window owner,
boolean modal)
Creates a new JGraspDialog.
|
JGraspDialog(Window owner,
String title)
Creates a new JGraspDialog.
|
JGraspDialog(Window owner,
String title,
boolean modal)
Creates a new JGraspDialog.
|
JGraspDialog(Window owner,
String title,
boolean modal,
GraphicsConfiguration gc)
Creates a new JGraspDialog.
|
Modifier and Type | Method and Description |
---|---|
static boolean |
checkModal(Rectangle raiseOnIntersect)
Checks all windows to see if any modal dialogs are up, and optionally
raises all modal dialogs that intersect a specified rectangle.
|
static JGraspDialog |
createDialog(Component ref,
boolean modal)
Creates a new dialog.
|
static JGraspDialog |
createDialog(Component ref,
GraphicsConfiguration gc)
Creates a new non-modal dialog.
|
static JGraspDialog |
createDialog(Component ref,
GraphicsConfiguration gc,
boolean modal)
Creates a new dialog.
|
Dimension |
getMinimumSize()
Returns the minimum size of this container.
|
void |
jgdInit()
Performs initialization.
|
void |
pack()
Causes this Window to be sized to fit the preferred size
and layouts of its subcomponents.
|
void |
setBounds(int x,
int y,
int w,
int h)
Moves and resizes this component.
|
static void |
setDefaultIconType(grasp.icons.GIcon.Type type)
Sets the icon type for dialogs without parents.
|
void |
setDoublePack(boolean state)
Turns double packing on or off.
|
void |
setLocationRelativeTo(Component c)
Sets the location of the window relative to the specified
component according to the following scenarios.
|
void |
setLocationRelativeTo(Component c,
JGraspDialog.Location loc)
Sets the dialog location relative to another component.
|
void |
setLocationRelativeTo(Rectangle rect)
Sets the dialog location centered on a bounding rectangle.
|
void |
setLocationRelativeTo(Rectangle rect,
JGraspDialog.Location loc)
Sets the dialog location relative to a bounding rectangle.
|
void |
setVisible(boolean visible)
Shows or hides this
Dialog depending on the value of parameter
b . |
addImpl, createRootPane, dialogInit, getAccessibleContext, getContentPane, 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, 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, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeNotify, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImage, setIconImages, setLocation, setLocation, setLocationByPlatform, 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, 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 JGraspDialog(GraphicsConfiguration gc)
gc
- the graphics context for the dialog.public JGraspDialog(Window owner)
owner
- the dialog owner.public JGraspDialog(Window owner, boolean modal)
owner
- the dialog owner.modal
- true if this is to be a modal dialog, false otherwise.public JGraspDialog(Window owner, String title)
owner
- the dialog owner.title
- the title bar display text.public JGraspDialog(Window owner, String title, boolean modal)
owner
- the dialog owner.title
- the title bar display text.modal
- true if this is to be a modal dialog, false otherwise.public JGraspDialog(Window owner, String title, boolean modal, GraphicsConfiguration gc)
owner
- the dialog owner. This may be null, in which case the dialog
will be made always-on-top.title
- the title bar display text.modal
- true if this is to be a modal dialog, false otherwise.gc
- the graphics configuration for the dialog, or null if the
default should be used.public static boolean checkModal(Rectangle raiseOnIntersect)
raiseOnIntersect
- if non-null, any modal dialogs that intersect
this rectangle on the screen will be raised.public static JGraspDialog createDialog(Component ref, boolean modal)
ref
- the Window ancestor of this component (or the component itself
if it is a Window) will be the dialog parent if it is a Frame or Dialog.
Otherwise, the dialog parent will be null.modal
- true if the dialog should be modal, false otherwise.public static JGraspDialog createDialog(Component ref, GraphicsConfiguration gc)
ref
- the Window ancestor of this component (or the component itself
if it is a Window) will be the dialog parent if it is a Frame or Dialog.
Otherwise, the dialog parent will be null.gc
- the graphics context for the dialog.public static JGraspDialog createDialog(Component ref, GraphicsConfiguration gc, boolean modal)
ref
- the Window ancestor of this component (or the component itself
if it is a Window) will be the dialog parent if it is a Frame or Dialog.
Otherwise, the dialog parent will be null.gc
- the graphics context for the dialog.modal
- true if the dialog should be modal, false otherwise.public static void setDefaultIconType(grasp.icons.GIcon.Type type)
type
- the icon type for dialogs without parents.public Dimension getMinimumSize()
Component.setMinimumSize(Dimension)
and this Container
has a non-null
LayoutManager
,
then LayoutManager.minimumLayoutSize(Container)
is used to calculate the minimum size.
Note: some implementations may cache the value returned from the
LayoutManager
. Implementations that cache need not invoke
minimumLayoutSize
on the LayoutManager
every time
this method is invoked, rather the LayoutManager
will only
be queried after the Container
becomes invalid.
Overridden to always return (0,0) minimum size, to prevent grow-but-won't-shrink dialogs.
getMinimumSize
in class Container
Dimension
that represents
the minimum size of this container.Container.getPreferredSize()
,
Container.getMaximumSize()
,
Container.getLayout()
,
LayoutManager.minimumLayoutSize(Container)
,
Component.getMinimumSize()
public void jgdInit()
public void pack()
setMinimumSize
method.
If the window and/or its owner are not displayable yet, both of them are made displayable before calculating the preferred size. The Window is validated after its size is being calculated.
Overridden to pack twice if necessary.
pack
in class Window
Component.isDisplayable()
,
Window.setMinimumSize(java.awt.Dimension)
public void setBounds(int x, int y, int w, int h)
x
and y
, and the
new size is specified by width
and height
.
This method changes layout-related information, and therefore, invalidates the component hierarchy.
The width
or height
values
are automatically enlarged if either is less than
the minimum size as specified by previous call to
setMinimumSize
.
The method changes the geometry-related data. Therefore,
the native windowing system may ignore such requests, or it may modify
the requested data, so that the Window
object is placed and sized
in a way that corresponds closely to the desktop settings.
setBounds
in class Window
x
- the new x-coordinate of this componenty
- the new y-coordinate of this componentw
- the new width
of this componenth
- the new height
of this
componentComponent.getBounds()
,
Window.setLocation(int, int)
,
Window.setLocation(Point)
,
Window.setSize(int, int)
,
Window.setSize(Dimension)
,
Window.setMinimumSize(java.awt.Dimension)
,
Window.setLocationByPlatform(boolean)
,
Window.isLocationByPlatform()
public void setDoublePack(boolean state)
state
- if true, any pack() call after this will result in two
super.pack() calls. If false, pack() calls after this will just call
super.pack().public void setLocationRelativeTo(Component c)
The target screen mentioned below is a screen to which the window should be placed after the setLocationRelativeTo method is called.
null
, or the GraphicsConfiguration
associated with this component is
null
, the window is placed in the center of the
screen. The center point can be obtained with the GraphicsEnvironment.getCenterPoint
method.
null
, but it is not
currently showing, the window is placed in the center of
the target screen defined by the GraphicsConfiguration
associated with this component.
null
and is shown on
the screen, then the window is located in such a way that
the center of the window coincides with the center of the
component.
If the screens configuration does not allow the window to
be moved from one screen to another, then the window is
only placed at the location determined according to the
above conditions and its GraphicsConfiguration
is
not changed.
Note: If the lower edge of the window is out of the screen,
then the window is placed to the side of the Component
that is closest to the center of the screen. So if the
component is on the right part of the screen, the window
is placed to its left, and vice versa.
If after the window location has been calculated, the upper, left, or right edge of the window is out of the screen, then the window is located in such a way that the upper, left, or right edge of the window coincides with the corresponding edge of the screen. If both left and right edges of the window are out of the screen, the window is placed at the left side of the screen. The similar placement will occur if both top and bottom edges are out of the screen. In that case, the window is placed at the top side of the screen.
The method changes the geometry-related data. Therefore,
the native windowing system may ignore such requests, or it may modify
the requested data, so that the Window
object is placed and sized
in a way that corresponds closely to the desktop settings.
Overridden to locate relative to visible bounds, and to work for non-showing components.
setLocationRelativeTo
in class Window
c
- the component in relation to which the window's location
is determinedGraphicsEnvironment.getCenterPoint()
public void setLocationRelativeTo(Component c, JGraspDialog.Location loc)
c
- the positioning component.loc
- the desired location relative to the positioning
component.public void setLocationRelativeTo(Rectangle rect)
rect
- the bounding rectangle.public void setLocationRelativeTo(Rectangle rect, JGraspDialog.Location loc)
rect
- the bounding rectangle.loc
- the desired location relative to the bounding rectangle.public void setVisible(boolean visible)
Dialog
depending on the value of parameter
b
.setVisible
in class Dialog
visible
- if true
, makes the Dialog
visible,
otherwise hides the Dialog
.
If the dialog and/or its owner
are not yet displayable, both are made displayable. The
dialog will be validated prior to being made visible.
If false
, hides the Dialog
and then causes setVisible(true)
to return if it is currently blocked.
Notes for modal dialogs.
setVisible(true)
: If the dialog is not already
visible, this call will not return until the dialog is
hidden by calling setVisible(false)
or
dispose
.
setVisible(false)
: Hides the dialog and then
returns on setVisible(true)
if it is currently blocked.
Window.setVisible(boolean)
,
Window.dispose()
,
Component.isDisplayable()
,
Component.validate()
,
Dialog.isModal()