|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--java.awt.Window | +--java.awt.Dialog
A Dialog is a top-level window with a title and a border
that is typically used to take some form of input from the user.
The size of the dialog includes any area designated for the
border. The dimensions of the border area can be obtained
using the getInsets
method, however, since
these dimensions are platform-dependent, a valid insets
value cannot be obtained until the dialog is made displayable
by either calling pack
or show
.
Since the border area is included in the overall size of the
dialog, the border effectively obscures a portion of the dialog,
constraining the area available for rendering and/or displaying
subcomponents to the rectangle which has an upper-left corner
location of (insets.left, insets.top)
, and has a size of
width - (insets.left + insets.right)
by
height - (insets.top + insets.bottom)
.
The default layout for a dialog is BorderLayout.
A dialog must have either a frame or another dialog defined as its owner when it's constructed. When the owner window of a visible dialog is hidden or minimized, the dialog will automatically be hidden from the user. When the owner window is subsequently re-opened, then the dialog is made visible to the user again.
A dialog can be either modeless (the default) or modal. A modal dialog is one which blocks input to all other toplevel windows in the app context, except for any windows created with the dialog as their owner.
Dialogs are capable of generating the following window events: WindowOpened, WindowClosing, WindowClosed, WindowActivated, WindowDeactivated.
WindowEvent
,
Window.addWindowListener(java.awt.event.WindowListener)
, Serialized FormInner classes inherited from class java.awt.Component |
Component.AWTTreeLock,
Component.NativeInLightFixer |
Field Summary | |
private static String |
base
|
(package private) boolean |
modal
Will be true if the Dialog is modal, otherwise the dialog will be modeless. |
private static int |
nameCounter
|
(package private) boolean |
resizable
A dialogs resizable property. |
private static long |
serialVersionUID
|
(package private) String |
title
Specifies the title of the Dialog. |
Fields inherited from class java.awt.Window |
active,
base,
focusMgr,
inputContext,
nameCounter,
OPENED,
ownedWindowList,
serialVersionUID,
state,
warningString,
weakThis,
windowListener,
windowSerializedDataVersion |
Fields inherited from class java.awt.Container |
component,
containerListener,
containerSerializedDataVersion,
dispatcher,
layoutMgr,
maxSize,
ncomponents,
serialVersionUID |
Constructor Summary | |
Dialog(Dialog owner)
Constructs an initially invisible, non-modal Dialog with an empty title and the specified owner dialog. |
|
Dialog(Dialog owner,
String title)
Constructs an initially invisible, non-modal Dialog with the specified owner dialog and title. |
|
Dialog(Dialog owner,
String title,
boolean modal)
Constructs an initially invisible Dialog with the specified owner dialog, title, and modality. |
|
Dialog(Frame owner)
Constructs an initially invisible, non-modal Dialog with an empty title and the specified owner frame. |
|
Dialog(Frame owner,
boolean modal)
Constructs an initially invisible Dialog with an empty title, the specified owner frame and modality. |
|
Dialog(Frame owner,
String title)
Constructs an initially invisible, non-modal Dialog with the specified owner frame and title. |
|
Dialog(Frame owner,
String title,
boolean modal)
Constructs an initially invisible Dialog with the specified owner frame, title, and modality. |
Method Summary | |
(package private) static void |
|
void |
addNotify()
Makes this Dialog displayable by connecting it to a native screen resource. |
(package private) String |
constructComponentName()
Construct a name for this component. |
String |
getTitle()
Gets the title of the dialog. |
private static void |
initIDs()
Initialize JNI field and method IDs |
boolean |
isModal()
Indicates whether the dialog is modal. |
boolean |
isResizable()
Indicates whether this dialog is resizable by the user. |
protected String |
paramString()
Returns the parameter string representing the state of this dialog window. |
void |
setModal(boolean b)
Specifies whether this dialog should be modal. |
void |
setResizable(boolean resizable)
Sets whether this dialog is resizable by the user. |
void |
setTitle(String title)
Sets the title of the Dialog. |
void |
show()
Makes the Dialog visible. |
Methods inherited from class java.lang.Object |
clone,
equals,
getClass,
hashCode,
notify,
notifyAll,
registerNatives,
wait,
wait,
wait |
Field Detail |
boolean resizable
setResizable()
boolean modal
isModal()
,
setModal()
String title
getTitle()
,
setTitle()
private static final String base
private static int nameCounter
private static final long serialVersionUID
Constructor Detail |
public Dialog(Frame owner)
owner
- the owner of the dialogowner
is null
Component.setSize(int, int)
,
Component.setVisible(boolean)
public Dialog(Frame owner, boolean modal)
owner
- the owner of the dialogmodal
- if true, dialog blocks input to other app windows when shownowner
is null
public Dialog(Frame owner, String title)
owner
- the owner of the dialogtitle
- the title of the dialog. A null
value
will be accepted without causing a NullPointerException
to be thrown.owner
is null
Component.setSize(int, int)
,
Component.setVisible(boolean)
public Dialog(Frame owner, String title, boolean modal)
owner
- the owner of the dialogtitle
- the title of the dialog. A null
value
will be accepted without causing a NullPointerException
to be thrown.modal
- if true, dialog blocks input to other app windows when shownowner
is null
Component.setSize(int, int)
,
Component.setVisible(boolean)
public Dialog(Dialog owner)
owner
- the owner of the dialogowner
is null
public Dialog(Dialog owner, String title)
owner
- the owner of the dialogtitle
- the title of the dialog. A null
value
will be accepted without causing a NullPointerException
to be thrown.owner
is null
public Dialog(Dialog owner, String title, boolean modal)
owner
- the owner of the dialogtitle
- the title of the dialog. A null
value
will be accepted without causing a NullPointerException to
be thrown.modal
- if true, dialog blocks input to other app windows when shownowner
is null
Method Detail |
static void()
String constructComponentName()
public void addNotify()
Component.isDisplayable()
,
Container.removeNotify()
public boolean isModal()
true
if this dialog window is modal;
false
otherwise.setModal(boolean)
public void setModal(boolean b)
isModal()
public String getTitle()
null
.setTitle(java.lang.String)
public void setTitle(String title)
title
- the title displayed in the dialog's bordergetTitle()
public void show()
If the dialog is modal, this call will block until the
dialog is hidden by calling hide
or dispose
.
It is permissible to show modal dialogs from the event
dispatching thread because the toolkit
will ensure that another dispatching thread will run while
the one which invoked this method is blocked.
Component.hide()
,
Component.isDisplayable()
,
Component.validate()
,
isModal()
public boolean isResizable()
true
if the user can resize the dialog;
false
otherwise.setResizable(boolean)
public void setResizable(boolean resizable)
resizable
- true
if the user can
resize this dialog; false
otherwise.isResizable()
protected String paramString()
private static void initIDs()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |