java.lang.Objectjava.awt.Component
java.awt.Container
java.awt.Window
java.awt.Dialog
public class 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 may have its native decorations (i.e. Frame & Titlebar) turned off
with setUndecorated. This can only be done while the dialog
is not displayable.
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 minimized, the dialog will automatically be hidden from the user. When the owner window is subsequently restored, the dialog is made visible to the user again.
In a multi-screen environment, you can create a Dialog
on a different screen device than its owner. See Frame for
more information.
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 application, except for any windows created with the dialog as their owner.
Dialogs are capable of generating the following
WindowEvents:
WindowOpened, WindowClosing,
WindowClosed, WindowActivated,
WindowDeactivated, WindowGainedFocus,
WindowLostFocus.
WindowEvent,
Window.addWindowListener(java.awt.event.WindowListener),
Serialized Form| Nested Class Summary | |
|---|---|
protected class |
Dialog.AccessibleAWTDialog
This class implements accessibility support for the Dialog class. |
| Nested classes/interfaces inherited from class java.awt.Window |
|---|
Window.AccessibleAWTWindow |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary |
|---|
| 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 | |
|---|---|
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(Dialog owner,
String title,
boolean modal,
GraphicsConfiguration gc)
Constructs an initially invisible Dialog with the
specified owner dialog, title, modality, and
GraphicsConfiguration. |
|
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. |
|
Dialog(Frame owner,
String title,
boolean modal,
GraphicsConfiguration gc)
Constructs an initially invisible Dialog with the specified owner frame, title, modality, and GraphicsConfiguration. |
|
| Method Summary | |
|---|---|
void |
addNotify()
Makes this Dialog displayable by connecting it to a native screen resource. |
AccessibleContext |
getAccessibleContext()
Gets the AccessibleContext associated with this Dialog. |
String |
getTitle()
Gets the title of the dialog. |
void |
hide()
Deprecated. As of JDK version 1.5, replaced by Component.setVisible(boolean). |
boolean |
isModal()
Indicates whether the dialog is modal. |
boolean |
isResizable()
Indicates whether this dialog is resizable by the user. |
boolean |
isUndecorated()
Indicates whether this dialog is undecorated. |
protected String |
paramString()
Returns a string representing the state of this dialog. |
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 |
setUndecorated(boolean undecorated)
Disables or enables decorations for this dialog. |
void |
show()
Deprecated. As of JDK version 1.5, replaced by Component.setVisible(boolean). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Dialog(Frame owner)
Dialog with
an empty title and the specified owner frame.
owner - the owner of the dialog
IllegalArgumentException - if the owner's
GraphicsConfiguration is not from a screen device
IllegalArgumentException - if owner
is null; this exception is always thrown
when GraphicsEnvironment.isHeadless
returns trueGraphicsEnvironment.isHeadless(),
Component.setSize(int, int),
Component.setVisible(boolean)public Dialog(Frame owner, boolean modal)
Dialog with an empty title,
the specified owner frame and modality.
owner - the owner of the dialogmodal - if true, dialog blocks input to other
app windows when shown
IllegalArgumentException - if the owner's
GraphicsConfiguration is not from a screen device
IllegalArgumentException - if owner
is null; this exception is always thrown
when GraphicsEnvironment.isHeadless
returns trueGraphicsEnvironment.isHeadless()public Dialog(Frame owner, String title)
Dialog with
the specified owner frame and 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
IllegalArgumentException - if the owner's
GraphicsConfiguration is not from a screen device
IllegalArgumentException - if owner
is null; this exception is always thrown
when GraphicsEnvironment.isHeadless
returns trueGraphicsEnvironment.isHeadless(),
Component.setSize(int, int),
Component.setVisible(boolean)public Dialog(Frame owner, String title, boolean modal)
Dialog with the
specified owner frame, title, and modality.
owner - the owner of the dialogtitle - the title of the dialog; a null value
will be accepted without causing a
NullPointerException to be thrownmodal - if true, dialog blocks input to other app windows when shown
IllegalArgumentException - if the owner's
GraphicsConfiguration is not from a screen device
IllegalArgumentException - if owner
is null. This exception is always thrown
when GraphicsEnvironment.isHeadless
returns trueGraphicsEnvironment.isHeadless(),
Component.setSize(int, int),
Component.setVisible(boolean)public Dialog(Frame owner, String title, boolean modal, GraphicsConfiguration gc)
GraphicsConfiguration.
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 showngc - the GraphicsConfiguration
of the target screen device. If gc is
null, the same
GraphicsConfiguration as the owning Frame is used.
IllegalArgumentException - if owner
is null. This exception is always thrown
when GraphicsEnvironment.isHeadless() returns trueGraphicsEnvironment.isHeadless(),
Component.setSize(int, int),
Component.setVisible(boolean)public Dialog(Dialog owner)
owner - the owner of the dialog
IllegalArgumentException - if owner
is null. This exception is always thrown
when GraphicsEnvironment.isHeadless() returns trueGraphicsEnvironment.isHeadless()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.
IllegalArgumentException - if owner
is null. This exception is always thrown
when GraphicsEnvironment.isHeadless() returns trueGraphicsEnvironment.isHeadless()public Dialog(Dialog owner, String title, boolean modal)
Dialog with the
specified owner dialog, title, and modality.
owner - the owner of the dialogtitle - the title of the dialog; a null value
will be accepted without causing a
NullPointerException to be thrownmodal - if true, dialog blocks input to other app windows when shown
IllegalArgumentException - if the owner's
GraphicsConfiguration is not from a screen device
IllegalArgumentException - if owner
is null; this exception is always thrown
when GraphicsEnvironment.isHeadless
returns trueGraphicsEnvironment.isHeadless()public Dialog(Dialog owner, String title, boolean modal, GraphicsConfiguration gc)
Dialog with the
specified owner dialog, title, modality, and
GraphicsConfiguration.
owner - the owner of the dialogtitle - the title of the dialog; a null value
will be accepted without causing a
NullPointerException to be thrownmodal - if true, dialog blocks input to other app windows when showngc - the GraphicsConfiguration
of the target screen device; if gc is
null, the same
GraphicsConfiguration as the owning Dialog is used
IllegalArgumentException - if the owner's
GraphicsConfiguration is not from a screen device
IllegalArgumentException - if owner
is null; this exception is always thrown
when GraphicsEnvironment.isHeadless
returns trueGraphicsEnvironment.isHeadless(),
Component.setSize(int, int),
Component.setVisible(boolean)| Method Detail |
|---|
public void addNotify()
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 border;
a null value results in an empty titlegetTitle()@Deprecated public void show()
Component.setVisible(boolean).
@Deprecated public void hide()
Component.setVisible(boolean).
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()public void setUndecorated(boolean undecorated)
undecorated - true if no dialog decorations are
to be enabled;
false if dialog decorations are to be enabled.
IllegalComponentStateException - if the dialog
is displayable.isUndecorated(),
Component.isDisplayable()public boolean isUndecorated()
true if dialog is undecorated;
false otherwise.setUndecorated(boolean)protected String paramString()
null.
paramString in class Containerpublic AccessibleContext getAccessibleContext()
getAccessibleContext in interface AccessiblegetAccessibleContext in class WindowCes informations proviennent du site de http://java.sun.com
Le contenu de cette page provient du site de Sun, et est généré depuis un cache sur l'infobrol après certains traitements automatisés. La présentation peut donc différer du document original, mais le contenu aussi. Vous pouvez utiliser ce bouton pour afficher la page originale du site de Sun :
Maintenir les pages en cache sur différents sites peut offrir plus de disponibilité.
Chaque page est indexée dans la base de donnée, ce qui permet de retrouver facilement les informations, au moyen des sommaires, du moteur de recherche interne, etc.
Des facilités sont mises en place pour que les membres de l'infobrol puissent effectuer des traductions en français des différents documents. Ceci devrait permettre aux débutants en programmation Java de consulter les API en français s'ils maîtrisent moins bien la langue de Shakespeare. Dans le cas où une traduction a été soumise, elle est disponible au moyen d'un lien en bas de page. Si la traduction a été validée, la page s'affiche par défaut en français, et un lien en bas de page permet d'atteindre la version en anglais.
Le code sur l'infobrol est automatiquement coloré selon la syntaxe, et les différents mots clés sont transformés en liens pour accéder rapidement aux informations.
Vous avez la possibilité de partager vos expériences en proposant vos propres extraits de code en utilisant le bouton "ajouter un commentaire" en bas de page. Si vous visitez simplement l'infobrol, vous avez déjà accès à cette fonction, mais si vous étes membre du brol, vous pouvez en plus utiliser des boutons supplémentaires de mise en forme, dont la coloration automatique de vos extraits de codes.
Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher les interactions avec les réseaux sociaux sur ces pages.
6 mots clés dont 0 définis manuellement (plus d'information...).
Avertissement
Cette page ne possède pas encore de mots clés manuels, ceci est donc un exemple automatique (les niveaux de pertinence sont fictifs, mais les liens sont valables). Pour tester le nuage avec une page qui contient des mots définis manuellement, vous pouvez cliquer ici.Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher le nuage de mots clés.
Recherche (afficher)
Utilisateur (masquer)
Navigation (masquer)
Apparence (afficher)
Stats (afficher)
Citation (masquer)