Class Dialog
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- java.awt.Window
-
- java.awt.Dialog
-
- All Implemented Interfaces:
- java.awt.image.ImageObserver, MenuContainer, java.io.Serializable, javax.accessibility.Accessible
- Direct Known Subclasses:
- FileDialog
public class Dialog extends WindowA 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 thegetInsets
method, however, since these dimensions are platform-dependent, a valid insets value cannot be obtained until the dialog is made displayable by either callingpack
orshow
. 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 ofwidth - (insets.left + insets.right)
byheight - (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 notdisplayable
.A dialog may have another window 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. SeeFrame
for more information.A dialog can be either modeless (the default) or modal. A modal dialog is one which blocks input to some other top-level windows in the application, except for any windows created with the dialog as their owner. See AWT Modality specification for details.
Dialogs are capable of generating the following
WindowEvents
:WindowOpened
,WindowClosing
,WindowClosed
,WindowActivated
,WindowDeactivated
,WindowGainedFocus
,WindowLostFocus
.- Since:
- JDK1.0
- See Also:
WindowEvent
,Window.addWindowListener(java.awt.event.WindowListener)
, Serialized Form
-
-
Nested Classes Modifier and Type Class and Description AccessibleAWTComponent protected class
AccessibleAWTComponentInner class of Component used to provide default support for accessibility.protected class
AccessibleAWTComponent-
Inner class of Component used to provide default support for accessibility. This class is not meant to be used directly by application developers, but is instead meant only to be subclassed by component developers.
The class used to obtain the accessible role for this object.
- Since:
- 1.3
- See Also:
- Serialized Form
BaselineResizeBehavior static class
BaselineResizeBehaviorEnumeration of the common ways the baseline of a component can change as the size changes.static class
BaselineResizeBehavior-
Enumeration of the common ways the baseline of a component can change as the size changes. The baseline resize behavior is primarily for layout managers that need to know how the position of the baseline changes as the component size changes. In general the baseline resize behavior will be valid for sizes greater than or equal to the minimum size (the actual minimum size; not a developer specified minimum size). For sizes smaller than the minimum size the baseline may change in a way other than the baseline resize behavior indicates. Similarly, as the size approaches
Integer.MAX_VALUE
and/orShort.MAX_VALUE
the baseline may change in a way other than the baseline resize behavior indicates.- Since:
- 1.6
- See Also:
Component.getBaselineResizeBehavior()
,Component.getBaseline(int,int)
BltBufferStrategy protected class
BltBufferStrategyInner class for blitting offscreen surfaces to a component.protected class
BltBufferStrategy-
Inner class for blitting offscreen surfaces to a component.
- Since:
- 1.4
FlipBufferStrategy protected class
FlipBufferStrategyInner class for flipping buffers on a component.protected class
FlipBufferStrategyAccessibleAWTContainer protected class
AccessibleAWTContainerInner class of Container used to provide default support for accessibility.protected class
AccessibleAWTContainer-
Inner class of Container used to provide default support for accessibility. This class is not meant to be used directly by application developers, but is instead meant only to be subclassed by container developers.
The class used to obtain the accessible role for this object, as well as implementing many of the methods in the AccessibleContainer interface.
- Since:
- 1.3
- See Also:
- Serialized Form
AccessibleAWTDialog protected class
AccessibleAWTDialogThis class implements accessibility support for theDialog
class.protected class
AccessibleAWTDialog-
This class implements accessibility support for the
Dialog
class. It provides an implementation of the Java Accessibility API appropriate to dialog user-interface elements.- Since:
- 1.3
- See Also:
- Serialized Form
ModalExclusionType static class
ModalExclusionTypeAny top-level window can be marked not to be blocked by modal dialogs.static class
ModalExclusionType-
Any top-level window can be marked not to be blocked by modal dialogs. This is called "modal exclusion". This enum specifies the possible modal exclusion types.
ModalityType static class
ModalityTypeModal dialogs block all input to some top-level windows.static class
ModalityType-
Modal dialogs block all input to some top-level windows. Whether a particular window is blocked depends on dialog's type of modality; this is called the "scope of blocking". The
ModalityType
enum specifies modal types and their associated scopes.
AccessibleAWTWindow protected class
AccessibleAWTWindowThis class implements accessibility support for theWindow
class.protected class
AccessibleAWTWindow-
This class implements accessibility support for the
Window
class. It provides an implementation of the Java Accessibility API appropriate to window user-interface elements.- Since:
- 1.3
- See Also:
- Serialized Form
Type static class
TypeEnumeration of available window types.static class
Type-
Enumeration of available window types. A window type defines the generic visual appearance and behavior of a top-level window. For example, the type may affect the kind of decorations of a decorated
Frame
orDialog
instance.Some platforms may not fully support a certain window type. Depending on the level of support, some properties of the window type may be disobeyed.
- Since:
- 1.7
- See Also:
Window.getType()
,Window.setType(java.awt.Window.Type)
-
-
Fields Modifier and Type Field and Description ABORT static int
ABORTThis flag in the infoflags argument to imageUpdate indicates that an image which was being tracked asynchronously was aborted before production was complete.public static final int ABORT-
This flag in the infoflags argument to imageUpdate indicates that an image which was being tracked asynchronously was aborted before production was complete. No more information will become available without further action to trigger another image production sequence. If the ERROR flag was not also set in this image update, then accessing any of the data in the image will restart the production again, probably from the beginning.
- See Also:
ImageObserver.imageUpdate(java.awt.Image, int, int, int, int, int)
, Constant Field Values
ALLBITS static int
ALLBITSThis flag in the infoflags argument to imageUpdate indicates that a static image which was previously drawn is now complete and can be drawn again in its final form.public static final int ALLBITS-
This flag in the infoflags argument to imageUpdate indicates that a static image which was previously drawn is now complete and can be drawn again in its final form. The x, y, width, and height arguments to the imageUpdate callback method should be ignored.
- See Also:
Graphics.drawImage(java.awt.Image, int, int, java.awt.image.ImageObserver)
,ImageObserver.imageUpdate(java.awt.Image, int, int, int, int, int)
, Constant Field Values
BOTTOM_ALIGNMENT static float
BOTTOM_ALIGNMENTEase-of-use constant forgetAlignmentY
.public static final float BOTTOM_ALIGNMENT-
Ease-of-use constant for
getAlignmentY
. Specifies an alignment to the bottom of the component.
CENTER_ALIGNMENT static float
CENTER_ALIGNMENTEase-of-use constant forgetAlignmentY
andgetAlignmentX
.public static final float CENTER_ALIGNMENT-
Ease-of-use constant for
getAlignmentY
andgetAlignmentX
. Specifies an alignment to the center of the component
DEFAULT_MODALITY_TYPE static Dialog.ModalityType
DEFAULT_MODALITY_TYPEDefault modality type for modal dialogs.public static final Dialog.ModalityType DEFAULT_MODALITY_TYPE-
Default modality type for modal dialogs. The default modality type is
APPLICATION_MODAL
. Calling the oldstylesetModal(true)
is equal tosetModalityType(DEFAULT_MODALITY_TYPE)
.- Since:
- 1.6
- See Also:
Dialog.ModalityType
,setModal(boolean)
ERROR static int
ERRORThis flag in the infoflags argument to imageUpdate indicates that an image which was being tracked asynchronously has encountered an error.public static final int ERROR-
This flag in the infoflags argument to imageUpdate indicates that an image which was being tracked asynchronously has encountered an error. No further information will become available and drawing the image will fail. As a convenience, the ABORT flag will be indicated at the same time to indicate that the image production was aborted.
- See Also:
ImageObserver.imageUpdate(java.awt.Image, int, int, int, int, int)
, Constant Field Values
FRAMEBITS static int
FRAMEBITSThis flag in the infoflags argument to imageUpdate indicates that another complete frame of a multi-frame image which was previously drawn is now available to be drawn again.public static final int FRAMEBITS-
This flag in the infoflags argument to imageUpdate indicates that another complete frame of a multi-frame image which was previously drawn is now available to be drawn again. The x, y, width, and height arguments to the imageUpdate callback method should be ignored.
- See Also:
Graphics.drawImage(java.awt.Image, int, int, java.awt.image.ImageObserver)
,ImageObserver.imageUpdate(java.awt.Image, int, int, int, int, int)
, Constant Field Values
HEIGHT static int
HEIGHTThis flag in the infoflags argument to imageUpdate indicates that the height of the base image is now available and can be taken from the height argument to the imageUpdate callback method.public static final int HEIGHT-
This flag in the infoflags argument to imageUpdate indicates that the height of the base image is now available and can be taken from the height argument to the imageUpdate callback method.
- See Also:
Image.getHeight(java.awt.image.ImageObserver)
,ImageObserver.imageUpdate(java.awt.Image, int, int, int, int, int)
, Constant Field Values
LEFT_ALIGNMENT static float
LEFT_ALIGNMENTEase-of-use constant forgetAlignmentX
.public static final float LEFT_ALIGNMENT-
Ease-of-use constant for
getAlignmentX
. Specifies an alignment to the left side of the component.
PROPERTIES static int
PROPERTIESThis flag in the infoflags argument to imageUpdate indicates that the properties of the image are now available.public static final int PROPERTIES-
This flag in the infoflags argument to imageUpdate indicates that the properties of the image are now available.
- See Also:
Image.getProperty(java.lang.String, java.awt.image.ImageObserver)
,ImageObserver.imageUpdate(java.awt.Image, int, int, int, int, int)
, Constant Field Values
RIGHT_ALIGNMENT static float
RIGHT_ALIGNMENTEase-of-use constant forgetAlignmentX
.public static final float RIGHT_ALIGNMENT-
Ease-of-use constant for
getAlignmentX
. Specifies an alignment to the right side of the component.
SOMEBITS static int
SOMEBITSThis flag in the infoflags argument to imageUpdate indicates that more pixels needed for drawing a scaled variation of the image are available.public static final int SOMEBITS-
This flag in the infoflags argument to imageUpdate indicates that more pixels needed for drawing a scaled variation of the image are available. The bounding box of the new pixels can be taken from the x, y, width, and height arguments to the imageUpdate callback method.
- See Also:
Graphics.drawImage(java.awt.Image, int, int, java.awt.image.ImageObserver)
,ImageObserver.imageUpdate(java.awt.Image, int, int, int, int, int)
, Constant Field Values
TOP_ALIGNMENT static float
TOP_ALIGNMENTEase-of-use constant forgetAlignmentY()
.public static final float TOP_ALIGNMENT-
Ease-of-use constant for
getAlignmentY()
. Specifies an alignment to the top of the component.
WIDTH static int
WIDTHThis flag in the infoflags argument to imageUpdate indicates that the width of the base image is now available and can be taken from the width argument to the imageUpdate callback method.public static final int WIDTH-
This flag in the infoflags argument to imageUpdate indicates that the width of the base image is now available and can be taken from the width argument to the imageUpdate callback method.
- See Also:
Image.getWidth(java.awt.image.ImageObserver)
,ImageObserver.imageUpdate(java.awt.Image, int, int, int, int, int)
, Constant Field Values
-
-
Static Methods Modifier and Type Static Method and Description getOwnerlessWindows static Window[]
getOwnerlessWindows()Returns an array of allWindow
s created by this application that have no owner.public static Window[] getOwnerlessWindows()-
Description copied from class:
Window
Returns an array of allWindow
s created by this application that have no owner. They includeFrame
s and ownerlessDialog
s andWindow
s. If called from an applet, the array includes only theWindow
s accessible by that applet.Warning: this method may return system created windows, such as a print dialog. Applications should not assume the existence of these dialogs, nor should an application assume anything about these dialogs such as component positions,
LayoutManager
s or serialization.- Since:
- 1.6
- See Also:
Frame.getFrames()
,Window.getWindows()
getWindows static Window[]
getWindows()Returns an array of allWindow
s, both owned and ownerless, created by this application.public static Window[] getWindows()-
Description copied from class:
Window
Returns an array of allWindow
s, both owned and ownerless, created by this application. If called from an applet, the array includes only theWindow
s accessible by that applet.Warning: this method may return system created windows, such as a print dialog. Applications should not assume the existence of these dialogs, nor should an application assume anything about these dialogs such as component positions,
LayoutManager
s or serialization.- Since:
- 1.6
- See Also:
Frame.getFrames()
,Window.getOwnerlessWindows()
-
-
Constructors Constructor and Description Dialog Dialog(Dialog owner)Constructs an initially invisible, modelessDialog
with the specified ownerDialog
and an empty title.public Dialog(Dialog owner)-
Constructs an initially invisible, modeless
Dialog
with the specified ownerDialog
and an empty title.- Parameters:
owner
- the owner of the dialog ornull
if this dialog has no owner- Throws:
java.lang.IllegalArgumentException
- if theowner
'sGraphicsConfiguration
is not from a screen deviceHeadlessException
- whenGraphicsEnvironment.isHeadless()
returnstrue
- Since:
- 1.2
- See Also:
GraphicsEnvironment.isHeadless()
Dialog Dialog(Dialog owner, java.lang.String title)Constructs an initially invisible, modelessDialog
with the specified ownerDialog
and title.public Dialog(Dialog owner, java.lang.String title)-
Constructs an initially invisible, modeless
Dialog
with the specified ownerDialog
and title.- Parameters:
owner
- the owner of the dialog ornull
if this has no ownertitle
- the title of the dialog ornull
if this dialog has no title- Throws:
java.lang.IllegalArgumentException
- if theowner
'sGraphicsConfiguration
is not from a screen deviceHeadlessException
- whenGraphicsEnvironment.isHeadless()
returnstrue
- Since:
- 1.2
- See Also:
GraphicsEnvironment.isHeadless()
Dialog Dialog(Dialog owner, java.lang.String title, boolean modal)Constructs an initially invisibleDialog
with the specified ownerDialog
, title, and modality.public Dialog(Dialog owner, java.lang.String title, boolean modal)-
Constructs an initially invisible
Dialog
with the specified ownerDialog
, title, and modality.- Parameters:
owner
- the owner of the dialog ornull
if this dialog has no ownertitle
- the title of the dialog ornull
if this dialog has no titlemodal
- specifes whether dialog blocks user input to other top-level windows when shown. Iffalse
, the dialog isMODELESS
; iftrue
, the modality type property is set toDEFAULT_MODALITY_TYPE
- Throws:
java.lang.IllegalArgumentException
- if theowner
'sGraphicsConfiguration
is not from a screen deviceHeadlessException
- whenGraphicsEnvironment.isHeadless()
returnstrue
- Since:
- 1.2
- See Also:
Dialog.ModalityType
,Dialog.ModalityType.MODELESS
,DEFAULT_MODALITY_TYPE
,setModal(boolean)
,setModalityType(java.awt.Dialog.ModalityType)
,GraphicsEnvironment.isHeadless()
Dialog Dialog(Dialog owner, java.lang.String title, boolean modal, GraphicsConfiguration gc)Constructs an initially invisibleDialog
with the specified ownerDialog
, title, modality andGraphicsConfiguration
.-
Constructs an initially invisible
Dialog
with the specified ownerDialog
, title, modality andGraphicsConfiguration
.- Parameters:
owner
- the owner of the dialog ornull
if this dialog has no ownertitle
- the title of the dialog ornull
if this dialog has no titlemodal
- specifes whether dialog blocks user input to other top-level windows when shown. Iffalse
, the dialog isMODELESS
; iftrue
, the modality type property is set toDEFAULT_MODALITY_TYPE
gc
- theGraphicsConfiguration
of the target screen device; ifnull
, the default systemGraphicsConfiguration
is assumed- Throws:
java.lang.IllegalArgumentException
- ifgc
is not from a screen deviceHeadlessException
- whenGraphicsEnvironment.isHeadless()
returnstrue
- Since:
- 1.4
- See Also:
Dialog.ModalityType
,Dialog.ModalityType.MODELESS
,DEFAULT_MODALITY_TYPE
,setModal(boolean)
,setModalityType(java.awt.Dialog.ModalityType)
,GraphicsEnvironment.isHeadless()
,Component.setSize(int, int)
,Component.setVisible(boolean)
Dialog Dialog(Frame owner)Constructs an initially invisible, modelessDialog
with the specified ownerFrame
and an empty title.public Dialog(Frame owner)-
Constructs an initially invisible, modeless
Dialog
with the specified ownerFrame
and an empty title.- Parameters:
owner
- the owner of the dialog ornull
if this dialog has no owner- Throws:
java.lang.IllegalArgumentException
- if theowner
'sGraphicsConfiguration
is not from a screen deviceHeadlessException
- whenGraphicsEnvironment.isHeadless()
returnstrue
- See Also:
GraphicsEnvironment.isHeadless()
,Component.setSize(int, int)
,Component.setVisible(boolean)
Dialog Dialog(Frame owner, boolean modal)Constructs an initially invisibleDialog
with the specified ownerFrame
and modality and an empty title.public Dialog(Frame owner, boolean modal)-
Constructs an initially invisible
Dialog
with the specified ownerFrame
and modality and an empty title.- Parameters:
owner
- the owner of the dialog ornull
if this dialog has no ownermodal
- specifes whether dialog blocks user input to other top-level windows when shown. Iffalse
, the dialog isMODELESS
; iftrue
, the modality type property is set toDEFAULT_MODALITY_TYPE
- Throws:
java.lang.IllegalArgumentException
- if theowner
'sGraphicsConfiguration
is not from a screen deviceHeadlessException
- whenGraphicsEnvironment.isHeadless()
returnstrue
- See Also:
Dialog.ModalityType
,Dialog.ModalityType.MODELESS
,DEFAULT_MODALITY_TYPE
,setModal(boolean)
,setModalityType(java.awt.Dialog.ModalityType)
,GraphicsEnvironment.isHeadless()
Dialog Dialog(Frame owner, java.lang.String title)Constructs an initially invisible, modelessDialog
with the specified ownerFrame
and title.public Dialog(Frame owner, java.lang.String title)-
Constructs an initially invisible, modeless
Dialog
with the specified ownerFrame
and title.- Parameters:
owner
- the owner of the dialog ornull
if this dialog has no ownertitle
- the title of the dialog ornull
if this dialog has no title- Throws:
java.lang.IllegalArgumentException
- if theowner
'sGraphicsConfiguration
is not from a screen deviceHeadlessException
- whenGraphicsEnvironment.isHeadless()
returnstrue
- See Also:
GraphicsEnvironment.isHeadless()
,Component.setSize(int, int)
,Component.setVisible(boolean)
Dialog Dialog(Frame owner, java.lang.String title, boolean modal)Constructs an initially invisibleDialog
with the specified ownerFrame
, title and modality.public Dialog(Frame owner, java.lang.String title, boolean modal)-
Constructs an initially invisible
Dialog
with the specified ownerFrame
, title and modality.- Parameters:
owner
- the owner of the dialog ornull
if this dialog has no ownertitle
- the title of the dialog ornull
if this dialog has no titlemodal
- specifes whether dialog blocks user input to other top-level windows when shown. Iffalse
, the dialog isMODELESS
; iftrue
, the modality type property is set toDEFAULT_MODALITY_TYPE
- Throws:
java.lang.IllegalArgumentException
- if theowner
'sGraphicsConfiguration
is not from a screen deviceHeadlessException
- whenGraphicsEnvironment.isHeadless()
returnstrue
- See Also:
Dialog.ModalityType
,Dialog.ModalityType.MODELESS
,DEFAULT_MODALITY_TYPE
,setModal(boolean)
,setModalityType(java.awt.Dialog.ModalityType)
,GraphicsEnvironment.isHeadless()
,Component.setSize(int, int)
,Component.setVisible(boolean)
Dialog Dialog(Frame owner, java.lang.String title, boolean modal, GraphicsConfiguration gc)Constructs an initially invisibleDialog
with the specified ownerFrame
, title, modality, andGraphicsConfiguration
.-
Constructs an initially invisible
Dialog
with the specified ownerFrame
, title, modality, andGraphicsConfiguration
.- Parameters:
owner
- the owner of the dialog ornull
if this dialog has no ownertitle
- the title of the dialog ornull
if this dialog has no titlemodal
- specifes whether dialog blocks user input to other top-level windows when shown. Iffalse
, the dialog isMODELESS
; iftrue
, the modality type property is set toDEFAULT_MODALITY_TYPE
gc
- theGraphicsConfiguration
of the target screen device; ifnull
, the default systemGraphicsConfiguration
is assumed- Throws:
java.lang.IllegalArgumentException
- ifgc
is not from a screen deviceHeadlessException
- whenGraphicsEnvironment.isHeadless()
returnstrue
- Since:
- 1.4
- See Also:
Dialog.ModalityType
,Dialog.ModalityType.MODELESS
,DEFAULT_MODALITY_TYPE
,setModal(boolean)
,setModalityType(java.awt.Dialog.ModalityType)
,GraphicsEnvironment.isHeadless()
,Component.setSize(int, int)
,Component.setVisible(boolean)
Dialog Dialog(Window owner)Constructs an initially invisible, modelessDialog
with the specified ownerWindow
and an empty title.public Dialog(Window owner)-
Constructs an initially invisible, modeless
Dialog
with the specified ownerWindow
and an empty title.- Parameters:
owner
- the owner of the dialog. The owner must be an instance ofDialog
,Frame
, any of their descendents ornull
- Throws:
java.lang.IllegalArgumentException
- if theowner
is not an instance ofDialog
orFrame
java.lang.IllegalArgumentException
- if theowner
'sGraphicsConfiguration
is not from a screen deviceHeadlessException
- whenGraphicsEnvironment.isHeadless()
returnstrue
- Since:
- 1.6
- See Also:
GraphicsEnvironment.isHeadless()
Dialog Dialog(Window owner, Dialog.ModalityType modalityType)Constructs an initially invisibleDialog
with the specified ownerWindow
and modality and an empty title.-
Constructs an initially invisible
Dialog
with the specified ownerWindow
and modality and an empty title.- Parameters:
owner
- the owner of the dialog. The owner must be an instance ofDialog
,Frame
, any of their descendents ornull
modalityType
- specifies whether dialog blocks input to other windows when shown.null
value and unsupported modality types are equivalent toMODELESS
- Throws:
java.lang.IllegalArgumentException
- if theowner
is not an instance ofDialog
orFrame
java.lang.IllegalArgumentException
- if theowner
'sGraphicsConfiguration
is not from a screen deviceHeadlessException
- whenGraphicsEnvironment.isHeadless()
returnstrue
java.lang.SecurityException
- if the calling thread does not have permission to create modal dialogs with the givenmodalityType
- Since:
- 1.6
- See Also:
Dialog.ModalityType
,setModal(boolean)
,setModalityType(java.awt.Dialog.ModalityType)
,GraphicsEnvironment.isHeadless()
,Toolkit.isModalityTypeSupported(java.awt.Dialog.ModalityType)
Dialog Dialog(Window owner, java.lang.String title)Constructs an initially invisible, modelessDialog
with the specified ownerWindow
and title.public Dialog(Window owner, java.lang.String title)-
Constructs an initially invisible, modeless
Dialog
with the specified ownerWindow
and title.- Parameters:
owner
- the owner of the dialog. The owner must be an instance ofDialog
,Frame
, any of their descendents ornull
title
- the title of the dialog ornull
if this dialog has no title- Throws:
java.lang.IllegalArgumentException
- if theowner
is not an instance ofDialog
orFrame
java.lang.IllegalArgumentException
- if theowner
'sGraphicsConfiguration
is not from a screen deviceHeadlessException
- whenGraphicsEnvironment.isHeadless()
returnstrue
- Since:
- 1.6
- See Also:
GraphicsEnvironment.isHeadless()
Dialog Dialog(Window owner, java.lang.String title, Dialog.ModalityType modalityType)Constructs an initially invisibleDialog
with the specified ownerWindow
, title and modality.-
Constructs an initially invisible
Dialog
with the specified ownerWindow
, title and modality.- Parameters:
owner
- the owner of the dialog. The owner must be an instance ofDialog
,Frame
, any of their descendents ornull
title
- the title of the dialog ornull
if this dialog has no titlemodalityType
- specifies whether dialog blocks input to other windows when shown.null
value and unsupported modality types are equivalent toMODELESS
- Throws:
java.lang.IllegalArgumentException
- if theowner
is not an instance ofDialog
orFrame
java.lang.IllegalArgumentException
- if theowner
'sGraphicsConfiguration
is not from a screen deviceHeadlessException
- whenGraphicsEnvironment.isHeadless()
returnstrue
java.lang.SecurityException
- if the calling thread does not have permission to create modal dialogs with the givenmodalityType
- Since:
- 1.6
- See Also:
Dialog.ModalityType
,setModal(boolean)
,setModalityType(java.awt.Dialog.ModalityType)
,GraphicsEnvironment.isHeadless()
,Toolkit.isModalityTypeSupported(java.awt.Dialog.ModalityType)
Dialog Dialog(Window owner, java.lang.String title, Dialog.ModalityType modalityType, GraphicsConfiguration gc)Constructs an initially invisibleDialog
with the specified ownerWindow
, title, modality andGraphicsConfiguration
.public Dialog(Window owner, java.lang.String title, Dialog.ModalityType modalityType, GraphicsConfiguration gc)-
Constructs an initially invisible
Dialog
with the specified ownerWindow
, title, modality andGraphicsConfiguration
.- Parameters:
owner
- the owner of the dialog. The owner must be an instance ofDialog
,Frame
, any of their descendents ornull
title
- the title of the dialog ornull
if this dialog has no titlemodalityType
- specifies whether dialog blocks input to other windows when shown.null
value and unsupported modality types are equivalent toMODELESS
gc
- theGraphicsConfiguration
of the target screen device; ifnull
, the default systemGraphicsConfiguration
is assumed- Throws:
java.lang.IllegalArgumentException
- if theowner
is not an instance ofDialog
orFrame
java.lang.IllegalArgumentException
- ifgc
is not from a screen deviceHeadlessException
- whenGraphicsEnvironment.isHeadless()
returnstrue
java.lang.SecurityException
- if the calling thread does not have permission to create modal dialogs with the givenmodalityType
- Since:
- 1.6
- See Also:
Dialog.ModalityType
,setModal(boolean)
,setModalityType(java.awt.Dialog.ModalityType)
,GraphicsEnvironment.isHeadless()
,Toolkit.isModalityTypeSupported(java.awt.Dialog.ModalityType)
-
-
-
Basic Attribute Methods Modifier and Type Method and Description applyComponentOrientation void
applyComponentOrientation(ComponentOrientation o)Sets theComponentOrientation
property of this container and all components contained within it.public void applyComponentOrientation(ComponentOrientation o)-
Description copied from class:
Container
Sets theComponentOrientation
property of this container and all components contained within it.This method changes layout-related information, and therefore, invalidates the component hierarchy.
- Overrides:
applyComponentOrientation
in classComponent
- Parameters:
o
- the new component orientation of this container and the components contained within it.- Throws:
java.lang.NullPointerException
- iforientation
is null.- Since:
- 1.4
- See Also:
Component.setComponentOrientation(java.awt.ComponentOrientation)
,Component.getComponentOrientation()
,Container.invalidate()
disable void
disable()Deprecated. As of JDK version 1.1, replaced bysetEnabled(boolean)
.@Deprecated public void disable()Deprecated. As of JDK version 1.1, replaced bysetEnabled(boolean)
.enable void
enable()Deprecated. As of JDK version 1.1, replaced bysetEnabled(boolean)
.@Deprecated public void enable()Deprecated. As of JDK version 1.1, replaced bysetEnabled(boolean)
.enable void
enable(boolean b)Deprecated. As of JDK version 1.1, replaced bysetEnabled(boolean)
.@Deprecated public void enable(boolean b)Deprecated. As of JDK version 1.1, replaced bysetEnabled(boolean)
.enableInputMethods void
enableInputMethods(boolean enable)Enables or disables input method support for this component.public void enableInputMethods(boolean enable)-
Description copied from class:
Component
Enables or disables input method support for this component. If input method support is enabled and the component also processes key events, incoming events are offered to the current input method and will only be processed by the component or dispatched to its listeners if the input method does not consume them. By default, input method support is enabled.- Parameters:
enable
- true to enable, false to disable- Since:
- 1.2
- See Also:
Component.processKeyEvent(java.awt.event.KeyEvent)
getAccessibleContext javax.accessibility.AccessibleContext
getAccessibleContext()Gets the AccessibleContext associated with this Dialog.public javax.accessibility.AccessibleContext getAccessibleContext()-
Gets the AccessibleContext associated with this Dialog. For dialogs, the AccessibleContext takes the form of an AccessibleAWTDialog. A new AccessibleAWTDialog instance is created if necessary.
- Specified by:
getAccessibleContext
in interfacejavax.accessibility.Accessible
- Overrides:
getAccessibleContext
in classWindow
- Returns:
- an AccessibleAWTDialog that serves as the AccessibleContext of this Dialog
- Since:
- 1.3
getBackground Color
getBackground()Gets the background color of this window.public Color getBackground()-
Description copied from class:
Window
Gets the background color of this window.Note that the alpha component of the returned color indicates whether the window is in the non-opaque (per-pixel translucent) mode.
- Overrides:
getBackground
in classComponent
- Returns:
- this component's background color
- See Also:
Window.setBackground(Color)
,Window.isOpaque()
,GraphicsDevice.WindowTranslucency
getColorModel java.awt.image.ColorModel
getColorModel()Gets the instance ofColorModel
used to display the component on the output device.public java.awt.image.ColorModel getColorModel()-
Description copied from class:
Component
Gets the instance ofColorModel
used to display the component on the output device.- Returns:
- the color model used by this component
- Since:
- JDK1.0
- See Also:
ColorModel
,ComponentPeer.getColorModel()
,Toolkit.getColorModel()
getComponentOrientation ComponentOrientation
getComponentOrientation()Retrieves the language-sensitive orientation that is to be used to order the elements or text within this component.public ComponentOrientation getComponentOrientation()-
Description copied from class:
Component
Retrieves the language-sensitive orientation that is to be used to order the elements or text within this component.LayoutManager
andComponent
subclasses that wish to respect orientation should call this method to get the component's orientation before performing layout or drawing.- See Also:
ComponentOrientation
getCursor Cursor
getCursor()Gets the cursor set in the component.public Cursor getCursor()-
Description copied from class:
Component
Gets the cursor set in the component. If the component does not have a cursor set, the cursor of its parent is returned. If no cursor is set in the entire hierarchy,Cursor.DEFAULT_CURSOR
is returned.- Since:
- JDK1.1
- See Also:
Component.setCursor(java.awt.Cursor)
getFont Font
getFont()Gets the font of this component.public Font getFont()-
Description copied from class:
Component
Gets the font of this component.- Specified by:
getFont
in interfaceMenuContainer
- Returns:
- this component's font; if a font has not been set for this component, the font of its parent is returned
- Since:
- JDK1.0
- See Also:
Component.setFont(java.awt.Font)
getForeground Color
getForeground()Gets the foreground color of this component.public Color getForeground()-
Description copied from class:
Component
Gets the foreground color of this component.- Returns:
- this component's foreground color; if this component does not have a foreground color, the foreground color of its parent is returned
- Since:
- JDK1.0
- See Also:
Component.setForeground(java.awt.Color)
getLocale java.util.Locale
getLocale()Gets theLocale
object that is associated with this window, if the locale has been set.public java.util.Locale getLocale()-
Description copied from class:
Window
Gets theLocale
object that is associated with this window, if the locale has been set. If no locale has been set, then the default locale is returned.
getName java.lang.String
getName()Gets the name of the component.public java.lang.String getName()-
Description copied from class:
Component
Gets the name of the component.- Returns:
- this component's name
- Since:
- JDK1.1
- See Also:
Component.setName(java.lang.String)
getParent Container
getParent()Gets the parent of this component.hide void
hide()Deprecated. As of JDK version 1.5, replaced bysetVisible(boolean)
.@Deprecated public void hide()Deprecated. As of JDK version 1.5, replaced bysetVisible(boolean)
.-
Hides the Dialog and then causes
show
to return if it is currently blocked.- Overrides:
hide
in classWindow
- See Also:
Window.show()
,Window.dispose()
,Window.setVisible(boolean)
isBackgroundSet boolean
isBackgroundSet()Returns whether the background color has been explicitly set for this Component.public boolean isBackgroundSet()-
Description copied from class:
Component
Returns whether the background color has been explicitly set for this Component. If this method returnsfalse
, this Component is inheriting its background color from an ancestor.- Returns:
true
if the background color has been explicitly set for this Component;false
otherwise.- Since:
- 1.4
isCursorSet boolean
isCursorSet()Returns whether the cursor has been explicitly set for this Component.public boolean isCursorSet()-
Description copied from class:
Component
Returns whether the cursor has been explicitly set for this Component. If this method returnsfalse
, this Component is inheriting its cursor from an ancestor.- Returns:
true
if the cursor has been explicitly set for this Component;false
otherwise.- Since:
- 1.4
isDisplayable boolean
isDisplayable()Determines whether this component is displayable.public boolean isDisplayable()-
Description copied from class:
Component
Determines whether this component is displayable. A component is displayable when it is connected to a native screen resource.A component is made displayable either when it is added to a displayable containment hierarchy or when its containment hierarchy is made displayable. A containment hierarchy is made displayable when its ancestor window is either packed or made visible.
A component is made undisplayable either when it is removed from a displayable containment hierarchy or when its containment hierarchy is made undisplayable. A containment hierarchy is made undisplayable when its ancestor window is disposed.
- Returns:
true
if the component is displayable,false
otherwise- Since:
- 1.2
- See Also:
Container.add(Component)
,Window.pack()
,Window.show()
,Container.remove(Component)
,Window.dispose()
isDoubleBuffered boolean
isDoubleBuffered()Returns true if this component is painted to an offscreen image ("buffer") that's copied to the screen later.public boolean isDoubleBuffered()-
Description copied from class:
Component
Returns true if this component is painted to an offscreen image ("buffer") that's copied to the screen later. Component subclasses that support double buffering should override this method to return true if double buffering is enabled.- Returns:
- false by default
isEnabled boolean
isEnabled()Determines whether this component is enabled.public boolean isEnabled()-
Description copied from class:
Component
Determines whether this component is enabled. An enabled component can respond to user input and generate events. Components are enabled initially by default. A component may be enabled or disabled by calling itssetEnabled
method.- Returns:
true
if the component is enabled,false
otherwise- Since:
- JDK1.0
- See Also:
Component.setEnabled(boolean)
isFontSet boolean
isFontSet()Returns whether the font has been explicitly set for this Component.public boolean isFontSet()-
Description copied from class:
Component
Returns whether the font has been explicitly set for this Component. If this method returnsfalse
, this Component is inheriting its font from an ancestor.- Returns:
true
if the font has been explicitly set for this Component;false
otherwise.- Since:
- 1.4
isForegroundSet boolean
isForegroundSet()Returns whether the foreground color has been explicitly set for this Component.public boolean isForegroundSet()-
Description copied from class:
Component
Returns whether the foreground color has been explicitly set for this Component. If this method returnsfalse
, this Component is inheriting its foreground color from an ancestor.- Returns:
true
if the foreground color has been explicitly set for this Component;false
otherwise.- Since:
- 1.4
isLightweight boolean
isLightweight()A lightweight component doesn't have a native toolkit peer.public boolean isLightweight()-
Description copied from class:
Component
A lightweight component doesn't have a native toolkit peer. Subclasses ofComponent
andContainer
, other than the ones defined in this package likeButton
orScrollbar
, are lightweight. All of the Swing components are lightweights.This method will always return
false
if this component is not displayable because it is impossible to determine the weight of an undisplayable component.- Returns:
- true if this component has a lightweight peer; false if it has a native peer or no peer
- Since:
- 1.2
- See Also:
Component.isDisplayable()
isOpaque boolean
isOpaque()Indicates if the window is currently opaque.public boolean isOpaque()-
Description copied from class:
Window
Indicates if the window is currently opaque.The method returns
false
if the background color of the window is notnull
and the alpha component of the color is less than1.0f
. The method returnstrue
otherwise.- Overrides:
isOpaque
in classComponent
- Returns:
true
if the window is opaque,false
otherwise- Since:
- 1.7
- See Also:
Window.getBackground()
,Window.setBackground(Color)
isShowing boolean
isShowing()Checks if this Window is showing on screen.public boolean isShowing()-
Description copied from class:
Window
Checks if this Window is showing on screen.- Overrides:
isShowing
in classComponent
- Returns:
true
if the component is showing,false
otherwise- See Also:
Component.setVisible(boolean)
isVisible boolean
isVisible()Determines whether this component should be visible when its parent is visible.public boolean isVisible()-
Description copied from class:
Component
Determines whether this component should be visible when its parent is visible. Components are initially visible, with the exception of top level components such asFrame
objects.- Returns:
true
if the component is visible,false
otherwise- Since:
- JDK1.0
- See Also:
Component.setVisible(boolean)
setBackground void
setBackground(Color bgColor)Sets the background color of this window.public void setBackground(Color bgColor)-
Sets the background color of this window.
If the windowing system supports the
PERPIXEL_TRANSLUCENT
tranclucency, the alpha component of the given background color may effect the mode of operation for this window: it indicates whether this window must be opaque (alpha equals1.0f
) or per-pixel translucent (alpha is less than1.0f
). If the given background color isnull
, the window is considered completely opaque.All the following conditions must be met to enable the per-pixel transparency mode for this window:
- The
PERPIXEL_TRANSLUCENT
translucency must be supported by the graphics device where this window is located - The window must be undecorated (see
Frame.setUndecorated(boolean)
andsetUndecorated(boolean)
) - The window must not be in full-screen mode (see
GraphicsDevice.setFullScreenWindow(Window)
)
If the alpha component of the requested background color is less than
1.0f
, and any of the above conditions are not met, the background color of this window will not change, the alpha component of the given background color will not affect the mode of operation for this window, and either theUnsupportedOperationException
orIllegalComponentStateException
will be thrown.When the window is per-pixel translucent, the drawing sub-system respects the alpha value of each individual pixel. If a pixel gets painted with the alpha color component equal to zero, it becomes visually transparent. If the alpha of the pixel is equal to 1.0f, the pixel is fully opaque. Interim values of the alpha color component make the pixel semi-transparent. In this mode, the background of the window gets painted with the alpha value of the given background color. If the alpha value of the argument of this method is equal to
0
, the background is not painted at all.The actual level of translucency of a given pixel also depends on window opacity (see
Window.setOpacity(float)
), as well as the current shape of this window (seeWindow.setShape(Shape)
).Note that painting a pixel with the alpha value of
0
may or may not disable the mouse event handling on this pixel. This is a platform-dependent behavior. To make sure the mouse events do not get dispatched to a particular pixel, the pixel must be excluded from the shape of the window.Enabling the per-pixel translucency mode may change the graphics configuration of this window due to the native platform requirements.
- Overrides:
setBackground
in classWindow
- Parameters:
bgColor
- the color to become this window's background color.- See Also:
Window.getBackground()
,Window.isOpaque()
,Window.setOpacity(float)
,Window.setShape(Shape)
,Frame.isUndecorated()
,isUndecorated()
,GraphicsDevice.WindowTranslucency
,GraphicsDevice.isWindowTranslucencySupported(GraphicsDevice.WindowTranslucency)
,GraphicsConfiguration.isTranslucencyCapable()
- The
setComponentOrientation void
setComponentOrientation(ComponentOrientation o)Sets the language-sensitive orientation that is to be used to order the elements or text within this component.public void setComponentOrientation(ComponentOrientation o)-
Description copied from class:
Component
Sets the language-sensitive orientation that is to be used to order the elements or text within this component. Language-sensitiveLayoutManager
andComponent
subclasses will use this property to determine how to lay out and draw components.At construction time, a component's orientation is set to
ComponentOrientation.UNKNOWN
, indicating that it has not been specified explicitly. The UNKNOWN orientation behaves the same asComponentOrientation.LEFT_TO_RIGHT
.To set the orientation of a single component, use this method. To set the orientation of an entire component hierarchy, use
applyComponentOrientation
.This method changes layout-related information, and therefore, invalidates the component hierarchy.
- See Also:
ComponentOrientation
,Component.invalidate()
setCursor void
setCursor(Cursor cursor)Set the cursor image to a specified cursor.public void setCursor(Cursor cursor)-
Description copied from class:
Window
Set the cursor image to a specified cursor.The method may have no visual effect if the Java platform implementation and/or the native system do not support changing the mouse cursor shape.
- Overrides:
setCursor
in classComponent
- Parameters:
cursor
- One of the constants defined by theCursor
class. If this parameter is null then the cursor for this window will be set to the type Cursor.DEFAULT_CURSOR.- Since:
- JDK1.1
- See Also:
Component.getCursor()
,Cursor
setEnabled void
setEnabled(boolean b)Enables or disables this component, depending on the value of the parameterb
.public void setEnabled(boolean b)-
Description copied from class:
Component
Enables or disables this component, depending on the value of the parameterb
. An enabled component can respond to user input and generate events. Components are enabled initially by default.Note: Disabling a lightweight component does not prevent it from receiving MouseEvents.
Note: Disabling a heavyweight container prevents all components in this container from receiving any input events. But disabling a lightweight container affects only this container.
- Parameters:
b
- Iftrue
, this component is enabled; otherwise this component is disabled- Since:
- JDK1.1
- See Also:
Component.isEnabled()
,Component.isLightweight()
setFont void
setFont(Font f)Sets the font of this container.public void setFont(Font f)-
Description copied from class:
Container
Sets the font of this container.This method changes layout-related information, and therefore, invalidates the component hierarchy.
- Overrides:
setFont
in classComponent
- Parameters:
f
- The font to become this container's font.- Since:
- JDK1.0
- See Also:
Component.getFont()
,Container.invalidate()
setForeground void
setForeground(Color c)Sets the foreground color of this component.public void setForeground(Color c)-
Description copied from class:
Component
Sets the foreground color of this component.- Parameters:
c
- the color to become this component's foreground color; if this parameter isnull
then this component will inherit the foreground color of its parent- Since:
- JDK1.0
- See Also:
Component.getForeground()
setLocale void
setLocale(java.util.Locale l)Sets the locale of this component.public void setLocale(java.util.Locale l)-
Description copied from class:
Component
Sets the locale of this component. This is a bound property.This method changes layout-related information, and therefore, invalidates the component hierarchy.
- Parameters:
l
- the locale to become this component's locale- Since:
- JDK1.1
- See Also:
Component.getLocale()
,Component.invalidate()
setName void
setName(java.lang.String name)Sets the name of the component to the specified string.public void setName(java.lang.String name)-
Description copied from class:
Component
Sets the name of the component to the specified string.- Parameters:
name
- the string that is to be this component's name- Since:
- JDK1.1
- See Also:
Component.getName()
setVisible void
setVisible(boolean b)Shows or hides thisDialog
depending on the value of parameterb
.public void setVisible(boolean b)-
Shows or hides this
Dialog
depending on the value of parameterb
.- Overrides:
setVisible
in classWindow
- Parameters:
b
- iftrue
, makes theDialog
visible, otherwise hides theDialog
. 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. Iffalse
, hides theDialog
and then causessetVisible(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 callingsetVisible(false)
ordispose
.setVisible(false)
: Hides the dialog and then returns onsetVisible(true)
if it is currently blocked.- It is OK to call this method from the event dispatching thread because the toolkit ensures that other events are not blocked while this method is blocked.
- See Also:
Window.setVisible(boolean)
,Window.dispose()
,Component.isDisplayable()
,Component.validate()
,isModal()
show void
show()Deprecated. As of JDK version 1.5, replaced bysetVisible(boolean)
.@Deprecated public void show()Deprecated. As of JDK version 1.5, replaced bysetVisible(boolean)
.-
Makes the
Dialog
visible. 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 the dialog is already visible, this will bring the dialog to the front.If the dialog is modal and is not already visible, this call will not return 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 event pump runs while the one which invoked this method is blocked.
- Overrides:
show
in classWindow
- See Also:
Component.hide()
,Component.isDisplayable()
,Component.validate()
,isModal()
,Window.setVisible(boolean)
show void
show(boolean b)Deprecated. As of JDK version 1.1, replaced bysetVisible(boolean)
.@Deprecated public void show(boolean b)Deprecated. As of JDK version 1.1, replaced bysetVisible(boolean)
. -
-
Event Support Methods Modifier and Type Method and Description action boolean
action(Event evt, java.lang.Object what)Deprecated. As of JDK version 1.1, should register this component as ActionListener on component which fires action events.Deprecated. As of JDK version 1.1, should register this component as ActionListener on component which fires action events.coalesceEvents protected AWTEvent
coalesceEvents(AWTEvent existingEvent, AWTEvent newEvent)Potentially coalesce an event being posted with an existing event.-
Description copied from class:
Component
Potentially coalesce an event being posted with an existing event. This method is called byEventQueue.postEvent
if an event with the same ID as the event to be posted is found in the queue (both events must have this component as their source). This method either returns a coalesced event which replaces the existing event (and the new event is then discarded), ornull
to indicate that no combining should be done (add the second event to the end of the queue). Either event parameter may be modified and returned, as the other one is discarded unlessnull
is returned.This implementation of
coalesceEvents
coalesces two event types: mouse move (and drag) events, and paint (and update) events. For mouse move events the last event is always returned, causing intermediate moves to be discarded. For paint events, the new event is coalesced into a complexRepaintArea
in the peer. The newAWTEvent
is always returned.- Parameters:
existingEvent
- the event already on theEventQueue
newEvent
- the event being posted to theEventQueue
- Returns:
- a coalesced event, or
null
indicating that no coalescing was done
deliverEvent void
deliverEvent(Event e)Deprecated. As of JDK version 1.1, replaced bydispatchEvent(AWTEvent e)
Deprecated. As of JDK version 1.1, replaced bydispatchEvent(AWTEvent e)
disableEvents protected void
disableEvents(long eventsToDisable)Disables the events defined by the specified event mask parameter from being delivered to this component.protected final void disableEvents(long eventsToDisable)-
Description copied from class:
Component
Disables the events defined by the specified event mask parameter from being delivered to this component.- Parameters:
eventsToDisable
- the event mask defining the event types- Since:
- JDK1.1
- See Also:
Component.enableEvents(long)
dispatchEvent void
dispatchEvent(AWTEvent e)Dispatches an event to this component or one of its sub components.enableEvents protected void
enableEvents(long eventsToEnable)Enables the events defined by the specified event mask parameter to be delivered to this component.protected final void enableEvents(long eventsToEnable)-
Description copied from class:
Component
Enables the events defined by the specified event mask parameter to be delivered to this component.Event types are automatically enabled when a listener for that event type is added to the component.
This method only needs to be invoked by subclasses of
Component
which desire to have the specified event types delivered toprocessEvent
regardless of whether or not a listener is registered.- Parameters:
eventsToEnable
- the event mask defining the event types- Since:
- JDK1.1
- See Also:
Component.processEvent(java.awt.AWTEvent)
,Component.disableEvents(long)
,AWTEvent
firePropertyChange protected void
firePropertyChange(java.lang.String propertyName, boolean oldValue, boolean newValue)Support for reporting bound property changes for boolean properties.protected void firePropertyChange(java.lang.String propertyName, boolean oldValue, boolean newValue)-
Description copied from class:
Component
Support for reporting bound property changes for boolean properties. This method can be called when a bound property has changed and it will send the appropriate PropertyChangeEvent to any registered PropertyChangeListeners.- Parameters:
propertyName
- the property whose value has changedoldValue
- the property's previous valuenewValue
- the property's new value- Since:
- 1.4
firePropertyChange void
firePropertyChange(java.lang.String propertyName, byte oldValue, byte newValue)Reports a bound property change.public void firePropertyChange(java.lang.String propertyName, byte oldValue, byte newValue)-
Description copied from class:
Component
Reports a bound property change.- Parameters:
propertyName
- the programmatic name of the property that was changedoldValue
- the old value of the property (as a byte)newValue
- the new value of the property (as a byte)- Since:
- 1.5
- See Also:
Component.firePropertyChange(java.lang.String, java.lang.Object, java.lang.Object)
firePropertyChange void
firePropertyChange(java.lang.String propertyName, char oldValue, char newValue)Reports a bound property change.public void firePropertyChange(java.lang.String propertyName, char oldValue, char newValue)-
Description copied from class:
Component
Reports a bound property change.- Parameters:
propertyName
- the programmatic name of the property that was changedoldValue
- the old value of the property (as a char)newValue
- the new value of the property (as a char)- Since:
- 1.5
- See Also:
Component.firePropertyChange(java.lang.String, java.lang.Object, java.lang.Object)
firePropertyChange void
firePropertyChange(java.lang.String propertyName, double oldValue, double newValue)Reports a bound property change.public void firePropertyChange(java.lang.String propertyName, double oldValue, double newValue)-
Description copied from class:
Component
Reports a bound property change.- Parameters:
propertyName
- the programmatic name of the property that was changedoldValue
- the old value of the property (as a double)newValue
- the new value of the property (as a double)- Since:
- 1.5
- See Also:
Component.firePropertyChange(java.lang.String, java.lang.Object, java.lang.Object)
firePropertyChange void
firePropertyChange(java.lang.String propertyName, float oldValue, float newValue)Reports a bound property change.public void firePropertyChange(java.lang.String propertyName, float oldValue, float newValue)-
Description copied from class:
Component
Reports a bound property change.- Parameters:
propertyName
- the programmatic name of the property that was changedoldValue
- the old value of the property (as a float)newValue
- the new value of the property (as a float)- Since:
- 1.5
- See Also:
Component.firePropertyChange(java.lang.String, java.lang.Object, java.lang.Object)
firePropertyChange protected void
firePropertyChange(java.lang.String propertyName, int oldValue, int newValue)Support for reporting bound property changes for integer properties.protected void firePropertyChange(java.lang.String propertyName, int oldValue, int newValue)-
Description copied from class:
Component
Support for reporting bound property changes for integer properties. This method can be called when a bound property has changed and it will send the appropriate PropertyChangeEvent to any registered PropertyChangeListeners.- Parameters:
propertyName
- the property whose value has changedoldValue
- the property's previous valuenewValue
- the property's new value- Since:
- 1.4
firePropertyChange void
firePropertyChange(java.lang.String propertyName, long oldValue, long newValue)Reports a bound property change.public void firePropertyChange(java.lang.String propertyName, long oldValue, long newValue)-
Description copied from class:
Component
Reports a bound property change.- Parameters:
propertyName
- the programmatic name of the property that was changedoldValue
- the old value of the property (as a long)newValue
- the new value of the property (as a long)- Since:
- 1.5
- See Also:
Component.firePropertyChange(java.lang.String, java.lang.Object, java.lang.Object)
firePropertyChange protected void
firePropertyChange(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)Support for reporting bound property changes for Object properties.protected void firePropertyChange(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)-
Description copied from class:
Component
Support for reporting bound property changes for Object properties. This method can be called when a bound property has changed and it will send the appropriate PropertyChangeEvent to any registered PropertyChangeListeners.- Parameters:
propertyName
- the property whose value has changedoldValue
- the property's previous valuenewValue
- the property's new value
firePropertyChange void
firePropertyChange(java.lang.String propertyName, short oldValue, short newValue)Reports a bound property change.public void firePropertyChange(java.lang.String propertyName, short oldValue, short newValue)-
Description copied from class:
Component
Reports a bound property change.- Parameters:
propertyName
- the programmatic name of the property that was changedoldValue
- the old value of the property (as a short)newValue
- the old value of the property (as a short)- Since:
- 1.5
- See Also:
Component.firePropertyChange(java.lang.String, java.lang.Object, java.lang.Object)
getListeners <T extends java.util.EventListener> T[]
getListeners(java.lang.Class<T> listenerType)Returns an array of all the objects currently registered asFooListener
s upon thisWindow
.public <T extends java.util.EventListener> T[] getListeners(java.lang.Class<T> listenerType)-
Description copied from class:
Window
Returns an array of all the objects currently registered asFooListener
s upon thisWindow
.FooListener
s are registered using theaddFooListener
method.You can specify the
listenerType
argument with a class literal, such asFooListener.class
. For example, you can query aWindow
w
for its window listeners with the following code:WindowListener[] wls = (WindowListener[])(w.getListeners(WindowListener.class));
If no such listeners exist, this method returns an empty array.- Overrides:
getListeners
in classContainer
- Parameters:
listenerType
- the type of listeners requested; this parameter should specify an interface that descends fromjava.util.EventListener
- Returns:
- an array of all objects registered as
FooListener
s on this window, or an empty array if no such listeners have been added - Throws:
java.lang.ClassCastException
- iflistenerType
doesn't specify a class or interface that implementsjava.util.EventListener
java.lang.NullPointerException
- iflistenerType
isnull
- Since:
- 1.3
- See Also:
Window.getWindowListeners()
handleEvent boolean
handleEvent(Event evt)Deprecated. As of JDK version 1.1 replaced by processEvent(AWTEvent).Deprecated. As of JDK version 1.1 replaced by processEvent(AWTEvent).keyDown boolean
keyDown(Event evt, int key)Deprecated. As of JDK version 1.1, replaced by processKeyEvent(KeyEvent).Deprecated. As of JDK version 1.1, replaced by processKeyEvent(KeyEvent).keyUp boolean
keyUp(Event evt, int key)Deprecated. As of JDK version 1.1, replaced by processKeyEvent(KeyEvent).Deprecated. As of JDK version 1.1, replaced by processKeyEvent(KeyEvent).mouseDown boolean
mouseDown(Event evt, int x, int y)Deprecated. As of JDK version 1.1, replaced by processMouseEvent(MouseEvent).Deprecated. As of JDK version 1.1, replaced by processMouseEvent(MouseEvent).mouseDrag boolean
mouseDrag(Event evt, int x, int y)Deprecated. As of JDK version 1.1, replaced by processMouseMotionEvent(MouseEvent).Deprecated. As of JDK version 1.1, replaced by processMouseMotionEvent(MouseEvent).mouseEnter boolean
mouseEnter(Event evt, int x, int y)Deprecated. As of JDK version 1.1, replaced by processMouseEvent(MouseEvent).Deprecated. As of JDK version 1.1, replaced by processMouseEvent(MouseEvent).mouseExit boolean
mouseExit(Event evt, int x, int y)Deprecated. As of JDK version 1.1, replaced by processMouseEvent(MouseEvent).Deprecated. As of JDK version 1.1, replaced by processMouseEvent(MouseEvent).mouseMove boolean
mouseMove(Event evt, int x, int y)Deprecated. As of JDK version 1.1, replaced by processMouseMotionEvent(MouseEvent).Deprecated. As of JDK version 1.1, replaced by processMouseMotionEvent(MouseEvent).mouseUp boolean
mouseUp(Event evt, int x, int y)Deprecated. As of JDK version 1.1, replaced by processMouseEvent(MouseEvent).Deprecated. As of JDK version 1.1, replaced by processMouseEvent(MouseEvent).postEvent boolean
postEvent(Event e)Deprecated. As of JDK version 1.1 replaced bydispatchEvent(AWTEvent)
.Deprecated. As of JDK version 1.1 replaced bydispatchEvent(AWTEvent)
.processComponentEvent protected void
processComponentEvent(ComponentEvent e)Processes component events occurring on this component by dispatching them to any registeredComponentListener
objects.protected void processComponentEvent(ComponentEvent e)-
Description copied from class:
Component
Processes component events occurring on this component by dispatching them to any registeredComponentListener
objects.This method is not called unless component events are enabled for this component. Component events are enabled when one of the following occurs:
- A
ComponentListener
object is registered viaaddComponentListener
. - Component events are enabled via
enableEvents
.
Note that if the event parameter is
null
the behavior is unspecified and may result in an exception.- Parameters:
e
- the component event- Since:
- JDK1.1
- See Also:
ComponentEvent
,ComponentListener
,Component.addComponentListener(java.awt.event.ComponentListener)
,Component.enableEvents(long)
- A
processContainerEvent protected void
processContainerEvent(ContainerEvent e)Processes container events occurring on this container by dispatching them to any registered ContainerListener objects.protected void processContainerEvent(ContainerEvent e)-
Description copied from class:
Container
Processes container events occurring on this container by dispatching them to any registered ContainerListener objects. NOTE: This method will not be called unless container events are enabled for this component; this happens when one of the following occurs:- A ContainerListener object is registered via
addContainerListener
- Container events are enabled via
enableEvents
Note that if the event parameter is
null
the behavior is unspecified and may result in an exception.- Parameters:
e
- the container event- See Also:
Component.enableEvents(long)
- A ContainerListener object is registered via
processEvent protected void
processEvent(AWTEvent e)Processes events on this window.protected void processEvent(AWTEvent e)-
Description copied from class:
Window
Processes events on this window. If the event is anWindowEvent
, it invokes theprocessWindowEvent
method, else it invokes its superclass'sprocessEvent
.Note that if the event parameter is
null
the behavior is unspecified and may result in an exception.- Overrides:
processEvent
in classContainer
- Parameters:
e
- the event- See Also:
Component.processComponentEvent(java.awt.event.ComponentEvent)
,Component.processFocusEvent(java.awt.event.FocusEvent)
,Component.processKeyEvent(java.awt.event.KeyEvent)
,Component.processMouseEvent(java.awt.event.MouseEvent)
,Component.processMouseMotionEvent(java.awt.event.MouseEvent)
,Component.processInputMethodEvent(java.awt.event.InputMethodEvent)
,Component.processHierarchyEvent(java.awt.event.HierarchyEvent)
,Component.processMouseWheelEvent(java.awt.event.MouseWheelEvent)
processFocusEvent protected void
processFocusEvent(FocusEvent e)Processes focus events occurring on this component by dispatching them to any registeredFocusListener
objects.protected void processFocusEvent(FocusEvent e)-
Description copied from class:
Component
Processes focus events occurring on this component by dispatching them to any registeredFocusListener
objects.This method is not called unless focus events are enabled for this component. Focus events are enabled when one of the following occurs:
- A
FocusListener
object is registered viaaddFocusListener
. - Focus events are enabled via
enableEvents
.
If focus events are enabled for a
Component
, the currentKeyboardFocusManager
determines whether or not a focus event should be dispatched to registeredFocusListener
objects. If the events are to be dispatched, theKeyboardFocusManager
calls theComponent
'sdispatchEvent
method, which results in a call to theComponent
'sprocessFocusEvent
method.If focus events are enabled for a
Component
, calling theComponent
'sdispatchEvent
method with aFocusEvent
as the argument will result in a call to theComponent
'sprocessFocusEvent
method regardless of the currentKeyboardFocusManager
.Note that if the event parameter is
null
the behavior is unspecified and may result in an exception.- Parameters:
e
- the focus event- Since:
- JDK1.1
- See Also:
FocusEvent
,FocusListener
,KeyboardFocusManager
,Component.addFocusListener(java.awt.event.FocusListener)
,Component.enableEvents(long)
,Component.dispatchEvent(java.awt.AWTEvent)
- A
processHierarchyBoundsEvent protected void
processHierarchyBoundsEvent(HierarchyEvent e)Processes hierarchy bounds events occurring on this component by dispatching them to any registeredHierarchyBoundsListener
objects.protected void processHierarchyBoundsEvent(HierarchyEvent e)-
Description copied from class:
Component
Processes hierarchy bounds events occurring on this component by dispatching them to any registeredHierarchyBoundsListener
objects.This method is not called unless hierarchy bounds events are enabled for this component. Hierarchy bounds events are enabled when one of the following occurs:
- An
HierarchyBoundsListener
object is registered viaaddHierarchyBoundsListener
. - Hierarchy bounds events are enabled via
enableEvents
.
Note that if the event parameter is
null
the behavior is unspecified and may result in an exception.- Parameters:
e
- the hierarchy event- Since:
- 1.3
- See Also:
HierarchyEvent
,HierarchyBoundsListener
,Component.addHierarchyBoundsListener(java.awt.event.HierarchyBoundsListener)
,Component.enableEvents(long)
- An
processHierarchyEvent protected void
processHierarchyEvent(HierarchyEvent e)Processes hierarchy events occurring on this component by dispatching them to any registeredHierarchyListener
objects.protected void processHierarchyEvent(HierarchyEvent e)-
Description copied from class:
Component
Processes hierarchy events occurring on this component by dispatching them to any registeredHierarchyListener
objects.This method is not called unless hierarchy events are enabled for this component. Hierarchy events are enabled when one of the following occurs:
- An
HierarchyListener
object is registered viaaddHierarchyListener
. - Hierarchy events are enabled via
enableEvents
.
Note that if the event parameter is
null
the behavior is unspecified and may result in an exception.- Parameters:
e
- the hierarchy event- Since:
- 1.3
- See Also:
HierarchyEvent
,HierarchyListener
,Component.addHierarchyListener(java.awt.event.HierarchyListener)
,Component.enableEvents(long)
- An
processInputMethodEvent protected void
processInputMethodEvent(InputMethodEvent e)Processes input method events occurring on this component by dispatching them to any registeredInputMethodListener
objects.protected void processInputMethodEvent(InputMethodEvent e)-
Description copied from class:
Component
Processes input method events occurring on this component by dispatching them to any registeredInputMethodListener
objects.This method is not called unless input method events are enabled for this component. Input method events are enabled when one of the following occurs:
- An
InputMethodListener
object is registered viaaddInputMethodListener
. - Input method events are enabled via
enableEvents
.
Note that if the event parameter is
null
the behavior is unspecified and may result in an exception.- Parameters:
e
- the input method event- Since:
- 1.2
- See Also:
InputMethodEvent
,InputMethodListener
,Component.addInputMethodListener(java.awt.event.InputMethodListener)
,Component.enableEvents(long)
- An
processKeyEvent protected void
processKeyEvent(KeyEvent e)Processes key events occurring on this component by dispatching them to any registeredKeyListener
objects.protected void processKeyEvent(KeyEvent e)-
Description copied from class:
Component
Processes key events occurring on this component by dispatching them to any registeredKeyListener
objects.This method is not called unless key events are enabled for this component. Key events are enabled when one of the following occurs:
- A
KeyListener
object is registered viaaddKeyListener
. - Key events are enabled via
enableEvents
.
If key events are enabled for a
Component
, the currentKeyboardFocusManager
determines whether or not a key event should be dispatched to registeredKeyListener
objects. TheDefaultKeyboardFocusManager
will not dispatch key events to aComponent
that is not the focus owner or is not showing.As of J2SE 1.4,
KeyEvent
s are redirected to the focus owner. Please see the Focus Specification for further information.Calling a
Component
'sdispatchEvent
method with aKeyEvent
as the argument will result in a call to theComponent
'sprocessKeyEvent
method regardless of the currentKeyboardFocusManager
as long as the component is showing, focused, and enabled, and key events are enabled on it.If the event parameter is
null
the behavior is unspecified and may result in an exception.- Parameters:
e
- the key event- Since:
- JDK1.1
- See Also:
KeyEvent
,KeyListener
,KeyboardFocusManager
,DefaultKeyboardFocusManager
,Component.processEvent(java.awt.AWTEvent)
,Component.dispatchEvent(java.awt.AWTEvent)
,Component.addKeyListener(java.awt.event.KeyListener)
,Component.enableEvents(long)
,Component.isShowing()
- A
processMouseEvent protected void
processMouseEvent(MouseEvent e)Processes mouse events occurring on this component by dispatching them to any registeredMouseListener
objects.protected void processMouseEvent(MouseEvent e)-
Description copied from class:
Component
Processes mouse events occurring on this component by dispatching them to any registeredMouseListener
objects.This method is not called unless mouse events are enabled for this component. Mouse events are enabled when one of the following occurs:
- A
MouseListener
object is registered viaaddMouseListener
. - Mouse events are enabled via
enableEvents
.
Note that if the event parameter is
null
the behavior is unspecified and may result in an exception.- Parameters:
e
- the mouse event- Since:
- JDK1.1
- See Also:
MouseEvent
,MouseListener
,Component.addMouseListener(java.awt.event.MouseListener)
,Component.enableEvents(long)
- A
processMouseMotionEvent protected void
processMouseMotionEvent(MouseEvent e)Processes mouse motion events occurring on this component by dispatching them to any registeredMouseMotionListener
objects.protected void processMouseMotionEvent(MouseEvent e)-
Description copied from class:
Component
Processes mouse motion events occurring on this component by dispatching them to any registeredMouseMotionListener
objects.This method is not called unless mouse motion events are enabled for this component. Mouse motion events are enabled when one of the following occurs:
- A
MouseMotionListener
object is registered viaaddMouseMotionListener
. - Mouse motion events are enabled via
enableEvents
.
Note that if the event parameter is
null
the behavior is unspecified and may result in an exception.- Parameters:
e
- the mouse motion event- Since:
- JDK1.1
- See Also:
MouseEvent
,MouseMotionListener
,Component.addMouseMotionListener(java.awt.event.MouseMotionListener)
,Component.enableEvents(long)
- A
processMouseWheelEvent protected void
processMouseWheelEvent(MouseWheelEvent e)Processes mouse wheel events occurring on this component by dispatching them to any registeredMouseWheelListener
objects.protected void processMouseWheelEvent(MouseWheelEvent e)-
Description copied from class:
Component
Processes mouse wheel events occurring on this component by dispatching them to any registeredMouseWheelListener
objects.This method is not called unless mouse wheel events are enabled for this component. Mouse wheel events are enabled when one of the following occurs:
- A
MouseWheelListener
object is registered viaaddMouseWheelListener
. - Mouse wheel events are enabled via
enableEvents
.
For information on how mouse wheel events are dispatched, see the class description for
MouseWheelEvent
.Note that if the event parameter is
null
the behavior is unspecified and may result in an exception.- Parameters:
e
- the mouse wheel event- Since:
- 1.4
- See Also:
MouseWheelEvent
,MouseWheelListener
,Component.addMouseWheelListener(java.awt.event.MouseWheelListener)
,Component.enableEvents(long)
- A
-
-
Event Registration Methods Modifier and Type Method and Description addComponentListener void
addComponentListener(ComponentListener l)Adds the specified component listener to receive component events from this component.public void addComponentListener(ComponentListener l)-
Description copied from class:
Component
Adds the specified component listener to receive component events from this component. If listenerl
isnull
, no exception is thrown and no action is performed.Refer to AWT Threading Issues for details on AWT's threading model.
- Parameters:
l
- the component listener- Since:
- JDK1.1
- See Also:
ComponentEvent
,ComponentListener
,Component.removeComponentListener(java.awt.event.ComponentListener)
,Component.getComponentListeners()
addContainerListener void
addContainerListener(ContainerListener l)Adds the specified container listener to receive container events from this container.public void addContainerListener(ContainerListener l)-
Description copied from class:
Container
Adds the specified container listener to receive container events from this container. If l is null, no exception is thrown and no action is performed.Refer to AWT Threading Issues for details on AWT's threading model.
- Parameters:
l
- the container listener- See Also:
Container.removeContainerListener(java.awt.event.ContainerListener)
,Container.getContainerListeners()
addFocusListener void
addFocusListener(FocusListener l)Adds the specified focus listener to receive focus events from this component when this component gains input focus.public void addFocusListener(FocusListener l)-
Description copied from class:
Component
Adds the specified focus listener to receive focus events from this component when this component gains input focus. If listenerl
isnull
, no exception is thrown and no action is performed.Refer to AWT Threading Issues for details on AWT's threading model.
- Parameters:
l
- the focus listener- Since:
- JDK1.1
- See Also:
FocusEvent
,FocusListener
,Component.removeFocusListener(java.awt.event.FocusListener)
,Component.getFocusListeners()
addHierarchyBoundsListener void
addHierarchyBoundsListener(HierarchyBoundsListener l)Adds the specified hierarchy bounds listener to receive hierarchy bounds events from this component when the hierarchy to which this container belongs changes.public void addHierarchyBoundsListener(HierarchyBoundsListener l)-
Description copied from class:
Component
Adds the specified hierarchy bounds listener to receive hierarchy bounds events from this component when the hierarchy to which this container belongs changes. If listenerl
isnull
, no exception is thrown and no action is performed.Refer to AWT Threading Issues for details on AWT's threading model.
- Parameters:
l
- the hierarchy bounds listener- Since:
- 1.3
- See Also:
HierarchyEvent
,HierarchyBoundsListener
,Component.removeHierarchyBoundsListener(java.awt.event.HierarchyBoundsListener)
,Component.getHierarchyBoundsListeners()
addHierarchyListener void
addHierarchyListener(HierarchyListener l)Adds the specified hierarchy listener to receive hierarchy changed events from this component when the hierarchy to which this container belongs changes.public void addHierarchyListener(HierarchyListener l)-
Description copied from class:
Component
Adds the specified hierarchy listener to receive hierarchy changed events from this component when the hierarchy to which this container belongs changes. If listenerl
isnull
, no exception is thrown and no action is performed.Refer to AWT Threading Issues for details on AWT's threading model.
- Parameters:
l
- the hierarchy listener- Since:
- 1.3
- See Also:
HierarchyEvent
,HierarchyListener
,Component.removeHierarchyListener(java.awt.event.HierarchyListener)
,Component.getHierarchyListeners()
addInputMethodListener void
addInputMethodListener(InputMethodListener l)Adds the specified input method listener to receive input method events from this component.public void addInputMethodListener(InputMethodListener l)-
Description copied from class:
Component
Adds the specified input method listener to receive input method events from this component. A component will only receive input method events from input methods if it also overridesgetInputMethodRequests
to return anInputMethodRequests
instance. If listenerl
isnull
, no exception is thrown and no action is performed.Refer to AWT Threading Issues for details on AWT's threading model.
- Parameters:
l
- the input method listener- Since:
- 1.2
- See Also:
InputMethodEvent
,InputMethodListener
,Component.removeInputMethodListener(java.awt.event.InputMethodListener)
,Component.getInputMethodListeners()
,Component.getInputMethodRequests()
addKeyListener void
addKeyListener(KeyListener l)Adds the specified key listener to receive key events from this component.public void addKeyListener(KeyListener l)-
Description copied from class:
Component
Adds the specified key listener to receive key events from this component. If l is null, no exception is thrown and no action is performed.Refer to AWT Threading Issues for details on AWT's threading model.
- Parameters:
l
- the key listener.- Since:
- JDK1.1
- See Also:
KeyEvent
,KeyListener
,Component.removeKeyListener(java.awt.event.KeyListener)
,Component.getKeyListeners()
addMouseListener void
addMouseListener(MouseListener l)Adds the specified mouse listener to receive mouse events from this component.public void addMouseListener(MouseListener l)-
Description copied from class:
Component
Adds the specified mouse listener to receive mouse events from this component. If listenerl
isnull
, no exception is thrown and no action is performed.Refer to AWT Threading Issues for details on AWT's threading model.
- Parameters:
l
- the mouse listener- Since:
- JDK1.1
- See Also:
MouseEvent
,MouseListener
,Component.removeMouseListener(java.awt.event.MouseListener)
,Component.getMouseListeners()
addMouseMotionListener void
addMouseMotionListener(MouseMotionListener l)Adds the specified mouse motion listener to receive mouse motion events from this component.public void addMouseMotionListener(MouseMotionListener l)-
Description copied from class:
Component
Adds the specified mouse motion listener to receive mouse motion events from this component. If listenerl
isnull
, no exception is thrown and no action is performed.Refer to AWT Threading Issues for details on AWT's threading model.
- Parameters:
l
- the mouse motion listener- Since:
- JDK1.1
- See Also:
MouseEvent
,MouseMotionListener
,Component.removeMouseMotionListener(java.awt.event.MouseMotionListener)
,Component.getMouseMotionListeners()
addMouseWheelListener void
addMouseWheelListener(MouseWheelListener l)Adds the specified mouse wheel listener to receive mouse wheel events from this component.public void addMouseWheelListener(MouseWheelListener l)-
Description copied from class:
Component
Adds the specified mouse wheel listener to receive mouse wheel events from this component. Containers also receive mouse wheel events from sub-components.For information on how mouse wheel events are dispatched, see the class description for
MouseWheelEvent
.If l is
null
, no exception is thrown and no action is performed.Refer to AWT Threading Issues for details on AWT's threading model.
- Parameters:
l
- the mouse wheel listener- Since:
- 1.4
- See Also:
MouseWheelEvent
,MouseWheelListener
,Component.removeMouseWheelListener(java.awt.event.MouseWheelListener)
,Component.getMouseWheelListeners()
addPropertyChangeListener void
addPropertyChangeListener(java.beans.PropertyChangeListener listener)Adds a PropertyChangeListener to the listener list.public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)-
Description copied from class:
Window
Adds a PropertyChangeListener to the listener list. The listener is registered for all bound properties of this class, including the following:- this Window's font ("font")
- this Window's background color ("background")
- this Window's foreground color ("foreground")
- this Window's focusability ("focusable")
- this Window's focus traversal keys enabled state ("focusTraversalKeysEnabled")
- this Window's Set of FORWARD_TRAVERSAL_KEYS ("forwardFocusTraversalKeys")
- this Window's Set of BACKWARD_TRAVERSAL_KEYS ("backwardFocusTraversalKeys")
- this Window's Set of UP_CYCLE_TRAVERSAL_KEYS ("upCycleFocusTraversalKeys")
- this Window's Set of DOWN_CYCLE_TRAVERSAL_KEYS ("downCycleFocusTraversalKeys")
- this Window's focus traversal policy ("focusTraversalPolicy")
- this Window's focusable Window state ("focusableWindowState")
- this Window's always-on-top state("alwaysOnTop")
If listener is null, no exception is thrown and no action is performed.
- Overrides:
addPropertyChangeListener
in classContainer
- Parameters:
listener
- the PropertyChangeListener to be added- See Also:
Component.removePropertyChangeListener(java.beans.PropertyChangeListener)
,Window.addPropertyChangeListener(java.lang.String,java.beans.PropertyChangeListener)
addPropertyChangeListener void
addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)Adds a PropertyChangeListener to the listener list for a specific property.public void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)-
Description copied from class:
Window
Adds a PropertyChangeListener to the listener list for a specific property. The specified property may be user-defined, or one of the following:- this Window's font ("font")
- this Window's background color ("background")
- this Window's foreground color ("foreground")
- this Window's focusability ("focusable")
- this Window's focus traversal keys enabled state ("focusTraversalKeysEnabled")
- this Window's Set of FORWARD_TRAVERSAL_KEYS ("forwardFocusTraversalKeys")
- this Window's Set of BACKWARD_TRAVERSAL_KEYS ("backwardFocusTraversalKeys")
- this Window's Set of UP_CYCLE_TRAVERSAL_KEYS ("upCycleFocusTraversalKeys")
- this Window's Set of DOWN_CYCLE_TRAVERSAL_KEYS ("downCycleFocusTraversalKeys")
- this Window's focus traversal policy ("focusTraversalPolicy")
- this Window's focusable Window state ("focusableWindowState")
- this Window's always-on-top state("alwaysOnTop")
If listener is null, no exception is thrown and no action is performed.
- Overrides:
addPropertyChangeListener
in classContainer
- Parameters:
propertyName
- one of the property names listed abovelistener
- the PropertyChangeListener to be added- See Also:
Window.addPropertyChangeListener(java.beans.PropertyChangeListener)
,Component.removePropertyChangeListener(java.beans.PropertyChangeListener)
getComponentListeners ComponentListener[]
getComponentListeners()Returns an array of all the component listeners registered on this component.public ComponentListener[] getComponentListeners()-
Description copied from class:
Component
Returns an array of all the component listeners registered on this component.- Returns:
- all of this comonent's
ComponentListener
s or an empty array if no component listeners are currently registered - Since:
- 1.4
- See Also:
Component.addComponentListener(java.awt.event.ComponentListener)
,Component.removeComponentListener(java.awt.event.ComponentListener)
getContainerListeners ContainerListener[]
getContainerListeners()Returns an array of all the container listeners registered on this container.public ContainerListener[] getContainerListeners()-
Description copied from class:
Container
Returns an array of all the container listeners registered on this container.- Returns:
- all of this container's
ContainerListener
s or an empty array if no container listeners are currently registered - Since:
- 1.4
- See Also:
Container.addContainerListener(java.awt.event.ContainerListener)
,Container.removeContainerListener(java.awt.event.ContainerListener)
getFocusListeners FocusListener[]
getFocusListeners()Returns an array of all the focus listeners registered on this component.public FocusListener[] getFocusListeners()-
Description copied from class:
Component
Returns an array of all the focus listeners registered on this component.- Returns:
- all of this component's
FocusListener
s or an empty array if no component listeners are currently registered - Since:
- 1.4
- See Also:
Component.addFocusListener(java.awt.event.FocusListener)
,Component.removeFocusListener(java.awt.event.FocusListener)
getHierarchyBoundsListeners HierarchyBoundsListener[]
getHierarchyBoundsListeners()Returns an array of all the hierarchy bounds listeners registered on this component.public HierarchyBoundsListener[] getHierarchyBoundsListeners()-
Description copied from class:
Component
Returns an array of all the hierarchy bounds listeners registered on this component.- Returns:
- all of this component's
HierarchyBoundsListener
s or an empty array if no hierarchy bounds listeners are currently registered - Since:
- 1.4
- See Also:
Component.addHierarchyBoundsListener(java.awt.event.HierarchyBoundsListener)
,Component.removeHierarchyBoundsListener(java.awt.event.HierarchyBoundsListener)
getHierarchyListeners HierarchyListener[]
getHierarchyListeners()Returns an array of all the hierarchy listeners registered on this component.public HierarchyListener[] getHierarchyListeners()-
Description copied from class:
Component
Returns an array of all the hierarchy listeners registered on this component.- Returns:
- all of this component's
HierarchyListener
s or an empty array if no hierarchy listeners are currently registered - Since:
- 1.4
- See Also:
Component.addHierarchyListener(java.awt.event.HierarchyListener)
,Component.removeHierarchyListener(java.awt.event.HierarchyListener)
getInputMethodListeners InputMethodListener[]
getInputMethodListeners()Returns an array of all the input method listeners registered on this component.public InputMethodListener[] getInputMethodListeners()-
Description copied from class:
Component
Returns an array of all the input method listeners registered on this component.- Returns:
- all of this component's
InputMethodListener
s or an empty array if no input method listeners are currently registered - Since:
- 1.4
- See Also:
Component.addInputMethodListener(java.awt.event.InputMethodListener)
,Component.removeInputMethodListener(java.awt.event.InputMethodListener)
getKeyListeners KeyListener[]
getKeyListeners()Returns an array of all the key listeners registered on this component.public KeyListener[] getKeyListeners()-
Description copied from class:
Component
Returns an array of all the key listeners registered on this component.- Returns:
- all of this component's
KeyListener
s or an empty array if no key listeners are currently registered - Since:
- 1.4
- See Also:
Component.addKeyListener(java.awt.event.KeyListener)
,Component.removeKeyListener(java.awt.event.KeyListener)
getMouseListeners MouseListener[]
getMouseListeners()Returns an array of all the mouse listeners registered on this component.public MouseListener[] getMouseListeners()-
Description copied from class:
Component
Returns an array of all the mouse listeners registered on this component.- Returns:
- all of this component's
MouseListener
s or an empty array if no mouse listeners are currently registered - Since:
- 1.4
- See Also:
Component.addMouseListener(java.awt.event.MouseListener)
,Component.removeMouseListener(java.awt.event.MouseListener)
getMouseMotionListeners MouseMotionListener[]
getMouseMotionListeners()Returns an array of all the mouse motion listeners registered on this component.public MouseMotionListener[] getMouseMotionListeners()-
Description copied from class:
Component
Returns an array of all the mouse motion listeners registered on this component.- Returns:
- all of this component's
MouseMotionListener
s or an empty array if no mouse motion listeners are currently registered - Since:
- 1.4
- See Also:
Component.addMouseMotionListener(java.awt.event.MouseMotionListener)
,Component.removeMouseMotionListener(java.awt.event.MouseMotionListener)
getMouseWheelListeners MouseWheelListener[]
getMouseWheelListeners()Returns an array of all the mouse wheel listeners registered on this component.public MouseWheelListener[] getMouseWheelListeners()-
Description copied from class:
Component
Returns an array of all the mouse wheel listeners registered on this component.- Returns:
- all of this component's
MouseWheelListener
s or an empty array if no mouse wheel listeners are currently registered - Since:
- 1.4
- See Also:
Component.addMouseWheelListener(java.awt.event.MouseWheelListener)
,Component.removeMouseWheelListener(java.awt.event.MouseWheelListener)
getPropertyChangeListeners java.beans.PropertyChangeListener[]
getPropertyChangeListeners()Returns an array of all the property change listeners registered on this component.public java.beans.PropertyChangeListener[] getPropertyChangeListeners()-
Description copied from class:
Component
Returns an array of all the property change listeners registered on this component.- Returns:
- all of this component's
PropertyChangeListener
s or an empty array if no property change listeners are currently registered - Since:
- 1.4
- See Also:
Component.addPropertyChangeListener(java.beans.PropertyChangeListener)
,Component.removePropertyChangeListener(java.beans.PropertyChangeListener)
,Component.getPropertyChangeListeners(java.lang.String)
,PropertyChangeSupport.getPropertyChangeListeners()
getPropertyChangeListeners java.beans.PropertyChangeListener[]
getPropertyChangeListeners(java.lang.String propertyName)Returns an array of all the listeners which have been associated with the named property.public java.beans.PropertyChangeListener[] getPropertyChangeListeners(java.lang.String propertyName)-
Description copied from class:
Component
Returns an array of all the listeners which have been associated with the named property.- Returns:
- all of the
PropertyChangeListener
s associated with the named property; if no such listeners have been added or ifpropertyName
isnull
, an empty array is returned - Since:
- 1.4
- See Also:
Component.addPropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)
,Component.removePropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)
,Component.getPropertyChangeListeners()
removeComponentListener void
removeComponentListener(ComponentListener l)Removes the specified component listener so that it no longer receives component events from this component.public void removeComponentListener(ComponentListener l)-
Description copied from class:
Component
Removes the specified component listener so that it no longer receives component events from this component. This method performs no function, nor does it throw an exception, if the listener specified by the argument was not previously added to this component. If listenerl
isnull
, no exception is thrown and no action is performed.Refer to AWT Threading Issues for details on AWT's threading model.
- Parameters:
l
- the component listener- Since:
- JDK1.1
- See Also:
ComponentEvent
,ComponentListener
,Component.addComponentListener(java.awt.event.ComponentListener)
,Component.getComponentListeners()
removeContainerListener void
removeContainerListener(ContainerListener l)Removes the specified container listener so it no longer receives container events from this container.public void removeContainerListener(ContainerListener l)-
Description copied from class:
Container
Removes the specified container listener so it no longer receives container events from this container. If l is null, no exception is thrown and no action is performed.Refer to AWT Threading Issues for details on AWT's threading model.
- Parameters:
l
- the container listener- See Also:
Container.addContainerListener(java.awt.event.ContainerListener)
,Container.getContainerListeners()
removeFocusListener void
removeFocusListener(FocusListener l)Removes the specified focus listener so that it no longer receives focus events from this component.public void removeFocusListener(FocusListener l)-
Description copied from class:
Component
Removes the specified focus listener so that it no longer receives focus events from this component. This method performs no function, nor does it throw an exception, if the listener specified by the argument was not previously added to this component. If listenerl
isnull
, no exception is thrown and no action is performed.Refer to AWT Threading Issues for details on AWT's threading model.
- Parameters:
l
- the focus listener- Since:
- JDK1.1
- See Also:
FocusEvent
,FocusListener
,Component.addFocusListener(java.awt.event.FocusListener)
,Component.getFocusListeners()
removeHierarchyBoundsListener void
removeHierarchyBoundsListener(HierarchyBoundsListener l)Removes the specified hierarchy bounds listener so that it no longer receives hierarchy bounds events from this component.public void removeHierarchyBoundsListener(HierarchyBoundsListener l)-
Description copied from class:
Component
Removes the specified hierarchy bounds listener so that it no longer receives hierarchy bounds events from this component. This method performs no function, nor does it throw an exception, if the listener specified by the argument was not previously added to this component. If listenerl
isnull
, no exception is thrown and no action is performed.Refer to AWT Threading Issues for details on AWT's threading model.
- Parameters:
l
- the hierarchy bounds listener- Since:
- 1.3
- See Also:
HierarchyEvent
,HierarchyBoundsListener
,Component.addHierarchyBoundsListener(java.awt.event.HierarchyBoundsListener)
,Component.getHierarchyBoundsListeners()
removeHierarchyListener void
removeHierarchyListener(HierarchyListener l)Removes the specified hierarchy listener so that it no longer receives hierarchy changed events from this component.public void removeHierarchyListener(HierarchyListener l)-
Description copied from class:
Component
Removes the specified hierarchy listener so that it no longer receives hierarchy changed events from this component. This method performs no function, nor does it throw an exception, if the listener specified by the argument was not previously added to this component. If listenerl
isnull
, no exception is thrown and no action is performed.Refer to AWT Threading Issues for details on AWT's threading model.
- Parameters:
l
- the hierarchy listener- Since:
- 1.3
- See Also:
HierarchyEvent
,HierarchyListener
,Component.addHierarchyListener(java.awt.event.HierarchyListener)
,Component.getHierarchyListeners()
removeInputMethodListener void
removeInputMethodListener(InputMethodListener l)Removes the specified input method listener so that it no longer receives input method events from this component.public void removeInputMethodListener(InputMethodListener l)-
Description copied from class:
Component
Removes the specified input method listener so that it no longer receives input method events from this component. This method performs no function, nor does it throw an exception, if the listener specified by the argument was not previously added to this component. If listenerl
isnull
, no exception is thrown and no action is performed.Refer to AWT Threading Issues for details on AWT's threading model.
- Parameters:
l
- the input method listener- Since:
- 1.2
- See Also:
InputMethodEvent
,InputMethodListener
,Component.addInputMethodListener(java.awt.event.InputMethodListener)
,Component.getInputMethodListeners()
removeKeyListener void
removeKeyListener(KeyListener l)Removes the specified key listener so that it no longer receives key events from this component.public void removeKeyListener(KeyListener l)-
Description copied from class:
Component
Removes the specified key listener so that it no longer receives key events from this component. This method performs no function, nor does it throw an exception, if the listener specified by the argument was not previously added to this component. If listenerl
isnull
, no exception is thrown and no action is performed.Refer to AWT Threading Issues for details on AWT's threading model.
- Parameters:
l
- the key listener- Since:
- JDK1.1
- See Also:
KeyEvent
,KeyListener
,Component.addKeyListener(java.awt.event.KeyListener)
,Component.getKeyListeners()
removeMouseListener void
removeMouseListener(MouseListener l)Removes the specified mouse listener so that it no longer receives mouse events from this component.public void removeMouseListener(MouseListener l)-
Description copied from class:
Component
Removes the specified mouse listener so that it no longer receives mouse events from this component. This method performs no function, nor does it throw an exception, if the listener specified by the argument was not previously added to this component. If listenerl
isnull
, no exception is thrown and no action is performed.Refer to AWT Threading Issues for details on AWT's threading model.
- Parameters:
l
- the mouse listener- Since:
- JDK1.1
- See Also:
MouseEvent
,MouseListener
,Component.addMouseListener(java.awt.event.MouseListener)
,Component.getMouseListeners()
removeMouseMotionListener void
removeMouseMotionListener(MouseMotionListener l)Removes the specified mouse motion listener so that it no longer receives mouse motion events from this component.public void removeMouseMotionListener(MouseMotionListener l)-
Description copied from class:
Component
Removes the specified mouse motion listener so that it no longer receives mouse motion events from this component. This method performs no function, nor does it throw an exception, if the listener specified by the argument was not previously added to this component. If listenerl
isnull
, no exception is thrown and no action is performed.Refer to AWT Threading Issues for details on AWT's threading model.
- Parameters:
l
- the mouse motion listener- Since:
- JDK1.1
- See Also:
MouseEvent
,MouseMotionListener
,Component.addMouseMotionListener(java.awt.event.MouseMotionListener)
,Component.getMouseMotionListeners()
removeMouseWheelListener void
removeMouseWheelListener(MouseWheelListener l)Removes the specified mouse wheel listener so that it no longer receives mouse wheel events from this component.public void removeMouseWheelListener(MouseWheelListener l)-
Description copied from class:
Component
Removes the specified mouse wheel listener so that it no longer receives mouse wheel events from this component. This method performs no function, nor does it throw an exception, if the listener specified by the argument was not previously added to this component. If l is null, no exception is thrown and no action is performed.Refer to AWT Threading Issues for details on AWT's threading model.
- Parameters:
l
- the mouse wheel listener.- Since:
- 1.4
- See Also:
MouseWheelEvent
,MouseWheelListener
,Component.addMouseWheelListener(java.awt.event.MouseWheelListener)
,Component.getMouseWheelListeners()
removePropertyChangeListener void
removePropertyChangeListener(java.beans.PropertyChangeListener listener)Removes a PropertyChangeListener from the listener list.public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)-
Description copied from class:
Component
Removes a PropertyChangeListener from the listener list. This method should be used to remove PropertyChangeListeners that were registered for all bound properties of this class.If listener is null, no exception is thrown and no action is performed.
- Parameters:
listener
- the PropertyChangeListener to be removed- See Also:
Component.addPropertyChangeListener(java.beans.PropertyChangeListener)
,Component.getPropertyChangeListeners()
,Component.removePropertyChangeListener(java.lang.String,java.beans.PropertyChangeListener)
removePropertyChangeListener void
removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)Removes aPropertyChangeListener
from the listener list for a specific property.public void removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)-
Description copied from class:
Component
Removes aPropertyChangeListener
from the listener list for a specific property. This method should be used to removePropertyChangeListener
s that were registered for a specific bound property.If
propertyName
orlistener
isnull
, no exception is thrown and no action is taken.- Parameters:
propertyName
- a valid property namelistener
- the PropertyChangeListener to be removed- See Also:
Component.addPropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)
,Component.getPropertyChangeListeners(java.lang.String)
,Component.removePropertyChangeListener(java.beans.PropertyChangeListener)
-
-
Keyboard Focus Methods Modifier and Type Method and Description areFocusTraversalKeysSet boolean
areFocusTraversalKeysSet(int id)Returns whether the Set of focus traversal keys for the given focus traversal operation has been explicitly defined for this Container.public boolean areFocusTraversalKeysSet(int id)-
Description copied from class:
Container
Returns whether the Set of focus traversal keys for the given focus traversal operation has been explicitly defined for this Container. If this method returnsfalse
, this Container is inheriting the Set from an ancestor, or from the current KeyboardFocusManager.- Overrides:
areFocusTraversalKeysSet
in classComponent
- Parameters:
id
- one of KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS, or KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS- Returns:
true
if the the Set of focus traversal keys for the given focus traversal operation has been explicitly defined for this Component;false
otherwise.- Throws:
java.lang.IllegalArgumentException
- if id is not one of KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS, or KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS- Since:
- 1.4
getFocusCycleRootAncestor Container
getFocusCycleRootAncestor()Always returnsnull
because Windows have no ancestors; they represent the top of the Component hierarchy.public final Container getFocusCycleRootAncestor()-
Description copied from class:
Window
Always returnsnull
because Windows have no ancestors; they represent the top of the Component hierarchy.- Overrides:
getFocusCycleRootAncestor
in classComponent
- Returns:
null
- Since:
- 1.4
- See Also:
Container.isFocusCycleRoot()
getFocusTraversalKeys java.util.Set<AWTKeyStroke>
getFocusTraversalKeys(int id)Gets a focus traversal key for this Window.public java.util.Set<AWTKeyStroke> getFocusTraversalKeys(int id)-
Description copied from class:
Window
Gets a focus traversal key for this Window. (SeesetFocusTraversalKeys
for a full description of each key.)If the traversal key has not been explicitly set for this Window, then this Window's parent's traversal key is returned. If the traversal key has not been explicitly set for any of this Window's ancestors, then the current KeyboardFocusManager's default traversal key is returned.
- Overrides:
getFocusTraversalKeys
in classContainer
- Parameters:
id
- one of KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS, or KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS- Returns:
- the AWTKeyStroke for the specified key
- Throws:
java.lang.IllegalArgumentException
- if id is not one of KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS, or KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS- Since:
- 1.4
- See Also:
Container.setFocusTraversalKeys(int, java.util.Set<? extends java.awt.AWTKeyStroke>)
,KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS
,KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS
,KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS
,KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS
getFocusTraversalKeysEnabled boolean
getFocusTraversalKeysEnabled()Returns whether focus traversal keys are enabled for this Component.public boolean getFocusTraversalKeysEnabled()-
Description copied from class:
Component
Returns whether focus traversal keys are enabled for this Component. Components for which focus traversal keys are disabled receive key events for focus traversal keys. Components for which focus traversal keys are enabled do not see these events; instead, the events are automatically converted to traversal operations.- Returns:
- whether focus traversal keys are enabled for this Component
- Since:
- 1.4
- See Also:
Component.setFocusTraversalKeysEnabled(boolean)
,Component.setFocusTraversalKeys(int, java.util.Set<? extends java.awt.AWTKeyStroke>)
,Component.getFocusTraversalKeys(int)
getFocusTraversalPolicy FocusTraversalPolicy
getFocusTraversalPolicy()Returns the focus traversal policy that will manage keyboard traversal of this Container's children, or null if this Container is not a focus cycle root.public FocusTraversalPolicy getFocusTraversalPolicy()-
Description copied from class:
Container
Returns the focus traversal policy that will manage keyboard traversal of this Container's children, or null if this Container is not a focus cycle root. If no traversal policy has been explicitly set for this Container, then this Container's focus-cycle-root ancestor's policy is returned.- Returns:
- this Container's focus traversal policy, or null if this Container is not a focus cycle root.
- Since:
- 1.4
- See Also:
Container.setFocusTraversalPolicy(java.awt.FocusTraversalPolicy)
,Container.setFocusCycleRoot(boolean)
,Container.isFocusCycleRoot(java.awt.Container)
gotFocus boolean
gotFocus(Event evt, java.lang.Object what)Deprecated. As of JDK version 1.1, replaced by processFocusEvent(FocusEvent).Deprecated. As of JDK version 1.1, replaced by processFocusEvent(FocusEvent).hasFocus boolean
hasFocus()Returnstrue
if thisComponent
is the focus owner.public boolean hasFocus()-
Description copied from class:
Component
Returnstrue
if thisComponent
is the focus owner. This method is obsolete, and has been replaced byisFocusOwner()
.- Returns:
true
if thisComponent
is the focus owner;false
otherwise- Since:
- 1.2
isFocusable boolean
isFocusable()Returns whether this Component can be focused.public boolean isFocusable()-
Description copied from class:
Component
Returns whether this Component can be focused.- Returns:
true
if this Component is focusable;false
otherwise.- Since:
- 1.4
- See Also:
Component.setFocusable(boolean)
isFocusCycleRoot boolean
isFocusCycleRoot()Always returnstrue
because all Windows must be roots of a focus traversal cycle.public final boolean isFocusCycleRoot()-
Description copied from class:
Window
Always returnstrue
because all Windows must be roots of a focus traversal cycle.- Overrides:
isFocusCycleRoot
in classContainer
- Returns:
true
- Since:
- 1.4
- See Also:
Window.setFocusCycleRoot(boolean)
,Container.setFocusTraversalPolicy(java.awt.FocusTraversalPolicy)
,Container.getFocusTraversalPolicy()
isFocusCycleRoot boolean
isFocusCycleRoot(Container container)Returns whether the specified Container is the focus cycle root of this Container's focus traversal cycle.public boolean isFocusCycleRoot(Container container)-
Description copied from class:
Container
Returns whether the specified Container is the focus cycle root of this Container's focus traversal cycle. Each focus traversal cycle has only a single focus cycle root and each Container which is not a focus cycle root belongs to only a single focus traversal cycle. Containers which are focus cycle roots belong to two cycles: one rooted at the Container itself, and one rooted at the Container's nearest focus-cycle-root ancestor. This method will returntrue
for both such Containers in this case.- Overrides:
isFocusCycleRoot
in classComponent
- Parameters:
container
- the Container to be tested- Returns:
true
if the specified Container is a focus-cycle- root of this Container;false
otherwise- Since:
- 1.4
- See Also:
Container.isFocusCycleRoot()
isFocusOwner boolean
isFocusOwner()Returnstrue
if thisComponent
is the focus owner.public boolean isFocusOwner()-
Description copied from class:
Component
Returnstrue
if thisComponent
is the focus owner.- Returns:
true
if thisComponent
is the focus owner;false
otherwise- Since:
- 1.4
isFocusTraversable boolean
isFocusTraversable()Deprecated. As of 1.4, replaced byisFocusable()
.@Deprecated public boolean isFocusTraversable()Deprecated. As of 1.4, replaced byisFocusable()
.-
Description copied from class:
Component
Returns whether thisComponent
can become the focus owner.- Returns:
true
if thisComponent
is focusable;false
otherwise- Since:
- JDK1.1
- See Also:
Component.setFocusable(boolean)
isFocusTraversalPolicyProvider boolean
isFocusTraversalPolicyProvider()Returns whether this container provides focus traversal policy.public final boolean isFocusTraversalPolicyProvider()-
Description copied from class:
Container
Returns whether this container provides focus traversal policy. If this property is set totrue
then when keyboard focus manager searches container hierarchy for focus traversal policy and encounters this container before any other container with this property as true or focus cycle roots then its focus traversal policy will be used instead of focus cycle root's policy.- Returns:
true
if this container provides focus traversal policy,false
otherwise- Since:
- 1.5
- See Also:
Container.setFocusTraversalPolicy(java.awt.FocusTraversalPolicy)
,Container.getFocusTraversalPolicy()
,Container.setFocusCycleRoot(boolean)
,Container.setFocusTraversalPolicyProvider(boolean)
isFocusTraversalPolicySet boolean
isFocusTraversalPolicySet()Returns whether the focus traversal policy has been explicitly set for this Container.public boolean isFocusTraversalPolicySet()-
Description copied from class:
Container
Returns whether the focus traversal policy has been explicitly set for this Container. If this method returnsfalse
, this Container will inherit its focus traversal policy from an ancestor.- Returns:
true
if the focus traversal policy has been explicitly set for this Container;false
otherwise.- Since:
- 1.4
lostFocus boolean
lostFocus(Event evt, java.lang.Object what)Deprecated. As of JDK version 1.1, replaced by processFocusEvent(FocusEvent).Deprecated. As of JDK version 1.1, replaced by processFocusEvent(FocusEvent).nextFocus void
nextFocus()Deprecated. As of JDK version 1.1, replaced by transferFocus().@Deprecated public void nextFocus()Deprecated. As of JDK version 1.1, replaced by transferFocus().requestFocus void
requestFocus()Requests that this Component get the input focus, and that this Component's top-level ancestor become the focused Window.public void requestFocus()-
Description copied from class:
Component
Requests that this Component get the input focus, and that this Component's top-level ancestor become the focused Window. This component must be displayable, focusable, visible and all of its ancestors (with the exception of the top-level Window) must be visible for the request to be granted. Every effort will be made to honor the request; however, in some cases it may be impossible to do so. Developers must never assume that this Component is the focus owner until this Component receives a FOCUS_GAINED event. If this request is denied because this Component's top-level Window cannot become the focused Window, the request will be remembered and will be granted when the Window is later focused by the user.This method cannot be used to set the focus owner to no Component at all. Use
KeyboardFocusManager.clearGlobalFocusOwner()
instead.Because the focus behavior of this method is platform-dependent, developers are strongly encouraged to use
requestFocusInWindow
when possible.Note: Not all focus transfers result from invoking this method. As such, a component may receive focus without this or any of the other
requestFocus
methods ofComponent
being invoked.
requestFocus protected boolean
requestFocus(boolean temporary)Requests that thisComponent
get the input focus, and that thisComponent
's top-level ancestor become the focusedWindow
.protected boolean requestFocus(boolean temporary)-
Description copied from class:
Component
Requests that thisComponent
get the input focus, and that thisComponent
's top-level ancestor become the focusedWindow
. This component must be displayable, focusable, visible and all of its ancestors (with the exception of the top-level Window) must be visible for the request to be granted. Every effort will be made to honor the request; however, in some cases it may be impossible to do so. Developers must never assume that this component is the focus owner until this component receives a FOCUS_GAINED event. If this request is denied because this component's top-level window cannot become the focused window, the request will be remembered and will be granted when the window is later focused by the user.This method returns a boolean value. If
false
is returned, the request is guaranteed to fail. Iftrue
is returned, the request will succeed unless it is vetoed, or an extraordinary event, such as disposal of the component's peer, occurs before the request can be granted by the native windowing system. Again, while a return value oftrue
indicates that the request is likely to succeed, developers must never assume that this component is the focus owner until this component receives a FOCUS_GAINED event.This method cannot be used to set the focus owner to no component at all. Use
KeyboardFocusManager.clearGlobalFocusOwner
instead.Because the focus behavior of this method is platform-dependent, developers are strongly encouraged to use
requestFocusInWindow
when possible.Every effort will be made to ensure that
FocusEvent
s generated as a result of this request will have the specified temporary value. However, because specifying an arbitrary temporary state may not be implementable on all native windowing systems, correct behavior for this method can be guaranteed only for lightweightComponent
s. This method is not intended for general use, but exists instead as a hook for lightweight component libraries, such as Swing.Note: Not all focus transfers result from invoking this method. As such, a component may receive focus without this or any of the other
requestFocus
methods ofComponent
being invoked.- Parameters:
temporary
- true if the focus change is temporary, such as when the window loses the focus; for more information on temporary focus changes see the Focus Specification- Returns:
false
if the focus change request is guaranteed to fail;true
if it is likely to succeed- Since:
- 1.4
- See Also:
FocusEvent
,Component.addFocusListener(java.awt.event.FocusListener)
,Component.isFocusable()
,Component.isDisplayable()
,KeyboardFocusManager.clearGlobalFocusOwner()
requestFocusInWindow boolean
requestFocusInWindow()Requests that this Component get the input focus, if this Component's top-level ancestor is already the focused Window.public boolean requestFocusInWindow()-
Description copied from class:
Component
Requests that this Component get the input focus, if this Component's top-level ancestor is already the focused Window. This component must be displayable, focusable, visible and all of its ancestors (with the exception of the top-level Window) must be visible for the request to be granted. Every effort will be made to honor the request; however, in some cases it may be impossible to do so. Developers must never assume that this Component is the focus owner until this Component receives a FOCUS_GAINED event.This method returns a boolean value. If
false
is returned, the request is guaranteed to fail. Iftrue
is returned, the request will succeed unless it is vetoed, or an extraordinary event, such as disposal of the Component's peer, occurs before the request can be granted by the native windowing system. Again, while a return value oftrue
indicates that the request is likely to succeed, developers must never assume that this Component is the focus owner until this Component receives a FOCUS_GAINED event.This method cannot be used to set the focus owner to no Component at all. Use
KeyboardFocusManager.clearGlobalFocusOwner()
instead.The focus behavior of this method can be implemented uniformly across platforms, and thus developers are strongly encouraged to use this method over
requestFocus
when possible. Code which relies onrequestFocus
may exhibit different focus behavior on different platforms.Note: Not all focus transfers result from invoking this method. As such, a component may receive focus without this or any of the other
requestFocus
methods ofComponent
being invoked.- Returns:
false
if the focus change request is guaranteed to fail;true
if it is likely to succeed- Since:
- 1.4
- See Also:
Component.requestFocus()
,FocusEvent
,Component.addFocusListener(java.awt.event.FocusListener)
,Component.isFocusable()
,Component.isDisplayable()
,KeyboardFocusManager.clearGlobalFocusOwner()
requestFocusInWindow protected boolean
requestFocusInWindow(boolean temporary)Requests that thisComponent
get the input focus, if thisComponent
's top-level ancestor is already the focusedWindow
.protected boolean requestFocusInWindow(boolean temporary)-
Description copied from class:
Component
Requests that thisComponent
get the input focus, if thisComponent
's top-level ancestor is already the focusedWindow
. This component must be displayable, focusable, visible and all of its ancestors (with the exception of the top-level Window) must be visible for the request to be granted. Every effort will be made to honor the request; however, in some cases it may be impossible to do so. Developers must never assume that this component is the focus owner until this component receives a FOCUS_GAINED event.This method returns a boolean value. If
false
is returned, the request is guaranteed to fail. Iftrue
is returned, the request will succeed unless it is vetoed, or an extraordinary event, such as disposal of the component's peer, occurs before the request can be granted by the native windowing system. Again, while a return value oftrue
indicates that the request is likely to succeed, developers must never assume that this component is the focus owner until this component receives a FOCUS_GAINED event.This method cannot be used to set the focus owner to no component at all. Use
KeyboardFocusManager.clearGlobalFocusOwner
instead.The focus behavior of this method can be implemented uniformly across platforms, and thus developers are strongly encouraged to use this method over
requestFocus
when possible. Code which relies onrequestFocus
may exhibit different focus behavior on different platforms.Every effort will be made to ensure that
FocusEvent
s generated as a result of this request will have the specified temporary value. However, because specifying an arbitrary temporary state may not be implementable on all native windowing systems, correct behavior for this method can be guaranteed only for lightweight components. This method is not intended for general use, but exists instead as a hook for lightweight component libraries, such as Swing.Note: Not all focus transfers result from invoking this method. As such, a component may receive focus without this or any of the other
requestFocus
methods ofComponent
being invoked.- Parameters:
temporary
- true if the focus change is temporary, such as when the window loses the focus; for more information on temporary focus changes see the Focus Specification- Returns:
false
if the focus change request is guaranteed to fail;true
if it is likely to succeed- Since:
- 1.4
- See Also:
Component.requestFocus()
,FocusEvent
,Component.addFocusListener(java.awt.event.FocusListener)
,Component.isFocusable()
,Component.isDisplayable()
,KeyboardFocusManager.clearGlobalFocusOwner()
setFocusable void
setFocusable(boolean focusable)Sets the focusable state of this Component to the specified value.public void setFocusable(boolean focusable)-
Description copied from class:
Component
Sets the focusable state of this Component to the specified value. This value overrides the Component's default focusability.- Parameters:
focusable
- indicates whether this Component is focusable- Since:
- 1.4
- See Also:
Component.isFocusable()
setFocusCycleRoot void
setFocusCycleRoot(boolean focusCycleRoot)Does nothing because Windows must always be roots of a focus traversal cycle.public final void setFocusCycleRoot(boolean focusCycleRoot)-
Description copied from class:
Window
Does nothing because Windows must always be roots of a focus traversal cycle. The passed-in value is ignored.- Overrides:
setFocusCycleRoot
in classContainer
- Parameters:
focusCycleRoot
- this value is ignored- Since:
- 1.4
- See Also:
Window.isFocusCycleRoot()
,Container.setFocusTraversalPolicy(java.awt.FocusTraversalPolicy)
,Container.getFocusTraversalPolicy()
setFocusTraversalKeys void
setFocusTraversalKeys(int id, java.util.Set<? extends AWTKeyStroke> keystrokes)Sets the focus traversal keys for a given traversal operation for this Container.public void setFocusTraversalKeys(int id, java.util.Set<? extends AWTKeyStroke> keystrokes)-
Description copied from class:
Container
Sets the focus traversal keys for a given traversal operation for this Container.The default values for a Container's focus traversal keys are implementation-dependent. Sun recommends that all implementations for a particular native platform use the same default values. The recommendations for Windows and Unix are listed below. These recommendations are used in the Sun AWT implementations.
Identifier Meaning Default KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS Normal forward keyboard traversal TAB on KEY_PRESSED, CTRL-TAB on KEY_PRESSED KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS Normal reverse keyboard traversal SHIFT-TAB on KEY_PRESSED, CTRL-SHIFT-TAB on KEY_PRESSED KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS Go up one focus traversal cycle none KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS Go down one focus traversal cycle none Using the AWTKeyStroke API, client code can specify on which of two specific KeyEvents, KEY_PRESSED or KEY_RELEASED, the focus traversal operation will occur. Regardless of which KeyEvent is specified, however, all KeyEvents related to the focus traversal key, including the associated KEY_TYPED event, will be consumed, and will not be dispatched to any Container. It is a runtime error to specify a KEY_TYPED event as mapping to a focus traversal operation, or to map the same event to multiple default focus traversal operations.
If a value of null is specified for the Set, this Container inherits the Set from its parent. If all ancestors of this Container have null specified for the Set, then the current KeyboardFocusManager's default Set is used.
- Overrides:
setFocusTraversalKeys
in classComponent
- Parameters:
id
- one of KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS, or KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYSkeystrokes
- the Set of AWTKeyStroke for the specified operation- Throws:
java.lang.IllegalArgumentException
- if id is not one of KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS, or KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS, or if keystrokes contains null, or if any Object in keystrokes is not an AWTKeyStroke, or if any keystroke represents a KEY_TYPED event, or if any keystroke already maps to another focus traversal operation for this Container- Since:
- 1.4
- See Also:
Container.getFocusTraversalKeys(int)
,KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS
,KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS
,KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS
,KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS
setFocusTraversalKeysEnabled void
setFocusTraversalKeysEnabled(boolean focusTraversalKeysEnabled)Sets whether focus traversal keys are enabled for this Component.public void setFocusTraversalKeysEnabled(boolean focusTraversalKeysEnabled)-
Description copied from class:
Component
Sets whether focus traversal keys are enabled for this Component. Components for which focus traversal keys are disabled receive key events for focus traversal keys. Components for which focus traversal keys are enabled do not see these events; instead, the events are automatically converted to traversal operations.- Parameters:
focusTraversalKeysEnabled
- whether focus traversal keys are enabled for this Component- Since:
- 1.4
- See Also:
Component.getFocusTraversalKeysEnabled()
,Component.setFocusTraversalKeys(int, java.util.Set<? extends java.awt.AWTKeyStroke>)
,Component.getFocusTraversalKeys(int)
setFocusTraversalPolicy void
setFocusTraversalPolicy(FocusTraversalPolicy policy)Sets the focus traversal policy that will manage keyboard traversal of this Container's children, if this Container is a focus cycle root.public void setFocusTraversalPolicy(FocusTraversalPolicy policy)-
Description copied from class:
Container
Sets the focus traversal policy that will manage keyboard traversal of this Container's children, if this Container is a focus cycle root. If the argument is null, this Container inherits its policy from its focus- cycle-root ancestor. If the argument is non-null, this policy will be inherited by all focus-cycle-root children that have no keyboard- traversal policy of their own (as will, recursively, their focus-cycle- root children).If this Container is not a focus cycle root, the policy will be remembered, but will not be used or inherited by this or any other Containers until this Container is made a focus cycle root.
- Parameters:
policy
- the new focus traversal policy for this Container- Since:
- 1.4
- See Also:
Container.getFocusTraversalPolicy()
,Container.setFocusCycleRoot(boolean)
,Container.isFocusCycleRoot(java.awt.Container)
setFocusTraversalPolicyProvider void
setFocusTraversalPolicyProvider(boolean provider)Sets whether this container will be used to provide focus traversal policy.public final void setFocusTraversalPolicyProvider(boolean provider)-
Description copied from class:
Container
Sets whether this container will be used to provide focus traversal policy. Container with this property astrue
will be used to acquire focus traversal policy instead of closest focus cycle root ancestor.- Parameters:
provider
- indicates whether this container will be used to provide focus traversal policy- Since:
- 1.5
- See Also:
Container.setFocusTraversalPolicy(java.awt.FocusTraversalPolicy)
,Container.getFocusTraversalPolicy()
,Container.isFocusTraversalPolicyProvider()
transferFocus void
transferFocus()Transfers the focus to the next component, as though this Component were the focus owner.public void transferFocus()-
Description copied from class:
Component
Transfers the focus to the next component, as though this Component were the focus owner.- Since:
- JDK1.1
- See Also:
Component.requestFocus()
transferFocusBackward void
transferFocusBackward()Transfers the focus to the previous component, as though this Component were the focus owner.public void transferFocusBackward()-
Description copied from class:
Component
Transfers the focus to the previous component, as though this Component were the focus owner.- Since:
- 1.4
- See Also:
Component.requestFocus()
transferFocusDownCycle void
transferFocusDownCycle()Transfers the focus down one focus traversal cycle.public void transferFocusDownCycle()-
Description copied from class:
Container
Transfers the focus down one focus traversal cycle. If this Container is a focus cycle root, then the focus owner is set to this Container's default Component to focus, and the current focus cycle root is set to this Container. If this Container is not a focus cycle root, then no focus traversal operation occurs.
transferFocusUpCycle void
transferFocusUpCycle()Transfers the focus up one focus traversal cycle.public void transferFocusUpCycle()-
Description copied from class:
Component
Transfers the focus up one focus traversal cycle. Typically, the focus owner is set to this Component's focus cycle root, and the current focus cycle root is set to the new focus owner's focus cycle root. If, however, this Component's focus cycle root is a Window, then the focus owner is set to the focus cycle root's default Component to focus, and the current focus cycle root is unchanged.- Since:
- 1.4
- See Also:
Component.requestFocus()
,Container.isFocusCycleRoot()
,Container.setFocusCycleRoot(boolean)
-
-
Graphics Methods Modifier and Type Method and Description getFontMetrics FontMetrics
getFontMetrics(Font font)Gets the font metrics for the specified font.-
Description copied from class:
Component
Gets the font metrics for the specified font. Warning: Since Font metrics are affected by theFontRenderContext
and this method does not provide one, it can return only metrics for the default render context which may not match that used when rendering on the Component ifGraphics2D
functionality is being used. Instead metrics can be obtained at rendering time by callingGraphics.getFontMetrics()
or text measurement APIs on theFont
class.- Parameters:
font
- the font for which font metrics is to be obtained- Returns:
- the font metrics for
font
- Since:
- JDK1.0
- See Also:
Component.getFont()
,Component.getPeer()
,ComponentPeer.getFontMetrics(Font)
,Toolkit.getFontMetrics(Font)
getGraphics Graphics
getGraphics()Creates a graphics context for this component.public Graphics getGraphics()-
Description copied from class:
Component
Creates a graphics context for this component. This method will returnnull
if this component is currently not displayable.- Returns:
- a graphics context for this component, or
null
if it has none - Since:
- JDK1.0
- See Also:
Component.paint(java.awt.Graphics)
getGraphicsConfiguration GraphicsConfiguration
getGraphicsConfiguration()Gets theGraphicsConfiguration
associated with thisComponent
.public GraphicsConfiguration getGraphicsConfiguration()-
Description copied from class:
Component
Gets theGraphicsConfiguration
associated with thisComponent
. If theComponent
has not been assigned a specificGraphicsConfiguration
, theGraphicsConfiguration
of theComponent
object's top-level container is returned. If theComponent
has been created, but not yet added to aContainer
, this method returnsnull
.- Returns:
- the
GraphicsConfiguration
used by thisComponent
ornull
- Since:
- 1.3
getLocationOnScreen Point
getLocationOnScreen()Gets the location of this component in the form of a point specifying the component's top-left corner in the screen's coordinate space.public Point getLocationOnScreen()-
Description copied from class:
Component
Gets the location of this component in the form of a point specifying the component's top-left corner in the screen's coordinate space.- Returns:
- an instance of
Point
representing the top-left corner of the component's bounds in the coordinate space of the screen - Throws:
- if the component is not showing on the screenIllegalComponentStateException
- See Also:
Component.setLocation(int, int)
,Component.getLocation()
getMousePosition Point
getMousePosition()Returns the position of the mouse pointer in thisComponent
's coordinate space if theComponent
is directly under the mouse pointer, otherwise returnsnull
.-
Description copied from class:
Component
Returns the position of the mouse pointer in thisComponent
's coordinate space if theComponent
is directly under the mouse pointer, otherwise returnsnull
. If theComponent
is not showing on the screen, this method returnsnull
even if the mouse pointer is above the area where theComponent
would be displayed. If theComponent
is partially or fully obscured by otherComponent
s or native windows, this method returns a non-null value only if the mouse pointer is located above the unobscured part of theComponent
.For
Container
s it returns a non-null value if the mouse is above theContainer
itself or above any of its descendants. UseContainer.getMousePosition(boolean)
if you need to exclude children.Sometimes the exact mouse coordinates are not important, and the only thing that matters is whether a specific
Component
is under the mouse pointer. If the return value of this method isnull
, mouse pointer is not directly above theComponent
.- Returns:
- mouse coordinates relative to this
Component
, or null - Throws:
HeadlessException
- if GraphicsEnvironment.isHeadless() returns true- Since:
- 1.5
- See Also:
Component.isShowing()
,Container.getMousePosition(boolean)
getToolkit Toolkit
getToolkit()Returns the toolkit of this frame.public Toolkit getToolkit()-
Description copied from class:
Window
Returns the toolkit of this frame.- Overrides:
getToolkit
in classComponent
- Returns:
- the toolkit of this window.
- See Also:
Toolkit
,Toolkit.getDefaultToolkit()
,Component.getToolkit()
-
-
Hierarchy Methods Modifier and Type Method and Description add Component
add(Component comp)Appends the specified component to the end of this container.-
Description copied from class:
Container
Appends the specified component to the end of this container. This is a convenience method forContainer.addImpl(java.awt.Component, java.lang.Object, int)
.This method changes layout-related information, and therefore, invalidates the component hierarchy. If the container has already been displayed, the hierarchy must be validated thereafter in order to display the added component.
- Parameters:
comp
- the component to be added- Returns:
- the component argument
- Throws:
java.lang.NullPointerException
- ifcomp
isnull
- See Also:
Container.addImpl(java.awt.Component, java.lang.Object, int)
,Container.invalidate()
,Container.validate()
,JComponent.revalidate()
add Component
add(Component comp, int index)Adds the specified component to this container at the given position.-
Description copied from class:
Container
Adds the specified component to this container at the given position. This is a convenience method forContainer.addImpl(java.awt.Component, java.lang.Object, int)
.This method changes layout-related information, and therefore, invalidates the component hierarchy. If the container has already been displayed, the hierarchy must be validated thereafter in order to display the added component.
- Parameters:
comp
- the component to be addedindex
- the position at which to insert the component, or-1
to append the component to the end- Returns:
- the component
comp
- Throws:
java.lang.NullPointerException
- ifcomp
isnull
java.lang.IllegalArgumentException
- ifindex
is invalid (seeContainer.addImpl(java.awt.Component, java.lang.Object, int)
for details)- See Also:
Container.addImpl(java.awt.Component, java.lang.Object, int)
,Container.remove(int)
,Container.invalidate()
,Container.validate()
,JComponent.revalidate()
add void
add(Component comp, java.lang.Object constraints)Adds the specified component to the end of this container.public void add(Component comp, java.lang.Object constraints)-
Description copied from class:
Container
Adds the specified component to the end of this container. Also notifies the layout manager to add the component to this container's layout using the specified constraints object. This is a convenience method forContainer.addImpl(java.awt.Component, java.lang.Object, int)
.This method changes layout-related information, and therefore, invalidates the component hierarchy. If the container has already been displayed, the hierarchy must be validated thereafter in order to display the added component.
- Parameters:
comp
- the component to be addedconstraints
- an object expressing layout contraints for this component- Throws:
java.lang.NullPointerException
- ifcomp
isnull
- Since:
- JDK1.1
- See Also:
Container.addImpl(java.awt.Component, java.lang.Object, int)
,Container.invalidate()
,Container.validate()
,JComponent.revalidate()
,LayoutManager
add void
add(Component comp, java.lang.Object constraints, int index)Adds the specified component to this container with the specified constraints at the specified index.public void add(Component comp, java.lang.Object constraints, int index)-
Description copied from class:
Container
Adds the specified component to this container with the specified constraints at the specified index. Also notifies the layout manager to add the component to the this container's layout using the specified constraints object. This is a convenience method forContainer.addImpl(java.awt.Component, java.lang.Object, int)
.This method changes layout-related information, and therefore, invalidates the component hierarchy. If the container has already been displayed, the hierarchy must be validated thereafter in order to display the added component.
- Parameters:
comp
- the component to be addedconstraints
- an object expressing layout contraints for thisindex
- the position in the container's list at which to insert the component;-1
means insert at the end component- Throws:
java.lang.NullPointerException
- ifcomp
isnull
java.lang.IllegalArgumentException
- ifindex
is invalid (seeContainer.addImpl(java.awt.Component, java.lang.Object, int)
for details)- See Also:
Container.addImpl(java.awt.Component, java.lang.Object, int)
,Container.invalidate()
,Container.validate()
,JComponent.revalidate()
,Container.remove(int)
,LayoutManager
add Component
add(java.lang.String name, Component comp)Adds the specified component to this container.-
Description copied from class:
Container
Adds the specified component to this container. This is a convenience method forContainer.addImpl(java.awt.Component, java.lang.Object, int)
.This method is obsolete as of 1.1. Please use the method
add(Component, Object)
instead.This method changes layout-related information, and therefore, invalidates the component hierarchy. If the container has already been displayed, the hierarchy must be validated thereafter in order to display the added component.
- Throws:
java.lang.NullPointerException
- ifcomp
isnull
- See Also:
Container.add(Component, Object)
,Container.invalidate()
addImpl protected void
addImpl(Component comp, java.lang.Object constraints, int index)Adds the specified component to this container at the specified index.protected void addImpl(Component comp, java.lang.Object constraints, int index)-
Description copied from class:
Container
Adds the specified component to this container at the specified index. This method also notifies the layout manager to add the component to this container's layout using the specified constraints object via theaddLayoutComponent
method.The constraints are defined by the particular layout manager being used. For example, the
BorderLayout
class defines five constraints:BorderLayout.NORTH
,BorderLayout.SOUTH
,BorderLayout.EAST
,BorderLayout.WEST
, andBorderLayout.CENTER
.The
GridBagLayout
class requires aGridBagConstraints
object. Failure to pass the correct type of constraints object results in anIllegalArgumentException
.If the current layout manager implements
LayoutManager2
, thenLayoutManager2.addLayoutComponent(Component,Object)
is invoked on it. If the current layout manager does not implementLayoutManager2
, and constraints is aString
, thenLayoutManager.addLayoutComponent(String,Component)
is invoked on it.If the component is not an ancestor of this container and has a non-null parent, it is removed from its current parent before it is added to this container.
This is the method to override if a program needs to track every add request to a container as all other add methods defer to this one. An overriding method should usually include a call to the superclass's version of the method:
super.addImpl(comp, constraints, index)
This method changes layout-related information, and therefore, invalidates the component hierarchy. If the container has already been displayed, the hierarchy must be validated thereafter in order to display the added component.
- Parameters:
comp
- the component to be addedconstraints
- an object expressing layout constraints for this componentindex
- the position in the container's list at which to insert the component, where-1
means append to the end- Throws:
java.lang.IllegalArgumentException
- ifindex
is invalid; ifcomp
is a child of this container, the valid range is[-1, getComponentCount()-1]
; if component is not a child of this container, the valid range is[-1, getComponentCount()]
java.lang.IllegalArgumentException
- ifcomp
is an ancestor of this containerjava.lang.IllegalArgumentException
- if adding a window to a containerjava.lang.NullPointerException
- ifcomp
isnull
- Since:
- JDK1.1
- See Also:
Container.add(Component)
,Container.add(Component, int)
,Container.add(Component, java.lang.Object)
,Container.invalidate()
,LayoutManager
,LayoutManager2
countComponents int
countComponents()Deprecated. As of JDK version 1.1, replaced by getComponentCount().@Deprecated public int countComponents()Deprecated. As of JDK version 1.1, replaced by getComponentCount().getComponent Component
getComponent(int n)Gets the nth component in this container.public Component getComponent(int n)-
Description copied from class:
Container
Gets the nth component in this container.Note: This method should be called under AWT tree lock.
- Parameters:
n
- the index of the component to get.- Returns:
- the nth component in this container.
- Throws:
java.lang.ArrayIndexOutOfBoundsException
- if the nth value does not exist.- See Also:
Component.getTreeLock()
getComponentCount int
getComponentCount()Gets the number of components in this panel.public int getComponentCount()-
Description copied from class:
Container
Gets the number of components in this panel.Note: This method should be called under AWT tree lock.
- Returns:
- the number of components in this panel.
- Since:
- JDK1.1
- See Also:
Container.getComponent(int)
,Component.getTreeLock()
getComponents Component[]
getComponents()Gets all the components in this container.public Component[] getComponents()-
Description copied from class:
Container
Gets all the components in this container.Note: This method should be called under AWT tree lock.
- Returns:
- an array of all the components in this container.
- See Also:
Component.getTreeLock()
getComponentZOrder int
getComponentZOrder(Component comp)Returns the z-order index of the component inside the container.public int getComponentZOrder(Component comp)-
Description copied from class:
Container
Returns the z-order index of the component inside the container. The higher a component is in the z-order hierarchy, the lower its index. The component with the lowest z-order index is painted last, above all other child components.- Parameters:
comp
- the component being queried- Returns:
- the z-order index of the component; otherwise
returns -1 if the component is
null
or doesn't belong to the container - Since:
- 1.5
- See Also:
Container.setComponentZOrder(java.awt.Component, int)
isAncestorOf boolean
isAncestorOf(Component c)Checks if the component is contained in the component hierarchy of this container.remove void
remove(Component comp)Removes the specified component from this container.public void remove(Component comp)-
Description copied from class:
Container
Removes the specified component from this container. This method also notifies the layout manager to remove the component from this container's layout via theremoveLayoutComponent
method.This method changes layout-related information, and therefore, invalidates the component hierarchy. If the container has already been displayed, the hierarchy must be validated thereafter in order to reflect the changes.
- Parameters:
comp
- the component to be removed- Throws:
java.lang.NullPointerException
- ifcomp
isnull
- See Also:
Container.add(java.awt.Component)
,Container.invalidate()
,Container.validate()
,Container.remove(int)
remove void
remove(int index)Removes the component, specified byindex
, from this container.public void remove(int index)-
Description copied from class:
Container
Removes the component, specified byindex
, from this container. This method also notifies the layout manager to remove the component from this container's layout via theremoveLayoutComponent
method.This method changes layout-related information, and therefore, invalidates the component hierarchy. If the container has already been displayed, the hierarchy must be validated thereafter in order to reflect the changes.
- Parameters:
index
- the index of the component to be removed- Throws:
java.lang.ArrayIndexOutOfBoundsException
- ifindex
is not in range[0, getComponentCount()-1]
- Since:
- JDK1.1
- See Also:
Container.add(java.awt.Component)
,Container.invalidate()
,Container.validate()
,Container.getComponentCount()
removeAll void
removeAll()Removes all the components from this container.public void removeAll()-
Description copied from class:
Container
Removes all the components from this container. This method also notifies the layout manager to remove the components from this container's layout via theremoveLayoutComponent
method.This method changes layout-related information, and therefore, invalidates the component hierarchy. If the container has already been displayed, the hierarchy must be validated thereafter in order to reflect the changes.
setComponentZOrder void
setComponentZOrder(Component comp, int index)Moves the specified component to the specified z-order index in the container.public void setComponentZOrder(Component comp, int index)-
Description copied from class:
Container
Moves the specified component to the specified z-order index in the container. The z-order determines the order that components are painted; the component with the highest z-order paints first and the component with the lowest z-order paints last. Where components overlap, the component with the lower z-order paints over the component with the higher z-order.If the component is a child of some other container, it is removed from that container before being added to this container. The important difference between this method and
java.awt.Container.add(Component, int)
is that this method doesn't callremoveNotify
on the component while removing it from its previous container unless necessary and when allowed by the underlying native windowing system. This way, if the component has the keyboard focus, it maintains the focus when moved to the new position.This property is guaranteed to apply only to lightweight non-
Container
components.This method changes layout-related information, and therefore, invalidates the component hierarchy.
Note: Not all platforms support changing the z-order of heavyweight components from one container into another without the call to
removeNotify
. There is no way to detect whether a platform supports this, so developers shouldn't make any assumptions.- Parameters:
comp
- the component to be movedindex
- the position in the container's list to insert the component, wheregetComponentCount()
appends to the end- Throws:
java.lang.NullPointerException
- ifcomp
isnull
java.lang.IllegalArgumentException
- ifcomp
is one of the container's parentsjava.lang.IllegalArgumentException
- ifindex
is not in the range[0, getComponentCount()]
for moving between containers, or not in the range[0, getComponentCount()-1]
for moving inside a containerjava.lang.IllegalArgumentException
- if adding a container to itselfjava.lang.IllegalArgumentException
- if adding aWindow
to a container- Since:
- 1.5
- See Also:
Container.getComponentZOrder(java.awt.Component)
,Container.invalidate()
-
-
Image Methods Modifier and Type Method and Description checkImage int
checkImage(Image image, java.awt.image.ImageObserver observer)Returns the status of the construction of a screen representation of the specified image.public int checkImage(Image image, java.awt.image.ImageObserver observer)-
Description copied from class:
Component
Returns the status of the construction of a screen representation of the specified image.This method does not cause the image to begin loading. An application must use the
prepareImage
method to force the loading of an image.Information on the flags returned by this method can be found with the discussion of the
ImageObserver
interface.- Parameters:
image
- theImage
object whose status is being checkedobserver
- theImageObserver
object to be notified as the image is being prepared- Returns:
- the bitwise inclusive OR of
ImageObserver
flags indicating what information about the image is currently available - Since:
- JDK1.0
- See Also:
Component.prepareImage(Image, int, int, java.awt.image.ImageObserver)
,Toolkit.checkImage(Image, int, int, java.awt.image.ImageObserver)
,ImageObserver
checkImage int
checkImage(Image image, int width, int height, java.awt.image.ImageObserver observer)Returns the status of the construction of a screen representation of the specified image.public int checkImage(Image image, int width, int height, java.awt.image.ImageObserver observer)-
Description copied from class:
Component
Returns the status of the construction of a screen representation of the specified image.This method does not cause the image to begin loading. An application must use the
prepareImage
method to force the loading of an image.The
checkImage
method ofComponent
calls its peer'scheckImage
method to calculate the flags. If this component does not yet have a peer, the component's toolkit'scheckImage
method is called instead.Information on the flags returned by this method can be found with the discussion of the
ImageObserver
interface.- Parameters:
image
- theImage
object whose status is being checkedwidth
- the width of the scaled version whose status is to be checkedheight
- the height of the scaled version whose status is to be checkedobserver
- theImageObserver
object to be notified as the image is being prepared- Returns:
- the bitwise inclusive OR of
ImageObserver
flags indicating what information about the image is currently available - Since:
- JDK1.0
- See Also:
Component.prepareImage(Image, int, int, java.awt.image.ImageObserver)
,Toolkit.checkImage(Image, int, int, java.awt.image.ImageObserver)
,ImageObserver
createImage Image
createImage(java.awt.image.ImageProducer producer)Creates an image from the specified image producer.createImage Image
createImage(int width, int height)Creates an off-screen drawable image to be used for double buffering.public Image createImage(int width, int height)-
Description copied from class:
Component
Creates an off-screen drawable image to be used for double buffering.- Parameters:
width
- the specified widthheight
- the specified height- Returns:
- an off-screen drawable image, which can be used for double
buffering. The return value may be
null
if the component is not displayable. This will always happen ifGraphicsEnvironment.isHeadless()
returnstrue
. - Since:
- JDK1.0
- See Also:
Component.isDisplayable()
,GraphicsEnvironment.isHeadless()
createVolatileImage java.awt.image.VolatileImage
createVolatileImage(int width, int height)Creates a volatile off-screen drawable image to be used for double buffering.public java.awt.image.VolatileImage createVolatileImage(int width, int height)-
Description copied from class:
Component
Creates a volatile off-screen drawable image to be used for double buffering.- Parameters:
width
- the specified width.height
- the specified height.- Returns:
- an off-screen drawable image, which can be used for double
buffering. The return value may be
null
if the component is not displayable. This will always happen ifGraphicsEnvironment.isHeadless()
returnstrue
. - Since:
- 1.4
- See Also:
VolatileImage
,Component.isDisplayable()
,GraphicsEnvironment.isHeadless()
createVolatileImage java.awt.image.VolatileImage
createVolatileImage(int width, int height, ImageCapabilities caps)Creates a volatile off-screen drawable image, with the given capabilities.public java.awt.image.VolatileImage createVolatileImage(int width, int height, ImageCapabilities caps) throws AWTException-
Description copied from class:
Component
Creates a volatile off-screen drawable image, with the given capabilities. The contents of this image may be lost at any time due to operating system issues, so the image must be managed via theVolatileImage
interface.- Parameters:
width
- the specified width.height
- the specified height.caps
- the image capabilities- Returns:
- a VolatileImage object, which can be used to manage surface contents loss and capabilities.
- Throws:
AWTException
- if an image with the specified capabilities cannot be created- Since:
- 1.4
- See Also:
VolatileImage
imageUpdate boolean
imageUpdate(Image img, int infoflags, int x, int y, int w, int h)Repaints the component when the image has changed.public boolean imageUpdate(Image img, int infoflags, int x, int y, int w, int h)-
Description copied from class:
Component
Repaints the component when the image has changed. ThisimageUpdate
method of anImageObserver
is called when more information about an image which had been previously requested using an asynchronous routine such as thedrawImage
method ofGraphics
becomes available. See the definition ofimageUpdate
for more information on this method and its arguments.The
imageUpdate
method ofComponent
incrementally draws an image on the component as more of the bits of the image are available.If the system property
awt.image.incrementaldraw
is missing or has the valuetrue
, the image is incrementally drawn. If the system property has any other value, then the image is not drawn until it has been completely loaded.Also, if incremental drawing is in effect, the value of the system property
awt.image.redrawrate
is interpreted as an integer to give the maximum redraw rate, in milliseconds. If the system property is missing or cannot be interpreted as an integer, the redraw rate is once every 100ms.The interpretation of the
x
,y
,width
, andheight
arguments depends on the value of theinfoflags
argument.- Specified by:
imageUpdate
in interfacejava.awt.image.ImageObserver
- Parameters:
img
- the image being observedinfoflags
- seeimageUpdate
for more informationx
- the x coordinatey
- the y coordinatew
- the widthh
- the height- Returns:
false
if the infoflags indicate that the image is completely loaded;true
otherwise.- Since:
- JDK1.0
- See Also:
ImageObserver
,Graphics.drawImage(Image, int, int, Color, java.awt.image.ImageObserver)
,Graphics.drawImage(Image, int, int, java.awt.image.ImageObserver)
,Graphics.drawImage(Image, int, int, int, int, Color, java.awt.image.ImageObserver)
,Graphics.drawImage(Image, int, int, int, int, java.awt.image.ImageObserver)
,ImageObserver.imageUpdate(java.awt.Image, int, int, int, int, int)
prepareImage boolean
prepareImage(Image image, java.awt.image.ImageObserver observer)Prepares an image for rendering on this component.public boolean prepareImage(Image image, java.awt.image.ImageObserver observer)-
Description copied from class:
Component
Prepares an image for rendering on this component. The image data is downloaded asynchronously in another thread and the appropriate screen representation of the image is generated.- Parameters:
image
- theImage
for which to prepare a screen representationobserver
- theImageObserver
object to be notified as the image is being prepared- Returns:
true
if the image has already been fully prepared;false
otherwise- Since:
- JDK1.0
prepareImage boolean
prepareImage(Image image, int width, int height, java.awt.image.ImageObserver observer)Prepares an image for rendering on this component at the specified width and height.public boolean prepareImage(Image image, int width, int height, java.awt.image.ImageObserver observer)-
Description copied from class:
Component
Prepares an image for rendering on this component at the specified width and height.The image data is downloaded asynchronously in another thread, and an appropriately scaled screen representation of the image is generated.
- Parameters:
image
- the instance ofImage
for which to prepare a screen representationwidth
- the width of the desired screen representationheight
- the height of the desired screen representationobserver
- theImageObserver
object to be notified as the image is being prepared- Returns:
true
if the image has already been fully prepared;false
otherwise- Since:
- JDK1.0
- See Also:
ImageObserver
-
-
Layout Methods Modifier and Type Method and Description bounds Rectangle
bounds()Deprecated. As of JDK version 1.1, replaced bygetBounds()
.contains boolean
contains(int x, int y)Checks whether this component "contains" the specified point, wherex
andy
are defined to be relative to the coordinate system of this component.public boolean contains(int x, int y)-
Description copied from class:
Component
Checks whether this component "contains" the specified point, wherex
andy
are defined to be relative to the coordinate system of this component.- Parameters:
x
- the x coordinate of the pointy
- the y coordinate of the point- Since:
- JDK1.1
- See Also:
Component.getComponentAt(int, int)
contains boolean
contains(Point p)Checks whether this component "contains" the specified point, where the point's x and y coordinates are defined to be relative to the coordinate system of this component.public boolean contains(Point p)-
Description copied from class:
Component
Checks whether this component "contains" the specified point, where the point's x and y coordinates are defined to be relative to the coordinate system of this component.- Parameters:
p
- the point- Throws:
java.lang.NullPointerException
- ifp
isnull
- Since:
- JDK1.1
- See Also:
Component.getComponentAt(Point)
doLayout void
doLayout()Causes this container to lay out its components.public void doLayout()-
Description copied from class:
Container
Causes this container to lay out its components. Most programs should not call this method directly, but should invoke thevalidate
method instead.- Overrides:
doLayout
in classComponent
- Since:
- JDK1.1
- See Also:
LayoutManager.layoutContainer(java.awt.Container)
,Container.setLayout(java.awt.LayoutManager)
,Container.validate()
findComponentAt Component
findComponentAt(int x, int y)Locates the visible child component that contains the specified position.public Component findComponentAt(int x, int y)-
Description copied from class:
Container
Locates the visible child component that contains the specified position. The top-most child component is returned in the case where there is overlap in the components. If the containing child component is a Container, this method will continue searching for the deepest nested child component. Components which are not visible are ignored during the search.The findComponentAt method is different from getComponentAt in that getComponentAt only searches the Container's immediate children; if the containing component is a Container, findComponentAt will search that child to find a nested component.
- Parameters:
x
- the x coordinatey
- the y coordinate- Returns:
- null if the component does not contain the position. If there is no child component at the requested point and the point is within the bounds of the container the container itself is returned.
- Since:
- 1.2
- See Also:
Component.contains(int, int)
,Container.getComponentAt(int, int)
findComponentAt Component
findComponentAt(Point p)Locates the visible child component that contains the specified point.-
Description copied from class:
Container
Locates the visible child component that contains the specified point. The top-most child component is returned in the case where there is overlap in the components. If the containing child component is a Container, this method will continue searching for the deepest nested child component. Components which are not visible are ignored during the search.The findComponentAt method is different from getComponentAt in that getComponentAt only searches the Container's immediate children; if the containing component is a Container, findComponentAt will search that child to find a nested component.
- Parameters:
p
- the point.- Returns:
- null if the component does not contain the position. If there is no child component at the requested point and the point is within the bounds of the container the container itself is returned.
- Throws:
java.lang.NullPointerException
- ifp
isnull
- Since:
- 1.2
- See Also:
Component.contains(int, int)
,Container.getComponentAt(int, int)
getAlignmentX float
getAlignmentX()Returns the alignment along the x axis.public float getAlignmentX()-
Description copied from class:
Container
Returns the alignment along the x axis. This specifies how the component would like to be aligned relative to other components. The value should be a number between 0 and 1 where 0 represents alignment along the origin, 1 is aligned the furthest away from the origin, 0.5 is centered, etc.- Overrides:
getAlignmentX
in classComponent
getAlignmentY float
getAlignmentY()Returns the alignment along the y axis.public float getAlignmentY()-
Description copied from class:
Container
Returns the alignment along the y axis. This specifies how the component would like to be aligned relative to other components. The value should be a number between 0 and 1 where 0 represents alignment along the origin, 1 is aligned the furthest away from the origin, 0.5 is centered, etc.- Overrides:
getAlignmentY
in classComponent
getBaseline int
getBaseline(int width, int height)Returns the baseline.public int getBaseline(int width, int height)-
Description copied from class:
Component
Returns the baseline. The baseline is measured from the top of the component. This method is primarily meant forLayoutManager
s to align components along their baseline. A return value less than 0 indicates this component does not have a reasonable baseline and thatLayoutManager
s should not align this component on its baseline.The default implementation returns -1. Subclasses that support baseline should override appropriately. If a value >= 0 is returned, then the component has a valid baseline for any size >= the minimum size and
getBaselineResizeBehavior
can be used to determine how the baseline changes with size.- Parameters:
width
- the width to get the baseline forheight
- the height to get the baseline for- Returns:
- the baseline or < 0 indicating there is no reasonable baseline
- Throws:
java.lang.IllegalArgumentException
- if width or height is < 0- Since:
- 1.6
- See Also:
Component.getBaselineResizeBehavior()
,FontMetrics
getBaselineResizeBehavior Component.BaselineResizeBehavior
getBaselineResizeBehavior()Returns an enum indicating how the baseline of the component changes as the size changes.public Component.BaselineResizeBehavior getBaselineResizeBehavior()-
Description copied from class:
Component
Returns an enum indicating how the baseline of the component changes as the size changes. This method is primarily meant for layout managers and GUI builders.The default implementation returns
BaselineResizeBehavior.OTHER
. Subclasses that have a baseline should override appropriately. Subclasses should never returnnull
; if the baseline can not be calculated returnBaselineResizeBehavior.OTHER
. Callers should first ask for the baseline usinggetBaseline
and if a value >= 0 is returned use this method. It is acceptable for this method to return a value other thanBaselineResizeBehavior.OTHER
even ifgetBaseline
returns a value less than 0.- Returns:
- an enum indicating how the baseline changes as the component size changes
- Since:
- 1.6
- See Also:
Component.getBaseline(int, int)
getBounds Rectangle
getBounds()Gets the bounds of this component in the form of aRectangle
object.public Rectangle getBounds()-
Description copied from class:
Component
Gets the bounds of this component in the form of aRectangle
object. The bounds specify this component's width, height, and location relative to its parent.- Returns:
- a rectangle indicating this component's bounds
- See Also:
Component.setBounds(int, int, int, int)
,Component.getLocation()
,Component.getSize()
getBounds Rectangle
getBounds(Rectangle rv)Stores the bounds of this component into "return value" rv and return rv.-
Description copied from class:
Component
Stores the bounds of this component into "return value" rv and return rv. If rv isnull
a newRectangle
is allocated. This version ofgetBounds
is useful if the caller wants to avoid allocating a newRectangle
object on the heap.- Parameters:
rv
- the return value, modified to the components bounds- Returns:
- rv
getComponentAt Component
getComponentAt(int x, int y)Locates the component that contains the x,y position.public Component getComponentAt(int x, int y)-
Description copied from class:
Container
Locates the component that contains the x,y position. The top-most child component is returned in the case where there is overlap in the components. This is determined by finding the component closest to the index 0 that claims to contain the given point via Component.contains(), except that Components which have native peers take precedence over those which do not (i.e., lightweight Components).- Overrides:
getComponentAt
in classComponent
- Parameters:
x
- the x coordinatey
- the y coordinate- Returns:
- null if the component does not contain the position. If there is no child component at the requested point and the point is within the bounds of the container the container itself is returned; otherwise the top-most child is returned.
- Since:
- JDK1.1
- See Also:
Component.contains(int, int)
getComponentAt Component
getComponentAt(Point p)Gets the component that contains the specified point.-
Description copied from class:
Container
Gets the component that contains the specified point.- Overrides:
getComponentAt
in classComponent
- Parameters:
p
- the point.- Returns:
- returns the component that contains the point,
or
null
if the component does not contain the point. - Since:
- JDK1.1
- See Also:
Component.contains(int, int)
getHeight int
getHeight()Returns the current height of this component.public int getHeight()-
Description copied from class:
Component
Returns the current height of this component. This method is preferable to writingcomponent.getBounds().height
, orcomponent.getSize().height
because it doesn't cause any heap allocations.- Returns:
- the current height of this component
- Since:
- 1.2
getInsets Insets
getInsets()Determines the insets of this container, which indicate the size of the container's border.public Insets getInsets()-
Description copied from class:
Container
Determines the insets of this container, which indicate the size of the container's border.A
Frame
object, for example, has a top inset that corresponds to the height of the frame's title bar.- Returns:
- the insets of this container.
- Since:
- JDK1.1
- See Also:
Insets
,LayoutManager
getLayout LayoutManager
getLayout()Gets the layout manager for this container.public LayoutManager getLayout()-
Description copied from class:
Container
Gets the layout manager for this container.
getLocation Point
getLocation()Gets the location of this component in the form of a point specifying the component's top-left corner.public Point getLocation()-
Description copied from class:
Component
Gets the location of this component in the form of a point specifying the component's top-left corner. The location will be relative to the parent's coordinate space.Due to the asynchronous nature of native event handling, this method can return outdated values (for instance, after several calls of
setLocation()
in rapid succession). For this reason, the recommended method of obtaining a component's position is withinjava.awt.event.ComponentListener.componentMoved()
, which is called after the operating system has finished moving the component.- Returns:
- an instance of
Point
representing the top-left corner of the component's bounds in the coordinate space of the component's parent - Since:
- JDK1.1
- See Also:
Component.setLocation(int, int)
,Component.getLocationOnScreen()
getLocation Point
getLocation(Point rv)Stores the x,y origin of this component into "return value" rv and return rv.-
Description copied from class:
Component
Stores the x,y origin of this component into "return value" rv and return rv. If rv isnull
a newPoint
is allocated. This version ofgetLocation
is useful if the caller wants to avoid allocating a newPoint
object on the heap.- Parameters:
rv
- the return value, modified to the components location- Returns:
- rv
getMaximumSize Dimension
getMaximumSize()Returns the maximum size of this container.public Dimension getMaximumSize()-
Description copied from class:
Container
Returns the maximum size of this container. If the maximum size has not been set explicitly byComponent.setMaximumSize(Dimension)
and theLayoutManager
installed on thisContainer
is an instance ofLayoutManager2
, thenLayoutManager2.maximumLayoutSize(Container)
is used to calculate the maximum size.Note: some implementations may cache the value returned from the
LayoutManager2
. Implementations that cache need not invokemaximumLayoutSize
on theLayoutManager2
every time this method is invoked, rather theLayoutManager2
will only be queried after theContainer
becomes invalid.- Overrides:
getMaximumSize
in classComponent
- Returns:
- an instance of
Dimension
that represents the maximum size of this container. - See Also:
Container.getPreferredSize()
,Container.getMinimumSize()
,Container.getLayout()
,LayoutManager2.maximumLayoutSize(Container)
,Component.getMaximumSize()
getMinimumSize Dimension
getMinimumSize()Returns the minimum size of this container.public Dimension getMinimumSize()-
Description copied from class:
Container
Returns the minimum size of this container. If the minimum size has not been set explicitly byComponent.setMinimumSize(Dimension)
and thisContainer
has anon-null
LayoutManager
, thenLayoutManager.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 invokeminimumLayoutSize
on theLayoutManager
every time this method is invoked, rather theLayoutManager
will only be queried after theContainer
becomes invalid.- Overrides:
getMinimumSize
in classComponent
- Returns:
- an instance of
Dimension
that represents the minimum size of this container. - Since:
- JDK1.1
- See Also:
Container.getPreferredSize()
,Container.getMaximumSize()
,Container.getLayout()
,LayoutManager.minimumLayoutSize(Container)
,Component.getMinimumSize()
getMousePosition Point
getMousePosition(boolean allowChildren)Returns the position of the mouse pointer in thisContainer
's coordinate space if theContainer
is under the mouse pointer, otherwise returnsnull
.-
Description copied from class:
Container
Returns the position of the mouse pointer in thisContainer
's coordinate space if theContainer
is under the mouse pointer, otherwise returnsnull
. This method is similar toComponent.getMousePosition()
with the exception that it can take theContainer
's children into account. IfallowChildren
isfalse
, this method will return a non-null value only if the mouse pointer is above theContainer
directly, not above the part obscured by children. IfallowChildren
istrue
, this method returns a non-null value if the mouse pointer is aboveContainer
or any of its descendants.- Parameters:
allowChildren
- true if children should be taken into account- Returns:
- mouse coordinates relative to this
Component
, or null - Throws:
HeadlessException
- if GraphicsEnvironment.isHeadless() returns true- Since:
- 1.5
- See Also:
Component.getMousePosition()
getPreferredSize Dimension
getPreferredSize()Returns the preferred size of this container.public Dimension getPreferredSize()-
Description copied from class:
Container
Returns the preferred size of this container. If the preferred size has not been set explicitly byComponent.setPreferredSize(Dimension)
and thisContainer
has anon-null
LayoutManager
, thenLayoutManager.preferredLayoutSize(Container)
is used to calculate the preferred size.Note: some implementations may cache the value returned from the
LayoutManager
. Implementations that cache need not invokepreferredLayoutSize
on theLayoutManager
every time this method is invoked, rather theLayoutManager
will only be queried after theContainer
becomes invalid.- Overrides:
getPreferredSize
in classComponent
- Returns:
- an instance of
Dimension
that represents the preferred size of this container. - See Also:
Container.getMinimumSize()
,Container.getMaximumSize()
,Container.getLayout()
,LayoutManager.preferredLayoutSize(Container)
,Component.getPreferredSize()
getSize Dimension
getSize()Returns the size of this component in the form of aDimension
object.public Dimension getSize()-
Description copied from class:
Component
Returns the size of this component in the form of aDimension
object. Theheight
field of theDimension
object contains this component's height, and thewidth
field of theDimension
object contains this component's width.- Returns:
- a
Dimension
object that indicates the size of this component - Since:
- JDK1.1
- See Also:
Component.setSize(int, int)
getSize Dimension
getSize(Dimension rv)Stores the width/height of this component into "return value" rv and return rv.-
Description copied from class:
Component
Stores the width/height of this component into "return value" rv and return rv. If rv isnull
a newDimension
object is allocated. This version ofgetSize
is useful if the caller wants to avoid allocating a newDimension
object on the heap.- Parameters:
rv
- the return value, modified to the components size- Returns:
- rv
getWidth int
getWidth()Returns the current width of this component.public int getWidth()-
Description copied from class:
Component
Returns the current width of this component. This method is preferable to writingcomponent.getBounds().width
, orcomponent.getSize().width
because it doesn't cause any heap allocations.- Returns:
- the current width of this component
- Since:
- 1.2
getX int
getX()Returns the current x coordinate of the components origin.public int getX()-
Description copied from class:
Component
Returns the current x coordinate of the components origin. This method is preferable to writingcomponent.getBounds().x
, orcomponent.getLocation().x
because it doesn't cause any heap allocations.- Returns:
- the current x coordinate of the components origin
- Since:
- 1.2
getY int
getY()Returns the current y coordinate of the components origin.public int getY()-
Description copied from class:
Component
Returns the current y coordinate of the components origin. This method is preferable to writingcomponent.getBounds().y
, orcomponent.getLocation().y
because it doesn't cause any heap allocations.- Returns:
- the current y coordinate of the components origin
- Since:
- 1.2
insets Insets
insets()Deprecated. As of JDK version 1.1, replaced bygetInsets()
.inside boolean
inside(int x, int y)Deprecated. As of JDK version 1.1, replaced by contains(int, int).@Deprecated public boolean inside(int x, int y)Deprecated. As of JDK version 1.1, replaced by contains(int, int).invalidate void
invalidate()Invalidates the container.public void invalidate()-
Description copied from class:
Container
Invalidates the container.If the
LayoutManager
installed on this container is an instance of theLayoutManager2
interface, then theLayoutManager2.invalidateLayout(Container)
method is invoked on it supplying thisContainer
as the argument.Afterwards this method marks this container invalid, and invalidates its ancestors. See the
Component.invalidate()
method for more details.- Overrides:
invalidate
in classComponent
- See Also:
Container.validate()
,Container.layout()
,LayoutManager2
isMaximumSizeSet boolean
isMaximumSizeSet()Returns true if the maximum size has been set to a non-null
value otherwise returns false.public boolean isMaximumSizeSet()-
Description copied from class:
Component
Returns true if the maximum size has been set to a non-null
value otherwise returns false.- Returns:
- true if
maximumSize
is non-null
, false otherwise - Since:
- 1.5
isMinimumSizeSet boolean
isMinimumSizeSet()Returns whether or notsetMinimumSize
has been invoked with a non-null value.public boolean isMinimumSizeSet()-
Description copied from class:
Component
Returns whether or notsetMinimumSize
has been invoked with a non-null value.- Returns:
- true if
setMinimumSize
has been invoked with a non-null value. - Since:
- 1.5
isPreferredSizeSet boolean
isPreferredSizeSet()Returns true if the preferred size has been set to a non-null
value otherwise returns false.public boolean isPreferredSizeSet()-
Description copied from class:
Component
Returns true if the preferred size has been set to a non-null
value otherwise returns false.- Returns:
- true if
setPreferredSize
has been invoked with a non-null value. - Since:
- 1.5
isValid boolean
isValid()Determines whether this component is valid.public boolean isValid()-
Description copied from class:
Component
Determines whether this component is valid. A component is valid when it is correctly sized and positioned within its parent container and all its children are also valid. In order to account for peers' size requirements, components are invalidated before they are first shown on the screen. By the time the parent container is fully realized, all its components will be valid.- Returns:
true
if the component is valid,false
otherwise- Since:
- JDK1.0
- See Also:
Component.validate()
,Component.invalidate()
isValidateRoot boolean
isValidateRoot()Indicates if this container is a validate root.public boolean isValidateRoot()-
Description copied from class:
Window
Indicates if this container is a validate root.Window
objects are the validate roots, and, therefore, they override this method to returntrue
.- Overrides:
isValidateRoot
in classContainer
- Returns:
true
- Since:
- 1.7
- See Also:
Container.isValidateRoot()
layout void
layout()Deprecated. As of JDK version 1.1, replaced bydoLayout()
.@Deprecated public void layout()Deprecated. As of JDK version 1.1, replaced bydoLayout()
.locate Component
locate(int x, int y)Deprecated. As of JDK version 1.1, replaced bygetComponentAt(int, int)
.Deprecated. As of JDK version 1.1, replaced bygetComponentAt(int, int)
.location Point
location()Deprecated. As of JDK version 1.1, replaced bygetLocation()
.minimumSize Dimension
minimumSize()Deprecated. As of JDK version 1.1, replaced bygetMinimumSize()
.Deprecated. As of JDK version 1.1, replaced bygetMinimumSize()
.move void
move(int x, int y)Deprecated. As of JDK version 1.1, replaced bysetLocation(int, int)
.@Deprecated public void move(int x, int y)Deprecated. As of JDK version 1.1, replaced bysetLocation(int, int)
.preferredSize Dimension
preferredSize()Deprecated. As of JDK version 1.1, replaced bygetPreferredSize()
.Deprecated. As of JDK version 1.1, replaced bygetPreferredSize()
.reshape void
reshape(int x, int y, int width, int height)Deprecated. As of JDK version 1.1, replaced bysetBounds(int, int, int, int)
.@Deprecated public void reshape(int x, int y, int width, int height)Deprecated. As of JDK version 1.1, replaced bysetBounds(int, int, int, int)
.resize void
resize(Dimension d)Deprecated. As of JDK version 1.1, replaced bysetSize(Dimension)
.Deprecated. As of JDK version 1.1, replaced bysetSize(Dimension)
.resize void
resize(int width, int height)Deprecated. As of JDK version 1.1, replaced bysetSize(int, int)
.@Deprecated public void resize(int width, int height)Deprecated. As of JDK version 1.1, replaced bysetSize(int, int)
.revalidate void
revalidate()Revalidates the component hierarchy up to the nearest validate root.public void revalidate()-
Description copied from class:
Component
Revalidates the component hierarchy up to the nearest validate root.This method first invalidates the component hierarchy starting from this component up to the nearest validate root. Afterwards, the component hierarchy is validated starting from the nearest validate root.
This is a convenience method supposed to help application developers avoid looking for validate roots manually. Basically, it's equivalent to first calling the
Component.invalidate()
method on this component, and then calling theComponent.validate()
method on the nearest validate root.- Since:
- 1.7
- See Also:
Container.isValidateRoot()
setBounds void
setBounds(int x, int y, int width, int height)Moves and resizes this component.public void setBounds(int x, int y, int width, int height)-
Description copied from class:
Window
Moves and resizes this component. The new location of the top-left corner is specified byx
andy
, and the new size is specified bywidth
andheight
.This method changes layout-related information, and therefore, invalidates the component hierarchy.
The
width
orheight
values are automatically enlarged if either is less than the minimum size as specified by previous call tosetMinimumSize
.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.- Overrides:
setBounds
in classComponent
- Parameters:
x
- the new x-coordinate of this componenty
- the new y-coordinate of this componentwidth
- the newwidth
of this componentheight
- the newheight
of this component- Since:
- 1.6
- See Also:
Component.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()
setBounds void
setBounds(Rectangle r)Moves and resizes this component to conform to the new bounding rectangler
.public void setBounds(Rectangle r)-
Description copied from class:
Window
Moves and resizes this component to conform to the new bounding rectangler
. This component's new position is specified byr.x
andr.y
, and its new size is specified byr.width
andr.height
This method changes layout-related information, and therefore, invalidates the component hierarchy.
The
r.width
orr.height
values will be automatically enlarged if either is less than the minimum size as specified by previous call tosetMinimumSize
.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.- Overrides:
setBounds
in classComponent
- Parameters:
r
- the new bounding rectangle for this component- Since:
- 1.6
- See Also:
Component.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()
setLayout void
setLayout(LayoutManager mgr)Sets the layout manager for this container.public void setLayout(LayoutManager mgr)-
Description copied from class:
Container
Sets the layout manager for this container.This method changes layout-related information, and therefore, invalidates the component hierarchy.
- Parameters:
mgr
- the specified layout manager- See Also:
Container.doLayout()
,Container.getLayout()
,Container.invalidate()
setLocation void
setLocation(int x, int y)Moves this component to a new location.public void setLocation(int x, int y)-
Description copied from class:
Window
Moves this component to a new location. The top-left corner of the new location is specified by thex
andy
parameters in the coordinate space of this component's parent.This method changes layout-related information, and therefore, invalidates the component hierarchy.
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.- Overrides:
setLocation
in classComponent
- Parameters:
x
- the x-coordinate of the new location's top-left corner in the parent's coordinate spacey
- the y-coordinate of the new location's top-left corner in the parent's coordinate space- See Also:
Component.getLocation()
,Component.setBounds(int, int, int, int)
,Component.invalidate()
setLocation void
setLocation(Point p)Moves this component to a new location.public void setLocation(Point p)-
Description copied from class:
Window
Moves this component to a new location. The top-left corner of the new location is specified by pointp
. Pointp
is given in the parent's coordinate space.This method changes layout-related information, and therefore, invalidates the component hierarchy.
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.- Overrides:
setLocation
in classComponent
- Parameters:
p
- the point defining the top-left corner of the new location, given in the coordinate space of this component's parent- See Also:
Component.getLocation()
,Component.setBounds(int, int, int, int)
,Component.invalidate()
setMaximumSize void
setMaximumSize(Dimension maximumSize)Sets the maximum size of this component to a constant value.public void setMaximumSize(Dimension maximumSize)-
Description copied from class:
Component
Sets the maximum size of this component to a constant value. Subsequent calls togetMaximumSize
will always return this value. Setting the maximum size tonull
restores the default behavior.- Parameters:
maximumSize
- aDimension
containing the desired maximum allowable size- Since:
- 1.5
- See Also:
Component.getMaximumSize()
,Component.isMaximumSizeSet()
setMinimumSize void
setMinimumSize(Dimension minimumSize)Sets the minimum size of this window to a constant value.public void setMinimumSize(Dimension minimumSize)-
Description copied from class:
Window
Sets the minimum size of this window to a constant value. Subsequent calls togetMinimumSize
will always return this value. If current window's size is less thanminimumSize
the size of the window is automatically enlarged to honor the minimum size.If the
setSize
orsetBounds
methods are called afterwards with a width or height less than that was specified by thesetMinimumSize
method the window is automatically enlarged to meet theminimumSize
value. TheminimumSize
value also affects the behaviour of thepack
method.The default behavior is restored by setting the minimum size parameter to the
null
value.Resizing operation may be restricted if the user tries to resize window below the
minimumSize
value. This behaviour is platform-dependent.- Overrides:
setMinimumSize
in classComponent
- Parameters:
minimumSize
- the new minimum size of this window- Since:
- 1.6
- See Also:
Component.setMinimumSize(java.awt.Dimension)
,Container.getMinimumSize()
,Component.isMinimumSizeSet()
,Window.setSize(Dimension)
,Window.pack()
setPreferredSize void
setPreferredSize(Dimension preferredSize)Sets the preferred size of this component to a constant value.public void setPreferredSize(Dimension preferredSize)-
Description copied from class:
Component
Sets the preferred size of this component to a constant value. Subsequent calls togetPreferredSize
will always return this value. Setting the preferred size tonull
restores the default behavior.- Parameters:
preferredSize
- The new preferred size, or null- Since:
- 1.5
- See Also:
Component.getPreferredSize()
,Component.isPreferredSizeSet()
setSize void
setSize(Dimension d)Resizes this component so that it has widthd.width
and heightd.height
.public void setSize(Dimension d)-
Description copied from class:
Window
Resizes this component so that it has widthd.width
and heightd.height
.This method changes layout-related information, and therefore, invalidates the component hierarchy.
The
d.width
andd.height
values are automatically enlarged if either is less than the minimum size as specified by previous call tosetMinimumSize
.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.- Overrides:
setSize
in classComponent
- Parameters:
d
- the dimension specifying the new size of this component- Since:
- 1.6
- See Also:
Component.getSize()
,Window.setBounds(int, int, int, int)
,Window.setMinimumSize(java.awt.Dimension)
setSize void
setSize(int width, int height)Resizes this component so that it has widthwidth
and heightheight
.public void setSize(int width, int height)-
Description copied from class:
Window
Resizes this component so that it has widthwidth
and heightheight
.This method changes layout-related information, and therefore, invalidates the component hierarchy.
The
width
andheight
values are automatically enlarged if either is less than the minimum size as specified by previous call tosetMinimumSize
.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.- Overrides:
setSize
in classComponent
- Parameters:
width
- the new width of this component in pixelsheight
- the new height of this component in pixels- Since:
- 1.6
- See Also:
Component.getSize()
,Window.setBounds(int, int, int, int)
,Window.setMinimumSize(java.awt.Dimension)
size Dimension
size()Deprecated. As of JDK version 1.1, replaced bygetSize()
.validate void
validate()Validates this container and all of its subcomponents.public void validate()-
Description copied from class:
Container
Validates this container and all of its subcomponents.Validating a container means laying out its subcomponents. Layout-related changes, such as setting the bounds of a component, or adding a component to the container, invalidate the container automatically. Note that the ancestors of the container may be invalidated also (see
Component.invalidate()
for details.) Therefore, to restore the validity of the hierarchy, thevalidate()
method should be invoked on the top-most invalid container of the hierarchy.Validating the container may be a quite time-consuming operation. For performance reasons a developer may postpone the validation of the hierarchy till a set of layout-related operations completes, e.g. after adding all the children to the container.
If this
Container
is not valid, this method invokes thevalidateTree
method and marks thisContainer
as valid. Otherwise, no action is performed.- Overrides:
validate
in classComponent
- See Also:
Container.add(java.awt.Component)
,Container.invalidate()
,Container.isValidateRoot()
,JComponent.revalidate()
,Container.validateTree()
validateTree protected void
validateTree()Recursively descends the container tree and recomputes the layout for any subtrees marked as needing it (those marked as invalid).protected void validateTree()-
Description copied from class:
Container
Recursively descends the container tree and recomputes the layout for any subtrees marked as needing it (those marked as invalid). Synchronization should be provided by the method that calls this one:validate
.- See Also:
Container.doLayout()
,Container.validate()
-
-
Painting Methods Modifier and Type Method and Description getIgnoreRepaint boolean
getIgnoreRepaint()public boolean getIgnoreRepaint()paint void
paint(Graphics g)Paints the container.public void paint(Graphics g)-
Description copied from class:
Window
Paints the container. This forwards the paint to any lightweight components that are children of this container. If this method is reimplemented, super.paint(g) should be called so that lightweight components are properly rendered. If a child component is entirely clipped by the current clipping setting in g, paint() will not be forwarded to that child.- Overrides:
paint
in classContainer
- Parameters:
g
- the specified Graphics window- Since:
- 1.7
- See Also:
Component.update(Graphics)
paintAll void
paintAll(Graphics g)Paints this component and all of its subcomponents.public void paintAll(Graphics g)-
Description copied from class:
Component
Paints this component and all of its subcomponents.The origin of the graphics context, its (
0
,0
) coordinate point, is the top-left corner of this component. The clipping region of the graphics context is the bounding rectangle of this component.- Parameters:
g
- the graphics context to use for painting- Since:
- JDK1.0
- See Also:
Component.paint(java.awt.Graphics)
paintComponents void
paintComponents(Graphics g)Paints each of the components in this container.public void paintComponents(Graphics g)-
Description copied from class:
Container
Paints each of the components in this container.- Parameters:
g
- the graphics context.- See Also:
Component.paint(java.awt.Graphics)
,Component.paintAll(java.awt.Graphics)
repaint void
repaint()Repaints this component.public void repaint()-
Description copied from class:
Component
Repaints this component.If this component is a lightweight component, this method causes a call to this component's
paint
method as soon as possible. Otherwise, this method causes a call to this component'supdate
method as soon as possible.Note: For more information on the paint mechanisms utilitized by AWT and Swing, including information on how to write the most efficient painting code, see Painting in AWT and Swing.
- Since:
- JDK1.0
- See Also:
Component.update(Graphics)
repaint void
repaint(int x, int y, int width, int height)Repaints the specified rectangle of this component.public void repaint(int x, int y, int width, int height)-
Description copied from class:
Component
Repaints the specified rectangle of this component.If this component is a lightweight component, this method causes a call to this component's
paint
method as soon as possible. Otherwise, this method causes a call to this component'supdate
method as soon as possible.Note: For more information on the paint mechanisms utilitized by AWT and Swing, including information on how to write the most efficient painting code, see Painting in AWT and Swing.
- Parameters:
x
- the x coordinatey
- the y coordinatewidth
- the widthheight
- the height- Since:
- JDK1.0
- See Also:
Component.update(Graphics)
repaint void
repaint(long tm)Repaints the component.public void repaint(long tm)-
Description copied from class:
Component
Repaints the component. If this component is a lightweight component, this results in a call topaint
withintm
milliseconds.Note: For more information on the paint mechanisms utilitized by AWT and Swing, including information on how to write the most efficient painting code, see Painting in AWT and Swing.
- Parameters:
tm
- maximum time in milliseconds before update- Since:
- JDK1.0
- See Also:
Component.paint(java.awt.Graphics)
,Component.update(Graphics)
repaint void
repaint(long tm, int x, int y, int width, int height)Repaints the specified rectangle of this component withintm
milliseconds.public void repaint(long tm, int x, int y, int width, int height)-
Description copied from class:
Component
Repaints the specified rectangle of this component withintm
milliseconds.If this component is a lightweight component, this method causes a call to this component's
paint
method. Otherwise, this method causes a call to this component'supdate
method.Note: For more information on the paint mechanisms utilitized by AWT and Swing, including information on how to write the most efficient painting code, see Painting in AWT and Swing.
- Parameters:
tm
- maximum time in milliseconds before updatex
- the x coordinatey
- the y coordinatewidth
- the widthheight
- the height- Since:
- JDK1.0
- See Also:
Component.update(Graphics)
setIgnoreRepaint void
setIgnoreRepaint(boolean ignoreRepaint)Sets whether or not paint messages received from the operating system should be ignored.public void setIgnoreRepaint(boolean ignoreRepaint)-
Description copied from class:
Component
Sets whether or not paint messages received from the operating system should be ignored. This does not affect paint events generated in software by the AWT, unless they are an immediate response to an OS-level paint message.This is useful, for example, if running under full-screen mode and better performance is desired, or if page-flipping is used as the buffer strategy.
- Since:
- 1.4
- See Also:
Component.getIgnoreRepaint()
,Canvas.createBufferStrategy(int)
,Window.createBufferStrategy(int)
,BufferStrategy
,GraphicsDevice.setFullScreenWindow(java.awt.Window)
update void
update(Graphics g)Updates the container.public void update(Graphics g)-
Description copied from class:
Container
Updates the container. This forwards the update to any lightweight components that are children of this container. If this method is reimplemented, super.update(g) should be called so that lightweight components are properly rendered. If a child component is entirely clipped by the current clipping setting in g, update() will not be forwarded to that child.- Overrides:
update
in classComponent
- Parameters:
g
- the specified Graphics window- See Also:
Component.update(Graphics)
-
-
Printing Methods Modifier and Type Method and Description list void
list()Prints a listing of this component to the standard system output streamSystem.out
.public void list()-
Description copied from class:
Component
Prints a listing of this component to the standard system output streamSystem.out
.- Since:
- JDK1.0
- See Also:
System.out
list void
list(java.io.PrintStream out)Prints a listing of this component to the specified output stream.public void list(java.io.PrintStream out)-
Description copied from class:
Component
Prints a listing of this component to the specified output stream.- Parameters:
out
- a print stream- Throws:
java.lang.NullPointerException
- ifout
isnull
- Since:
- JDK1.0
list void
list(java.io.PrintStream out, int indent)Prints a listing of this container to the specified output stream.public void list(java.io.PrintStream out, int indent)-
Description copied from class:
Container
Prints a listing of this container to the specified output stream. The listing starts at the specified indentation.The immediate children of the container are printed with an indentation of
indent+1
. The children of those children are printed atindent+2
and so on.- Overrides:
list
in classComponent
- Parameters:
out
- a print streamindent
- the number of spaces to indent- Throws:
java.lang.NullPointerException
- ifout
isnull
- Since:
- JDK1.0
- See Also:
Component.list(java.io.PrintStream, int)
list void
list(java.io.PrintWriter out)Prints a listing to the specified print writer.public void list(java.io.PrintWriter out)-
Description copied from class:
Component
Prints a listing to the specified print writer.- Parameters:
out
- the print writer to print to- Throws:
java.lang.NullPointerException
- ifout
isnull
- Since:
- JDK1.1
list void
list(java.io.PrintWriter out, int indent)Prints out a list, starting at the specified indentation, to the specified print writer.public void list(java.io.PrintWriter out, int indent)-
Description copied from class:
Container
Prints out a list, starting at the specified indentation, to the specified print writer.The immediate children of the container are printed with an indentation of
indent+1
. The children of those children are printed atindent+2
and so on.- Overrides:
list
in classComponent
- Parameters:
out
- a print writerindent
- the number of spaces to indent- Throws:
java.lang.NullPointerException
- ifout
isnull
- Since:
- JDK1.1
- See Also:
Component.list(java.io.PrintWriter, int)
print void
print(Graphics g)Prints the container.public void print(Graphics g)-
Description copied from class:
Container
Prints the container. This forwards the print to any lightweight components that are children of this container. If this method is reimplemented, super.print(g) should be called so that lightweight components are properly rendered. If a child component is entirely clipped by the current clipping setting in g, print() will not be forwarded to that child.- Overrides:
print
in classComponent
- Parameters:
g
- the specified Graphics window- See Also:
Component.update(Graphics)
printAll void
printAll(Graphics g)Prints this component and all of its subcomponents.public void printAll(Graphics g)-
Description copied from class:
Component
Prints this component and all of its subcomponents.The origin of the graphics context, its (
0
,0
) coordinate point, is the top-left corner of this component. The clipping region of the graphics context is the bounding rectangle of this component.- Parameters:
g
- the graphics context to use for printing- Since:
- JDK1.0
- See Also:
Component.print(Graphics)
printComponents void
printComponents(Graphics g)Prints each of the components in this container.public void printComponents(Graphics g)-
Description copied from class:
Container
Prints each of the components in this container.- Parameters:
g
- the graphics context.- See Also:
Component.print(java.awt.Graphics)
,Component.printAll(java.awt.Graphics)
-
-
Other Methods Modifier and Type Method and Description add void
add(PopupMenu popup)Adds the specified popup menu to the component.public void add(PopupMenu popup)-
Description copied from class:
Component
Adds the specified popup menu to the component.- Parameters:
popup
- the popup menu to be added to the component.- Throws:
java.lang.NullPointerException
- ifpopup
isnull
- Since:
- JDK1.1
- See Also:
Component.remove(MenuComponent)
addNotify void
addNotify()Makes this Dialog displayable by connecting it to a native screen resource.public void addNotify()-
Makes this Dialog displayable by connecting it to a native screen resource. Making a dialog displayable will cause any of its children to be made displayable. This method is called internally by the toolkit and should not be called directly by programs.
- Overrides:
addNotify
in classWindow
- See Also:
Component.isDisplayable()
,Window.removeNotify()
addWindowFocusListener void
addWindowFocusListener(WindowFocusListener l)Adds the specified window focus listener to receive window events from this window.public void addWindowFocusListener(WindowFocusListener l)-
Description copied from class:
Window
Adds the specified window focus listener to receive window events from this window. If l is null, no exception is thrown and no action is performed.Refer to AWT Threading Issues for details on AWT's threading model.
- Parameters:
l
- the window focus listener- Since:
- 1.4
- See Also:
Window.removeWindowFocusListener(java.awt.event.WindowFocusListener)
,Window.getWindowFocusListeners()
addWindowListener void
addWindowListener(WindowListener l)Adds the specified window listener to receive window events from this window.public void addWindowListener(WindowListener l)-
Description copied from class:
Window
Adds the specified window listener to receive window events from this window. If l is null, no exception is thrown and no action is performed.Refer to AWT Threading Issues for details on AWT's threading model.
- Parameters:
l
- the window listener- See Also:
Window.removeWindowListener(java.awt.event.WindowListener)
,Window.getWindowListeners()
addWindowStateListener void
addWindowStateListener(WindowStateListener l)Adds the specified window state listener to receive window events from this window.public void addWindowStateListener(WindowStateListener l)-
Description copied from class:
Window
Adds the specified window state listener to receive window events from this window. Ifl
isnull
, no exception is thrown and no action is performed.Refer to AWT Threading Issues for details on AWT's threading model.
- Parameters:
l
- the window state listener- Since:
- 1.4
- See Also:
Window.removeWindowStateListener(java.awt.event.WindowStateListener)
,Window.getWindowStateListeners()
applyResourceBundle void
applyResourceBundle(java.util.ResourceBundle rb)Deprecated. As of J2SE 1.4, replaced byComponent.applyComponentOrientation
.@Deprecated public void applyResourceBundle(java.util.ResourceBundle rb)Deprecated. As of J2SE 1.4, replaced byComponent.applyComponentOrientation
.applyResourceBundle void
applyResourceBundle(java.lang.String rbName)Deprecated. As of J2SE 1.4, replaced byComponent.applyComponentOrientation
.@Deprecated public void applyResourceBundle(java.lang.String rbName)Deprecated. As of J2SE 1.4, replaced byComponent.applyComponentOrientation
.createBufferStrategy void
createBufferStrategy(int numBuffers)Creates a new strategy for multi-buffering on this component.public void createBufferStrategy(int numBuffers)-
Description copied from class:
Window
Creates a new strategy for multi-buffering on this component. Multi-buffering is useful for rendering performance. This method attempts to create the best strategy available with the number of buffers supplied. It will always create aBufferStrategy
with that number of buffers. A page-flipping strategy is attempted first, then a blitting strategy using accelerated buffers. Finally, an unaccelerated blitting strategy is used.Each time this method is called, the existing buffer strategy for this component is discarded.
- Parameters:
numBuffers
- number of buffers to create- Throws:
java.lang.IllegalArgumentException
- if numBuffers is less than 1.java.lang.IllegalStateException
- if the component is not displayable- Since:
- 1.4
- See Also:
Component.isDisplayable()
,Window.getBufferStrategy()
createBufferStrategy void
createBufferStrategy(int numBuffers, BufferCapabilities caps)Creates a new strategy for multi-buffering on this component with the required buffer capabilities.-
Description copied from class:
Window
Creates a new strategy for multi-buffering on this component with the required buffer capabilities. This is useful, for example, if only accelerated memory or page flipping is desired (as specified by the buffer capabilities).Each time this method is called, the existing buffer strategy for this component is discarded.
- Parameters:
numBuffers
- number of buffers to create, including the front buffercaps
- the required capabilities for creating the buffer strategy; cannot benull
- Throws:
AWTException
- if the capabilities supplied could not be supported or met; this may happen, for example, if there is not enough accelerated memory currently available, or if page flipping is specified but not possible.java.lang.IllegalArgumentException
- if numBuffers is less than 1, or if caps isnull
- Since:
- 1.4
- See Also:
Window.getBufferStrategy()
dispose void
dispose()Releases all of the native screen resources used by thisWindow
, its subcomponents, and all of its owned children.public void dispose()-
Description copied from class:
Window
Releases all of the native screen resources used by thisWindow
, its subcomponents, and all of its owned children. That is, the resources for theseComponent
s will be destroyed, any memory they consume will be returned to the OS, and they will be marked as undisplayable.The
Window
and its subcomponents can be made displayable again by rebuilding the native resources with a subsequent call topack
orshow
. The states of the recreatedWindow
and its subcomponents will be identical to the states of these objects at the point where theWindow
was disposed (not accounting for additional modifications between those actions).Note: When the last displayable window within the Java virtual machine (VM) is disposed of, the VM may terminate. See AWT Threading Issues for more information.
- See Also:
Component.isDisplayable()
,Window.pack()
,Window.show()
getBufferStrategy java.awt.image.BufferStrategy
getBufferStrategy()Returns theBufferStrategy
used by this component.public java.awt.image.BufferStrategy getBufferStrategy()-
Description copied from class:
Window
Returns theBufferStrategy
used by this component. This method will return null if aBufferStrategy
has not yet been created or has been disposed.- Returns:
- the buffer strategy used by this component
- Since:
- 1.4
- See Also:
Window.createBufferStrategy(int)
getDropTarget java.awt.dnd.DropTarget
getDropTarget()Gets theDropTarget
associated with thisComponent
.public java.awt.dnd.DropTarget getDropTarget()-
Description copied from class:
Component
Gets theDropTarget
associated with thisComponent
.
getFocusableWindowState boolean
getFocusableWindowState()Returns whether this Window can become the focused Window if it meets the other requirements outlined inisFocusableWindow
.public boolean getFocusableWindowState()-
Description copied from class:
Window
Returns whether this Window can become the focused Window if it meets the other requirements outlined inisFocusableWindow
. If this method returnsfalse
, thenisFocusableWindow
will returnfalse
as well. If this method returnstrue
, thenisFocusableWindow
may returntrue
orfalse
depending upon the other requirements which must be met in order for a Window to be focusable.By default, all Windows have a focusable Window state of
true
.- Returns:
- whether this Window can be the focused Window
- Since:
- 1.4
- See Also:
Window.isFocusableWindow()
,Window.setFocusableWindowState(boolean)
,Window.isShowing()
,Component.setFocusable(boolean)
getFocusOwner Component
getFocusOwner()Returns the child Component of this Window that has focus if this Window is focused; returns null otherwise.public Component getFocusOwner()-
Description copied from class:
Window
Returns the child Component of this Window that has focus if this Window is focused; returns null otherwise.- Returns:
- the child Component with focus, or null if this Window is not focused
- See Also:
Window.getMostRecentFocusOwner()
,Window.isFocused()
getIconImages java.util.List<Image>
getIconImages()Returns the sequence of images to be displayed as the icon for this window.public java.util.List<Image> getIconImages()-
Description copied from class:
Window
Returns the sequence of images to be displayed as the icon for this window.This method returns a copy of the internally stored list, so all operations on the returned object will not affect the window's behavior.
- Returns:
- the copy of icon images' list for this window, or empty list if this window doesn't have icon images.
- Since:
- 1.6
- See Also:
Window.setIconImages(java.util.List<? extends java.awt.Image>)
,Window.setIconImage(Image)
getInputContext java.awt.im.InputContext
getInputContext()Gets the input context for this window.public java.awt.im.InputContext getInputContext()-
Description copied from class:
Window
Gets the input context for this window. A window always has an input context, which is shared by subcomponents unless they create and set their own.- Overrides:
getInputContext
in classComponent
- Returns:
- the input context used by this component;
null
if no context can be determined - Since:
- 1.2
- See Also:
Component.getInputContext()
getInputMethodRequests java.awt.im.InputMethodRequests
getInputMethodRequests()Gets the input method request handler which supports requests from input methods for this component.public java.awt.im.InputMethodRequests getInputMethodRequests()-
Description copied from class:
Component
Gets the input method request handler which supports requests from input methods for this component. A component that supports on-the-spot text input must override this method to return anInputMethodRequests
instance. At the same time, it also has to handle input method events.- Returns:
- the input method request handler for this component,
null
by default - Since:
- 1.2
- See Also:
Component.addInputMethodListener(java.awt.event.InputMethodListener)
getModalExclusionType Dialog.ModalExclusionType
getModalExclusionType()Returns the modal exclusion type of this window.public Dialog.ModalExclusionType getModalExclusionType()-
Description copied from class:
Window
Returns the modal exclusion type of this window.- Returns:
- the modal exclusion type of this window
- Since:
- 1.6
- See Also:
Dialog.ModalExclusionType
,Window.setModalExclusionType(java.awt.Dialog.ModalExclusionType)
getModalityType Dialog.ModalityType
getModalityType()Returns the modality type of this dialog.public Dialog.ModalityType getModalityType()-
Returns the modality type of this dialog.
- Returns:
- modality type of this dialog
- Since:
- 1.6
- See Also:
setModalityType(java.awt.Dialog.ModalityType)
getMostRecentFocusOwner Component
getMostRecentFocusOwner()Returns the child Component of this Window that will receive the focus when this Window is focused.public Component getMostRecentFocusOwner()-
Description copied from class:
Window
Returns the child Component of this Window that will receive the focus when this Window is focused. If this Window is currently focused, this method returns the same Component asgetFocusOwner()
. If this Window is not focused, then the child Component that most recently requested focus will be returned. If no child Component has ever requested focus, and this is a focusable Window, then this Window's initial focusable Component is returned. If no child Component has ever requested focus, and this is a non-focusable Window, null is returned.- Returns:
- the child Component that will receive focus when this Window is focused
- Since:
- 1.4
- See Also:
Window.getFocusOwner()
,Window.isFocused()
,Window.isFocusableWindow()
getOpacity float
getOpacity()Returns the opacity of the window.public float getOpacity()-
Description copied from class:
Window
Returns the opacity of the window.- Returns:
- the opacity of the window
- Since:
- 1.7
- See Also:
Window.setOpacity(float)
,GraphicsDevice.WindowTranslucency
getOwnedWindows Window[]
getOwnedWindows()Return an array containing all the windows this window currently owns.getOwner Window
getOwner()Returns the owner of this window.getPeer java.awt.peer.ComponentPeer
getPeer()Deprecated. As of JDK version 1.1, programs should not directly manipulate peers; replaced byboolean isDisplayable()
.@Deprecated public java.awt.peer.ComponentPeer getPeer()Deprecated. As of JDK version 1.1, programs should not directly manipulate peers; replaced byboolean isDisplayable()
.getShape Shape
getShape()Returns the shape of the window.public Shape getShape()-
Description copied from class:
Window
Returns the shape of the window. The value returned by this method may not be the same as previously set withsetShape(shape)
, but it is guaranteed to represent the same shape.- Returns:
- the shape of the window or
null
if no shape is specified for the window - Since:
- 1.7
- See Also:
Window.setShape(Shape)
,GraphicsDevice.WindowTranslucency
getTitle java.lang.String
getTitle()Gets the title of the dialog.public java.lang.String getTitle()-
Gets the title of the dialog. The title is displayed in the dialog's border.
- Returns:
- the title of this dialog window. The title may be
null
. - See Also:
setTitle(java.lang.String)
getTreeLock java.lang.Object
getTreeLock()Gets this component's locking object (the object that owns the thread synchronization monitor) for AWT component-tree and layout operations.public final java.lang.Object getTreeLock()-
Description copied from class:
Component
Gets this component's locking object (the object that owns the thread synchronization monitor) for AWT component-tree and layout operations.- Returns:
- this component's locking object
getType Window.Type
getType()Returns the type of the window.public Window.Type getType()-
Description copied from class:
Window
Returns the type of the window.- Since:
- 1.7
- See Also:
Window.setType(java.awt.Window.Type)
getWarningString java.lang.String
getWarningString()Gets the warning string that is displayed with this window.public final java.lang.String getWarningString()-
Description copied from class:
Window
Gets the warning string that is displayed with this window. If this window is insecure, the warning string is displayed somewhere in the visible area of the window. A window is insecure if there is a security manager, and the security manager'scheckTopLevelWindow
method returnsfalse
when this window is passed to it as an argument.If the window is secure, then
getWarningString
returnsnull
. If the window is insecure, this method checks for the system propertyawt.appletWarning
and returns the string value of that property.- Returns:
- the warning string for this window.
- See Also:
SecurityManager.checkTopLevelWindow(java.lang.Object)
getWindowFocusListeners WindowFocusListener[]
getWindowFocusListeners()Returns an array of all the window focus listeners registered on this window.public WindowFocusListener[] getWindowFocusListeners()-
Description copied from class:
Window
Returns an array of all the window focus listeners registered on this window.- Returns:
- all of this window's
WindowFocusListener
s or an empty array if no window focus listeners are currently registered - Since:
- 1.4
- See Also:
Window.addWindowFocusListener(java.awt.event.WindowFocusListener)
,Window.removeWindowFocusListener(java.awt.event.WindowFocusListener)
getWindowListeners WindowListener[]
getWindowListeners()Returns an array of all the window listeners registered on this window.public WindowListener[] getWindowListeners()-
Description copied from class:
Window
Returns an array of all the window listeners registered on this window.- Returns:
- all of this window's
WindowListener
s or an empty array if no window listeners are currently registered - Since:
- 1.4
- See Also:
Window.addWindowListener(java.awt.event.WindowListener)
,Window.removeWindowListener(java.awt.event.WindowListener)
getWindowStateListeners WindowStateListener[]
getWindowStateListeners()Returns an array of all the window state listeners registered on this window.public WindowStateListener[] getWindowStateListeners()-
Description copied from class:
Window
Returns an array of all the window state listeners registered on this window.- Returns:
- all of this window's
WindowStateListener
s or an empty array if no window state listeners are currently registered - Since:
- 1.4
- See Also:
Window.addWindowStateListener(java.awt.event.WindowStateListener)
,Window.removeWindowStateListener(java.awt.event.WindowStateListener)
isActive boolean
isActive()Returns whether this Window is active.public boolean isActive()-
Description copied from class:
Window
Returns whether this Window is active. Only a Frame or a Dialog may be active. The native windowing system may denote the active Window or its children with special decorations, such as a highlighted title bar. The active Window is always either the focused Window, or the first Frame or Dialog that is an owner of the focused Window.- Returns:
- whether this is the active Window.
- Since:
- 1.4
- See Also:
Window.isFocused()
isAlwaysOnTop boolean
isAlwaysOnTop()Returns whether this window is an always-on-top window.public final boolean isAlwaysOnTop()-
Description copied from class:
Window
Returns whether this window is an always-on-top window.- Returns:
true
, if the window is in always-on-top state,false
otherwise- Since:
- 1.5
- See Also:
Window.setAlwaysOnTop(boolean)
isAlwaysOnTopSupported boolean
isAlwaysOnTopSupported()Returns whether the always-on-top mode is supported for this window.public boolean isAlwaysOnTopSupported()-
Description copied from class:
Window
Returns whether the always-on-top mode is supported for this window. Some platforms may not support always-on-top windows, some may support only some kinds of top-level windows; for example, a platform may not support always-on-top modal dialogs.- Returns:
true
, if the always-on-top mode is supported by the toolkit and for this window,false
, if always-on-top mode is not supported for this window or toolkit doesn't support always-on-top windows.- Since:
- 1.6
- See Also:
Window.setAlwaysOnTop(boolean)
,Toolkit.isAlwaysOnTopSupported()
isAutoRequestFocus boolean
isAutoRequestFocus()Returns whether this window should receive focus on subsequently being shown (with a call tosetVisible(true)
), or being moved to the front (with a call toWindow.toFront()
).public boolean isAutoRequestFocus()-
Description copied from class:
Window
Returns whether this window should receive focus on subsequently being shown (with a call tosetVisible(true)
), or being moved to the front (with a call toWindow.toFront()
).By default, the window has
autoRequestFocus
value oftrue
.- Returns:
autoRequestFocus
value- Since:
- 1.7
- See Also:
Window.setAutoRequestFocus(boolean)
isFocusableWindow boolean
isFocusableWindow()Returns whether this Window can become the focused Window, that is, whether this Window or any of its subcomponents can become the focus owner.public final boolean isFocusableWindow()-
Description copied from class:
Window
Returns whether this Window can become the focused Window, that is, whether this Window or any of its subcomponents can become the focus owner. For a Frame or Dialog to be focusable, its focusable Window state must be set totrue
. For a Window which is not a Frame or Dialog to be focusable, its focusable Window state must be set totrue
, its nearest owning Frame or Dialog must be showing on the screen, and it must contain at least one Component in its focus traversal cycle. If any of these conditions is not met, then neither this Window nor any of its subcomponents can become the focus owner.- Returns:
true
if this Window can be the focused Window;false
otherwise- Since:
- 1.4
- See Also:
Window.getFocusableWindowState()
,Window.setFocusableWindowState(boolean)
,Window.isShowing()
,Component.isFocusable()
isFocused boolean
isFocused()Returns whether this Window is focused.public boolean isFocused()-
Description copied from class:
Window
Returns whether this Window is focused. If there exists a focus owner, the focused Window is the Window that is, or contains, that focus owner. If there is no focus owner, then no Window is focused.If the focused Window is a Frame or a Dialog it is also the active Window. Otherwise, the active Window is the first Frame or Dialog that is an owner of the focused Window.
- Returns:
- whether this is the focused Window.
- Since:
- 1.4
- See Also:
Window.isActive()
isLocationByPlatform boolean
isLocationByPlatform()Returnstrue
if this Window will appear at the default location for the native windowing system the next time this Window is made visible.public boolean isLocationByPlatform()-
Description copied from class:
Window
Returnstrue
if this Window will appear at the default location for the native windowing system the next time this Window is made visible. This method always returnsfalse
if the Window is showing on the screen.- Returns:
- whether this Window will appear at the default location
- Since:
- 1.5
- See Also:
Window.setLocationByPlatform(boolean)
,Window.isShowing()
isModal boolean
isModal()Indicates whether the dialog is modal.public boolean isModal()-
Indicates whether the dialog is modal.
This method is obsolete and is kept for backwards compatiblity only. Use
getModalityType()
instead.- Returns:
true
if this dialog window is modal;false
otherwise- See Also:
DEFAULT_MODALITY_TYPE
,Dialog.ModalityType.MODELESS
,setModal(boolean)
,getModalityType()
,setModalityType(java.awt.Dialog.ModalityType)
isResizable boolean
isResizable()Indicates whether this dialog is resizable by the user.public boolean isResizable()-
Indicates whether this dialog is resizable by the user. By default, all dialogs are initially resizable.
- Returns:
true
if the user can resize the dialog;false
otherwise.- See Also:
setResizable(boolean)
isUndecorated boolean
isUndecorated()Indicates whether this dialog is undecorated.public boolean isUndecorated()-
Indicates whether this dialog is undecorated. By default, all dialogs are initially decorated.
- Returns:
true
if dialog is undecorated;false
otherwise.- Since:
- 1.4
- See Also:
setUndecorated(boolean)
pack void
pack()Causes this Window to be sized to fit the preferred size and layouts of its subcomponents.public void pack()-
Description copied from class:
Window
Causes this Window to be sized to fit the preferred size and layouts of its subcomponents. The resulting width and height of the window are automatically enlarged if either of dimensions is less than the minimum size as specified by the previous call to thesetMinimumSize
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.
paramString protected java.lang.String
paramString()Returns a string representing the state of this dialog.protected java.lang.String paramString()-
Returns a string representing the state of this dialog. This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be
null
.- Overrides:
paramString
in classContainer
- Returns:
- the parameter string of this dialog window.
processWindowEvent protected void
processWindowEvent(WindowEvent e)Processes window events occurring on this window by dispatching them to any registered WindowListener objects.protected void processWindowEvent(WindowEvent e)-
Description copied from class:
Window
Processes window events occurring on this window by dispatching them to any registered WindowListener objects. NOTE: This method will not be called unless window events are enabled for this component; this happens when one of the following occurs:- A WindowListener object is registered via
addWindowListener
- Window events are enabled via
enableEvents
Note that if the event parameter is
null
the behavior is unspecified and may result in an exception.- Parameters:
e
- the window event- See Also:
Component.enableEvents(long)
- A WindowListener object is registered via
processWindowFocusEvent protected void
processWindowFocusEvent(WindowEvent e)Processes window focus event occuring on this window by dispatching them to any registered WindowFocusListener objects.protected void processWindowFocusEvent(WindowEvent e)-
Description copied from class:
Window
Processes window focus event occuring on this window by dispatching them to any registered WindowFocusListener objects. NOTE: this method will not be called unless window focus events are enabled for this window. This happens when one of the following occurs:- a WindowFocusListener is registered via
addWindowFocusListener
- Window focus events are enabled via
enableEvents
Note that if the event parameter is
null
the behavior is unspecified and may result in an exception.- Parameters:
e
- the window focus event- Since:
- 1.4
- See Also:
Component.enableEvents(long)
- a WindowFocusListener is registered via
processWindowStateEvent protected void
processWindowStateEvent(WindowEvent e)Processes window state event occuring on this window by dispatching them to any registeredWindowStateListener
objects.protected void processWindowStateEvent(WindowEvent e)-
Description copied from class:
Window
Processes window state event occuring on this window by dispatching them to any registeredWindowStateListener
objects. NOTE: this method will not be called unless window state events are enabled for this window. This happens when one of the following occurs:- a
WindowStateListener
is registered viaaddWindowStateListener
- window state events are enabled via
enableEvents
Note that if the event parameter is
null
the behavior is unspecified and may result in an exception.- Parameters:
e
- the window state event- Since:
- 1.4
- See Also:
Component.enableEvents(long)
- a
remove void
remove(MenuComponent popup)Removes the specified popup menu from the component.public void remove(MenuComponent popup)-
Description copied from class:
Component
Removes the specified popup menu from the component.- Specified by:
remove
in interfaceMenuContainer
- Parameters:
popup
- the popup menu to be removed- Since:
- JDK1.1
- See Also:
Component.add(PopupMenu)
removeNotify void
removeNotify()Makes this Container undisplayable by removing its connection to its native screen resource.public void removeNotify()-
Description copied from class:
Window
Makes this Container undisplayable by removing its connection to its native screen resource. Making a container undisplayable will cause all of its children to be made undisplayable. This method is called by the toolkit internally and should not be called directly by programs.- Overrides:
removeNotify
in classContainer
- See Also:
Component.isDisplayable()
,Container.addNotify()
removeWindowFocusListener void
removeWindowFocusListener(WindowFocusListener l)Removes the specified window focus listener so that it no longer receives window events from this window.public void removeWindowFocusListener(WindowFocusListener l)-
Description copied from class:
Window
Removes the specified window focus listener so that it no longer receives window events from this window. If l is null, no exception is thrown and no action is performed.Refer to AWT Threading Issues for details on AWT's threading model.
- Parameters:
l
- the window focus listener- Since:
- 1.4
- See Also:
Window.addWindowFocusListener(java.awt.event.WindowFocusListener)
,Window.getWindowFocusListeners()
removeWindowListener void
removeWindowListener(WindowListener l)Removes the specified window listener so that it no longer receives window events from this window.public void removeWindowListener(WindowListener l)-
Description copied from class:
Window
Removes the specified window listener so that it no longer receives window events from this window. If l is null, no exception is thrown and no action is performed.Refer to AWT Threading Issues for details on AWT's threading model.
- Parameters:
l
- the window listener- See Also:
Window.addWindowListener(java.awt.event.WindowListener)
,Window.getWindowListeners()
removeWindowStateListener void
removeWindowStateListener(WindowStateListener l)Removes the specified window state listener so that it no longer receives window events from this window.public void removeWindowStateListener(WindowStateListener l)-
Description copied from class:
Window
Removes the specified window state listener so that it no longer receives window events from this window. Ifl
isnull
, no exception is thrown and no action is performed.Refer to AWT Threading Issues for details on AWT's threading model.
- Parameters:
l
- the window state listener- Since:
- 1.4
- See Also:
Window.addWindowStateListener(java.awt.event.WindowStateListener)
,Window.getWindowStateListeners()
setAlwaysOnTop void
setAlwaysOnTop(boolean alwaysOnTop)Sets whether this window should always be above other windows.public final void setAlwaysOnTop(boolean alwaysOnTop) throws java.lang.SecurityException-
Description copied from class:
Window
Sets whether this window should always be above other windows. If there are multiple always-on-top windows, their relative order is unspecified and platform dependent.If some other window is already always-on-top then the relative order between these windows is unspecified (depends on platform). No window can be brought to be over the always-on-top window except maybe another always-on-top window.
All windows owned by an always-on-top window inherit this state and automatically become always-on-top. If a window ceases to be always-on-top, the windows that it owns will no longer be always-on-top. When an always-on-top window is sent
toBack
, its always-on-top state is set tofalse
.When this method is called on a window with a value of
true
, and the window is visible and the platform supports always-on-top for this window, the window is immediately brought forward, "sticking" it in the top-most position. If the window isn`t currently visible, this method sets the always-on-top state totrue
but does not bring the window forward. When the window is later shown, it will be always-on-top.When this method is called on a window with a value of
false
the always-on-top state is set to normal. The window remains in the top-most position but it`s z-order can be changed as for any other window. Calling this method with a value offalse
on a window that has a normal state has no effect. Setting the always-on-top state to false has no effect on the relative z-order of the windows if there are no other always-on-top windows.Note: some platforms might not support always-on-top windows. To detect if always-on-top windows are supported by the current platform, use
Toolkit.isAlwaysOnTopSupported()
andWindow.isAlwaysOnTopSupported()
. If always-on-top mode isn't supported by the toolkit or for this window, calling this method has no effect.If a SecurityManager is installed, the calling thread must be granted the AWTPermission "setWindowAlwaysOnTop" in order to set the value of this property. If this permission is not granted, this method will throw a SecurityException, and the current value of the property will be left unchanged.
- Parameters:
alwaysOnTop
- true if the window should always be above other windows- Throws:
java.lang.SecurityException
- if the calling thread does not have permission to set the value of always-on-top property- Since:
- 1.5
- See Also:
Window.isAlwaysOnTop()
,Window.toFront()
,Window.toBack()
,AWTPermission
,Window.isAlwaysOnTopSupported()
,Toolkit.isAlwaysOnTopSupported()
setAutoRequestFocus void
setAutoRequestFocus(boolean autoRequestFocus)Sets whether this window should receive focus on subsequently being shown (with a call tosetVisible(true)
), or being moved to the front (with a call toWindow.toFront()
).public void setAutoRequestFocus(boolean autoRequestFocus)-
Description copied from class:
Window
Sets whether this window should receive focus on subsequently being shown (with a call tosetVisible(true)
), or being moved to the front (with a call toWindow.toFront()
).Note that
setVisible(true)
may be called indirectly (e.g. when showing an owner of the window makes the window to be shown).Window.toFront()
may also be called indirectly (e.g. whensetVisible(true)
is called on already visible window). In all such cases this property takes effect as well.The value of the property is not inherited by owned windows.
- Parameters:
autoRequestFocus
- whether this window should be focused on subsequently being shown or being moved to the front- Since:
- 1.7
- See Also:
Window.isAutoRequestFocus()
,Window.isFocusableWindow()
,Window.setVisible(boolean)
,Window.toFront()
setDropTarget void
setDropTarget(java.awt.dnd.DropTarget dt)Associate aDropTarget
with this component.public void setDropTarget(java.awt.dnd.DropTarget dt)-
Description copied from class:
Component
Associate aDropTarget
with this component. TheComponent
will receive drops only if it is enabled.- Parameters:
dt
- The DropTarget- See Also:
Component.isEnabled()
setFocusableWindowState void
setFocusableWindowState(boolean focusableWindowState)Sets whether this Window can become the focused Window if it meets the other requirements outlined inisFocusableWindow
.public void setFocusableWindowState(boolean focusableWindowState)-
Description copied from class:
Window
Sets whether this Window can become the focused Window if it meets the other requirements outlined inisFocusableWindow
. If this Window's focusable Window state is set tofalse
, thenisFocusableWindow
will returnfalse
. If this Window's focusable Window state is set totrue
, thenisFocusableWindow
may returntrue
orfalse
depending upon the other requirements which must be met in order for a Window to be focusable.Setting a Window's focusability state to
false
is the standard mechanism for an application to identify to the AWT a Window which will be used as a floating palette or toolbar, and thus should be a non-focusable Window. Setting the focusability state on a visibleWindow
can have a delayed effect on some platforms — the actual change may happen only when theWindow
becomes hidden and then visible again. To ensure consistent behavior across platforms, set theWindow
's focusable state when theWindow
is invisible and then show it.- Parameters:
focusableWindowState
- whether this Window can be the focused Window- Since:
- 1.4
- See Also:
Window.isFocusableWindow()
,Window.getFocusableWindowState()
,Window.isShowing()
,Component.setFocusable(boolean)
setIconImage void
setIconImage(Image image)Sets the image to be displayed as the icon for this window.public void setIconImage(Image image)-
Description copied from class:
Window
Sets the image to be displayed as the icon for this window.This method can be used instead of
setIconImages()
to specify a single image as a window's icon.The following statement:
setIconImage(image);
is equivalent to:ArrayList<Image> imageList = new ArrayList<Image>(); imageList.add(image); setIconImages(imageList);
Note : Native windowing systems may use different images of differing dimensions to represent a window, depending on the context (e.g. window decoration, window list, taskbar, etc.). They could also use just a single image for all contexts or no image at all.
- Parameters:
image
- the icon image to be displayed.- Since:
- 1.6
- See Also:
Window.setIconImages(java.util.List<? extends java.awt.Image>)
,Window.getIconImages()
setIconImages void
setIconImages(java.util.List<? extends Image> icons)Sets the sequence of images to be displayed as the icon for this window.public void setIconImages(java.util.List<? extends Image> icons)-
Description copied from class:
Window
Sets the sequence of images to be displayed as the icon for this window. Subsequent calls togetIconImages
will always return a copy of theicons
list.Depending on the platform capabilities one or several images of different dimensions will be used as the window's icon.
The
icons
list is scanned for the images of most appropriate dimensions from the beginning. If the list contains several images of the same size, the first will be used.Ownerless windows with no icon specified use platfrom-default icon. The icon of an owned window may be inherited from the owner unless explicitly overridden. Setting the icon to
null
or empty list restores the default behavior.Note : Native windowing systems may use different images of differing dimensions to represent a window, depending on the context (e.g. window decoration, window list, taskbar, etc.). They could also use just a single image for all contexts or no image at all.
- Parameters:
icons
- the list of icon images to be displayed.- Since:
- 1.6
- See Also:
Window.getIconImages()
,Window.setIconImage(Image)
setLocationByPlatform void
setLocationByPlatform(boolean locationByPlatform)Sets whether this Window should appear at the default location for the native windowing system or at the current location (returned bygetLocation
) the next time the Window is made visible.public void setLocationByPlatform(boolean locationByPlatform)-
Description copied from class:
Window
Sets whether this Window should appear at the default location for the native windowing system or at the current location (returned bygetLocation
) the next time the Window is made visible. This behavior resembles a native window shown without programmatically setting its location. Most windowing systems cascade windows if their locations are not explicitly set. The actual location is determined once the window is shown on the screen.This behavior can also be enabled by setting the System Property "java.awt.Window.locationByPlatform" to "true", though calls to this method take precedence.
Calls to
setVisible
,setLocation
andsetBounds
after callingsetLocationByPlatform
clear this property of the Window.For example, after the following code is executed:
The window will be shown at platform's default location andsetLocationByPlatform(true); setVisible(true); boolean flag = isLocationByPlatform();
flag
will befalse
.In the following sample:
The window will be shown at (10, 10) andsetLocationByPlatform(true); setLocation(10, 10); boolean flag = isLocationByPlatform(); setVisible(true);
flag
will befalse
.- Parameters:
locationByPlatform
-true
if this Window should appear at the default location,false
if at the current location- Throws:
- if the window is showing on screen and locationByPlatform isIllegalComponentStateException
true
.- Since:
- 1.5
- See Also:
Window.setLocation(int, int)
,Window.isShowing()
,Window.setVisible(boolean)
,Window.isLocationByPlatform()
,System.getProperty(String)
setLocationRelativeTo void
setLocationRelativeTo(Component c)Sets the location of the window relative to the specified component according to the following scenarios.public void setLocationRelativeTo(Component c)-
Description copied from class:
Window
Sets the location of the window relative to the specified component according to the following scenarios.The target screen mentioned below is a screen to which the window should be placed after the setLocationRelativeTo method is called.
- If the component is
null
, or theGraphicsConfiguration
associated with this component isnull
, the window is placed in the center of the screen. The center point can be obtained with theGraphicsEnvironment.getCenterPoint
method. - If the component is not
null
, but it is not currently showing, the window is placed in the center of the target screen defined by theGraphicsConfiguration
associated with this component. - If the component is not
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.- Parameters:
c
- the component in relation to which the window's location is determined- Since:
- 1.4
- See Also:
GraphicsEnvironment.getCenterPoint()
- If the component is
setModal void
setModal(boolean modal)Specifies whether this dialog should be modal.public void setModal(boolean modal)-
Specifies whether this dialog should be modal.
This method is obsolete and is kept for backwards compatibility only. Use
setModalityType()
instead.Note: changing modality of the visible dialog may have no effect until it is hidden and then shown again.
- Parameters:
modal
- specifies whether dialog blocks input to other windows when shown; calling tosetModal(true)
is equivalent tosetModalityType(Dialog.DEFAULT_MODALITY_TYPE)
, and calling tosetModal(false)
is equvivalent tosetModalityType(Dialog.ModalityType.MODELESS)
- Since:
- 1.1
- See Also:
DEFAULT_MODALITY_TYPE
,Dialog.ModalityType.MODELESS
,isModal()
,getModalityType()
,setModalityType(java.awt.Dialog.ModalityType)
setModalExclusionType void
setModalExclusionType(Dialog.ModalExclusionType exclusionType)Specifies the modal exclusion type for this window.public void setModalExclusionType(Dialog.ModalExclusionType exclusionType)-
Description copied from class:
Window
Specifies the modal exclusion type for this window. If a window is modal excluded, it is not blocked by some modal dialogs. SeeDialog.ModalExclusionType
for possible modal exclusion types.If the given type is not supported,
NO_EXCLUDE
is used.Note: changing the modal exclusion type for a visible window may have no effect until it is hidden and then shown again.
- Parameters:
exclusionType
- the modal exclusion type for this window; anull
value is equivivalent toNO_EXCLUDE
- Throws:
java.lang.SecurityException
- if the calling thread does not have permission to set the modal exclusion property to the window with the givenexclusionType
- Since:
- 1.6
- See Also:
Dialog.ModalExclusionType
,Window.getModalExclusionType()
,Toolkit.isModalExclusionTypeSupported(java.awt.Dialog.ModalExclusionType)
setModalityType void
setModalityType(Dialog.ModalityType type)Sets the modality type for this dialog.public void setModalityType(Dialog.ModalityType type)-
Sets the modality type for this dialog. See
ModalityType
for possible modality types.If the given modality type is not supported,
MODELESS
is used. You may want to callgetModalityType()
after calling this method to ensure that the modality type has been set.Note: changing modality of the visible dialog may have no effect until it is hidden and then shown again.
- Parameters:
type
- specifies whether dialog blocks input to other windows when shown.null
value and unsupported modality types are equivalent toMODELESS
- Throws:
java.lang.SecurityException
- if the calling thread does not have permission to create modal dialogs with the givenmodalityType
- Since:
- 1.6
- See Also:
getModalityType()
,Toolkit.isModalityTypeSupported(java.awt.Dialog.ModalityType)
setOpacity void
setOpacity(float opacity)Sets the opacity of the window.public void setOpacity(float opacity)-
Sets the opacity of the window.
The opacity value is in the range [0..1]. Note that setting the opacity level of 0 may or may not disable the mouse event handling on this window. This is a platform-dependent behavior.
The following conditions must be met in order to set the opacity value less than
1.0f
:- The
TRANSLUCENT
translucency must be supported by the underlying system - The window must be undecorated (see
Frame.setUndecorated(boolean)
andsetUndecorated(boolean)
) - The window must not be in full-screen mode (see
GraphicsDevice.setFullScreenWindow(Window)
)
If the requested opacity value is less than
1.0f
, and any of the above conditions are not met, the window opacity will not change, and theIllegalComponentStateException
will be thrown.The translucency levels of individual pixels may also be effected by the alpha component of their color (see
Window.setBackground(Color)
) and the current shape of this window (seeWindow.setShape(Shape)
).- Overrides:
setOpacity
in classWindow
- Parameters:
opacity
- the opacity level to set to the window- See Also:
Window.getOpacity()
,Window.setBackground(Color)
,Window.setShape(Shape)
,Frame.isUndecorated()
,isUndecorated()
,GraphicsDevice.WindowTranslucency
,GraphicsDevice.isWindowTranslucencySupported(GraphicsDevice.WindowTranslucency)
- The
setResizable void
setResizable(boolean resizable)Sets whether this dialog is resizable by the user.public void setResizable(boolean resizable)-
Sets whether this dialog is resizable by the user.
- Parameters:
resizable
-true
if the user can resize this dialog;false
otherwise.- See Also:
isResizable()
setShape void
setShape(Shape shape)Sets the shape of the window.public void setShape(Shape shape)-
Sets the shape of the window.
Setting a shape cuts off some parts of the window. Only the parts that belong to the given
Shape
remain visible and clickable. If the shape argument isnull
, this method restores the default shape, making the window rectangular on most platforms.The following conditions must be met to set a non-null shape:
- The
PERPIXEL_TRANSPARENT
translucency must be supported by the underlying system - The window must be undecorated (see
Frame.setUndecorated(boolean)
andsetUndecorated(boolean)
) - The window must not be in full-screen mode (see
GraphicsDevice.setFullScreenWindow(Window)
)
If the requested shape is not
null
, and any of the above conditions are not met, the shape of this window will not change, and either theUnsupportedOperationException
orIllegalComponentStateException
will be thrown.The tranlucency levels of individual pixels may also be effected by the alpha component of their color (see
Window.setBackground(Color)
) and the opacity value (seeWindow.setOpacity(float)
). SeeGraphicsDevice.WindowTranslucency
for more details.- Overrides:
setShape
in classWindow
- Parameters:
shape
- the shape to set to the window- See Also:
Window.getShape()
,Window.setBackground(Color)
,Window.setOpacity(float)
,Frame.isUndecorated()
,isUndecorated()
,GraphicsDevice.WindowTranslucency
,GraphicsDevice.isWindowTranslucencySupported(GraphicsDevice.WindowTranslucency)
- The
setTitle void
setTitle(java.lang.String title)Sets the title of the Dialog.public void setTitle(java.lang.String title)-
Sets the title of the Dialog.
- Parameters:
title
- the title displayed in the dialog's border; a null value results in an empty title- See Also:
getTitle()
setType void
setType(Window.Type type)Sets the type of the window.public void setType(Window.Type type)-
Description copied from class:
Window
Sets the type of the window. This method can only be called while the window is not displayable.- Throws:
IllegalComponentStateException
- if the window is displayable.java.lang.IllegalArgumentException
- if the type isnull
- Since:
- 1.7
- See Also:
Component.isDisplayable()
,Window.getType()
setUndecorated void
setUndecorated(boolean undecorated)Disables or enables decorations for this dialog.public void setUndecorated(boolean undecorated)-
Disables or enables decorations for this dialog.
This method can only be called while the dialog is not displayable. To make this dialog decorated, it must be opaque and have the default shape, otherwise the
IllegalComponentStateException
will be thrown. Refer toWindow.setShape(java.awt.Shape)
,Window.setOpacity(float)
andWindow.setBackground(java.awt.Color)
for details- Parameters:
undecorated
-true
if no dialog decorations are to be enabled;false
if dialog decorations are to be enabled- Throws:
IllegalComponentStateException
- if the dialog is displayableIllegalComponentStateException
- ifundecorated
isfalse
, and this dialog does not have the default shapeIllegalComponentStateException
- ifundecorated
isfalse
, and this dialog opacity is less than1.0f
IllegalComponentStateException
- ifundecorated
isfalse
, and the alpha value of this dialog background color is less than1.0f
- Since:
- 1.4
- See Also:
isUndecorated()
,Component.isDisplayable()
,Window.getShape()
,Window.getOpacity()
,Window.getBackground()
toBack void
toBack()If this Window is visible, sends this Window to the back and may cause it to lose focus or activation if it is the focused or active Window.public void toBack()-
If this Window is visible, sends this Window to the back and may cause it to lose focus or activation if it is the focused or active Window.
Places this Window at the bottom of the stacking order and shows it behind any other Windows in this VM. No action will take place is this Window is not visible. Some platforms do not allow Windows which are owned by other Windows to appear below their owners. Every attempt will be made to move this Window as low as possible in the stacking order; however, developers should not assume that this method will move this Window below all other windows in every situation.
Because of variations in native windowing systems, no guarantees about changes to the focused and active Windows can be made. Developers must never assume that this Window is no longer the focused or active Window until this Window receives a WINDOW_LOST_FOCUS or WINDOW_DEACTIVATED event. On platforms where the top-most window is the focused window, this method will probably cause this Window to lose focus. In that case, the next highest, focusable Window in this VM will receive focus. On platforms where the stacking order does not typically affect the focused window, this method will probably leave the focused and active Windows unchanged.
If this dialog is modal and blocks some windows, then all of them are also sent to the back to keep them below the blocking dialog.
- Overrides:
toBack
in classWindow
- See Also:
Window.toBack()
toFront void
toFront()If this Window is visible, brings this Window to the front and may make it the focused Window.public void toFront()-
Description copied from class:
Window
If this Window is visible, brings this Window to the front and may make it the focused Window.Places this Window at the top of the stacking order and shows it in front of any other Windows in this VM. No action will take place if this Window is not visible. Some platforms do not allow Windows which own other Windows to appear on top of those owned Windows. Some platforms may not permit this VM to place its Windows above windows of native applications, or Windows of other VMs. This permission may depend on whether a Window in this VM is already focused. Every attempt will be made to move this Window as high as possible in the stacking order; however, developers should not assume that this method will move this Window above all other windows in every situation.
Developers must never assume that this Window is the focused or active Window until this Window receives a WINDOW_GAINED_FOCUS or WINDOW_ACTIVATED event. On platforms where the top-most window is the focused window, this method will probably focus this Window (if it is not already focused) under the following conditions:
- The window meets the requirements outlined in the
Window.isFocusableWindow()
method. - The window's property
autoRequestFocus
is of thetrue
value. - Native windowing system allows the window to get focused.
If this method causes this Window to be focused, and this Window is a Frame or a Dialog, it will also become activated. If this Window is focused, but it is not a Frame or a Dialog, then the first Frame or Dialog that is an owner of this Window will be activated.
If this window is blocked by modal dialog, then the blocking dialog is brought to the front and remains above the blocked window.
- The window meets the requirements outlined in the
toString java.lang.String
toString()Returns a string representation of this component and its values.public java.lang.String toString()-
Description copied from class:
Component
Returns a string representation of this component and its values.- Overrides:
toString
in classjava.lang.Object
- Returns:
- a string representation of this component
- Since:
- JDK1.0
-
-
-