Class FileDialog
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- java.awt.Window
-
- java.awt.Dialog
-
- java.awt.FileDialog
-
- All Implemented Interfaces:
- java.awt.image.ImageObserver, MenuContainer, java.io.Serializable, javax.accessibility.Accessible
public class FileDialog extends DialogTheFileDialogclass displays a dialog window from which the user can select a file.Since it is a modal dialog, when the application calls its
showmethod to display the dialog, it blocks the rest of the application until the user has chosen a file.- Since:
- JDK1.0
- See Also:
Window.show(), Serialized Form
-
-
Nested Classes Modifier and Type Class and Description 
AccessibleAWTComponent 

protected classAccessibleAWTComponentInner class of Component used to provide default support for accessibility.protected classAccessibleAWTComponent-
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 classBaselineResizeBehaviorEnumeration of the common ways the baseline of a component can change as the size changes.static classBaselineResizeBehavior-
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_VALUEand/orShort.MAX_VALUEthe 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 classBltBufferStrategyInner class for blitting offscreen surfaces to a component.protected classBltBufferStrategy-
Inner class for blitting offscreen surfaces to a component.
- Since:
- 1.4

FlipBufferStrategy 

protected classFlipBufferStrategyInner class for flipping buffers on a component.protected classFlipBufferStrategy
AccessibleAWTContainer 

protected classAccessibleAWTContainerInner class of Container used to provide default support for accessibility.protected classAccessibleAWTContainer-
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 classAccessibleAWTDialogThis class implements accessibility support for theDialogclass.protected classAccessibleAWTDialog-
This class implements accessibility support for the
Dialogclass. It provides an implementation of the Java Accessibility API appropriate to dialog user-interface elements.- Since:
- 1.3
- See Also:
- Serialized Form

ModalExclusionType 

static classModalExclusionTypeAny top-level window can be marked not to be blocked by modal dialogs.static classModalExclusionType-
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 classModalityTypeModal dialogs block all input to some top-level windows.static classModalityType-
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
ModalityTypeenum specifies modal types and their associated scopes.

AccessibleAWTWindow 

protected classAccessibleAWTWindowThis class implements accessibility support for theWindowclass.protected classAccessibleAWTWindow-
This class implements accessibility support for the
Windowclass. It provides an implementation of the Java Accessibility API appropriate to window user-interface elements.- Since:
- 1.3
- See Also:
- Serialized Form

Type 

static classTypeEnumeration of available window types.static classType-
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
FrameorDialoginstance.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 intABORTThis 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 intALLBITSThis 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 floatBOTTOM_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 floatCENTER_ALIGNMENTEase-of-use constant forgetAlignmentYandgetAlignmentX.public static final float CENTER_ALIGNMENT-
Ease-of-use constant for
getAlignmentYandgetAlignmentX. Specifies an alignment to the center of the component

DEFAULT_MODALITY_TYPE 

static Dialog.ModalityTypeDEFAULT_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,Dialog.setModal(boolean)

ERROR 

static intERRORThis 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 intFRAMEBITSThis 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 intHEIGHTThis 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 floatLEFT_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.

LOAD 

static intLOADThis constant value indicates that the purpose of the file dialog window is to locate a file from which to read.public static final int LOAD-
This constant value indicates that the purpose of the file dialog window is to locate a file from which to read.
- See Also:
- Constant Field Values

PROPERTIES 

static intPROPERTIESThis 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 floatRIGHT_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.

SAVE 

static intSAVEThis constant value indicates that the purpose of the file dialog window is to locate a file to which to write.public static final int SAVE-
This constant value indicates that the purpose of the file dialog window is to locate a file to which to write.
- See Also:
- Constant Field Values

SOMEBITS 

static intSOMEBITSThis 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 floatTOP_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 intWIDTHThis 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 allWindows created by this application that have no owner.public static Window[] getOwnerlessWindows()-
Description copied from class:
WindowReturns an array of allWindows created by this application that have no owner. They includeFrames and ownerlessDialogs andWindows. If called from an applet, the array includes only theWindows 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,
LayoutManagers or serialization.- Since:
- 1.6
- See Also:
Frame.getFrames(),Window.getWindows()

getWindows 

static Window[]getWindows()Returns an array of allWindows, both owned and ownerless, created by this application.public static Window[] getWindows()-
Description copied from class:
WindowReturns an array of allWindows, both owned and ownerless, created by this application. If called from an applet, the array includes only theWindows 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,
LayoutManagers or serialization.- Since:
- 1.6
- See Also:
Frame.getFrames(),Window.getOwnerlessWindows()
-
-
Constructors Constructor and Description 
FileDialog 
FileDialog(Dialog parent)Creates a file dialog for loading a file.public FileDialog(Dialog parent)-
Creates a file dialog for loading a file. The title of the file dialog is initially empty. This is a convenience method for
FileDialog(parent, "", LOAD).- Parameters:
parent- the owner of the dialog- Throws:
java.lang.IllegalArgumentException- if theparent'sGraphicsConfigurationis not from a screen device;java.lang.IllegalArgumentException- ifparentisnull; this exception is always thrown whenGraphicsEnvironment.isHeadlessreturnstrue- Since:
- 1.5
- See Also:
GraphicsEnvironment.isHeadless()

FileDialog 
FileDialog(Dialog parent, java.lang.String title)Creates a file dialog window with the specified title for loading a file.public FileDialog(Dialog parent, java.lang.String title)-
Creates a file dialog window with the specified title for loading a file. The files shown are those in the current directory. This is a convenience method for
FileDialog(parent, title, LOAD).- Parameters:
parent- the owner of the dialogtitle- the title of the dialog; anullvalue will be accepted without causing aNullPointerExceptionto be thrown- Throws:
java.lang.IllegalArgumentException- if theparent'sGraphicsConfigurationis not from a screen device;java.lang.IllegalArgumentException- ifparentisnull; this exception is always thrown whenGraphicsEnvironment.isHeadlessreturnstrue- Since:
- 1.5
- See Also:
GraphicsEnvironment.isHeadless()

FileDialog 
FileDialog(Dialog parent, java.lang.String title, int mode)Creates a file dialog window with the specified title for loading or saving a file.public FileDialog(Dialog parent, java.lang.String title, int mode)-
Creates a file dialog window with the specified title for loading or saving a file.
If the value of
modeisLOAD, then the file dialog is finding a file to read, and the files shown are those in the current directory. If the value ofmodeisSAVE, the file dialog is finding a place to write a file.- Parameters:
parent- the owner of the dialogtitle- the title of the dialog; anullvalue will be accepted without causing aNullPointerExceptionto be thrownmode- the mode of the dialog; eitherFileDialog.LOADorFileDialog.SAVE- Throws:
java.lang.IllegalArgumentException- if an illegal file dialog mode is supplied;java.lang.IllegalArgumentException- if theparent'sGraphicsConfigurationis not from a screen device;java.lang.IllegalArgumentException- ifparentisnull; this exception is always thrown whenGraphicsEnvironment.isHeadlessreturnstrue- Since:
- 1.5
- See Also:
GraphicsEnvironment.isHeadless(),LOAD,SAVE

FileDialog 
FileDialog(Frame parent)Creates a file dialog for loading a file.public FileDialog(Frame parent)-
Creates a file dialog for loading a file. The title of the file dialog is initially empty. This is a convenience method for
FileDialog(parent, "", LOAD).- Parameters:
parent- the owner of the dialog- Since:
- JDK1.1

FileDialog 
FileDialog(Frame parent, java.lang.String title)Creates a file dialog window with the specified title for loading a file.public FileDialog(Frame parent, java.lang.String title)-
Creates a file dialog window with the specified title for loading a file. The files shown are those in the current directory. This is a convenience method for
FileDialog(parent, title, LOAD).- Parameters:
parent- the owner of the dialogtitle- the title of the dialog

FileDialog 
FileDialog(Frame parent, java.lang.String title, int mode)Creates a file dialog window with the specified title for loading or saving a file.public FileDialog(Frame parent, java.lang.String title, int mode)-
Creates a file dialog window with the specified title for loading or saving a file.
If the value of
modeisLOAD, then the file dialog is finding a file to read, and the files shown are those in the current directory. If the value ofmodeisSAVE, the file dialog is finding a place to write a file.
-
-
-
Basic Attribute Methods Modifier and Type Method and Description 
applyComponentOrientation 

voidapplyComponentOrientation(ComponentOrientation o)Sets theComponentOrientationproperty of this container and all components contained within it.public void applyComponentOrientation(ComponentOrientation o)-
Description copied from class:
ContainerSets theComponentOrientationproperty of this container and all components contained within it.This method changes layout-related information, and therefore, invalidates the component hierarchy.
- Overrides:
applyComponentOrientationin classComponent- Parameters:
o- the new component orientation of this container and the components contained within it.- Throws:
java.lang.NullPointerException- iforientationis null.- Since:
- 1.4
- See Also:
Component.setComponentOrientation(java.awt.ComponentOrientation),Component.getComponentOrientation(),Container.invalidate()

disable 

voiddisable()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 

voidenable()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 

voidenable(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 

voidenableInputMethods(boolean enable)Enables or disables input method support for this component.public void enableInputMethods(boolean enable)-
Description copied from class:
ComponentEnables 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.AccessibleContextgetAccessibleContext()Gets the AccessibleContext associated with this Dialog.public javax.accessibility.AccessibleContext getAccessibleContext()-
Description copied from class:
DialogGets 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:
getAccessibleContextin interfacejavax.accessibility.Accessible- Overrides:
getAccessibleContextin classWindow- Returns:
- an AccessibleAWTDialog that serves as the AccessibleContext of this Dialog
- Since:
- 1.3

getBackground 

ColorgetBackground()Gets the background color of this window.public Color getBackground()-
Description copied from class:
WindowGets 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:
getBackgroundin classComponent- Returns:
- this component's background color
- See Also:
Window.setBackground(Color),Window.isOpaque(),GraphicsDevice.WindowTranslucency

getColorModel 

java.awt.image.ColorModelgetColorModel()Gets the instance ofColorModelused to display the component on the output device.public java.awt.image.ColorModel getColorModel()-
Description copied from class:
ComponentGets the instance ofColorModelused 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 

ComponentOrientationgetComponentOrientation()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:
ComponentRetrieves the language-sensitive orientation that is to be used to order the elements or text within this component.LayoutManagerandComponentsubclasses that wish to respect orientation should call this method to get the component's orientation before performing layout or drawing.- See Also:
ComponentOrientation

getCursor 

CursorgetCursor()Gets the cursor set in the component.public Cursor getCursor()-
Description copied from class:
ComponentGets 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_CURSORis returned.- Since:
- JDK1.1
- See Also:
Component.setCursor(java.awt.Cursor)

getFont 

FontgetFont()Gets the font of this component.public Font getFont()-
Description copied from class:
ComponentGets the font of this component.- Specified by:
getFontin 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 

ColorgetForeground()Gets the foreground color of this component.public Color getForeground()-
Description copied from class:
ComponentGets 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.LocalegetLocale()Gets theLocaleobject that is associated with this window, if the locale has been set.public java.util.Locale getLocale()-
Description copied from class:
WindowGets theLocaleobject 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.StringgetName()Gets the name of the component.public java.lang.String getName()-
Description copied from class:
ComponentGets the name of the component.- Returns:
- this component's name
- Since:
- JDK1.1
- See Also:
Component.setName(java.lang.String)

getParent 

ContainergetParent()Gets the parent of this component.
hide 

voidhide()Deprecated. As of JDK version 1.5, replaced bysetVisible(boolean).@Deprecated public void hide()Deprecated. As of JDK version 1.5, replaced bysetVisible(boolean).-
Description copied from class:
DialogHides the Dialog and then causesshowto return if it is currently blocked.- Overrides:
hidein classWindow- See Also:
Window.show(),Window.dispose(),Window.setVisible(boolean)

isBackgroundSet 

booleanisBackgroundSet()Returns whether the background color has been explicitly set for this Component.public boolean isBackgroundSet()-
Description copied from class:
ComponentReturns 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:
trueif the background color has been explicitly set for this Component;falseotherwise.- Since:
- 1.4

isCursorSet 

booleanisCursorSet()Returns whether the cursor has been explicitly set for this Component.public boolean isCursorSet()-
Description copied from class:
ComponentReturns whether the cursor has been explicitly set for this Component. If this method returnsfalse, this Component is inheriting its cursor from an ancestor.- Returns:
trueif the cursor has been explicitly set for this Component;falseotherwise.- Since:
- 1.4

isDisplayable 

booleanisDisplayable()Determines whether this component is displayable.public boolean isDisplayable()-
Description copied from class:
ComponentDetermines 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:
trueif the component is displayable,falseotherwise- Since:
- 1.2
- See Also:
Container.add(Component),Window.pack(),Window.show(),Container.remove(Component),Window.dispose()

isDoubleBuffered 

booleanisDoubleBuffered()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:
ComponentReturns 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 

booleanisEnabled()Determines whether this component is enabled.public boolean isEnabled()-
Description copied from class:
ComponentDetermines 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 itssetEnabledmethod.- Returns:
trueif the component is enabled,falseotherwise- Since:
- JDK1.0
- See Also:
Component.setEnabled(boolean)

isFontSet 

booleanisFontSet()Returns whether the font has been explicitly set for this Component.public boolean isFontSet()-
Description copied from class:
ComponentReturns whether the font has been explicitly set for this Component. If this method returnsfalse, this Component is inheriting its font from an ancestor.- Returns:
trueif the font has been explicitly set for this Component;falseotherwise.- Since:
- 1.4

isForegroundSet 

booleanisForegroundSet()Returns whether the foreground color has been explicitly set for this Component.public boolean isForegroundSet()-
Description copied from class:
ComponentReturns 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:
trueif the foreground color has been explicitly set for this Component;falseotherwise.- Since:
- 1.4

isLightweight 

booleanisLightweight()A lightweight component doesn't have a native toolkit peer.public boolean isLightweight()-
Description copied from class:
ComponentA lightweight component doesn't have a native toolkit peer. Subclasses ofComponentandContainer, other than the ones defined in this package likeButtonorScrollbar, are lightweight. All of the Swing components are lightweights.This method will always return
falseif 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 

booleanisOpaque()Indicates if the window is currently opaque.public boolean isOpaque()-
Description copied from class:
WindowIndicates if the window is currently opaque.The method returns
falseif the background color of the window is notnulland the alpha component of the color is less than1.0f. The method returnstrueotherwise.- Overrides:
isOpaquein classComponent- Returns:
trueif the window is opaque,falseotherwise- Since:
- 1.7
- See Also:
Window.getBackground(),Window.setBackground(Color)

isShowing 

booleanisShowing()Checks if this Window is showing on screen.public boolean isShowing()-
Description copied from class:
WindowChecks if this Window is showing on screen.- Overrides:
isShowingin classComponent- Returns:
trueif the component is showing,falseotherwise- See Also:
Component.setVisible(boolean)

isVisible 

booleanisVisible()Determines whether this component should be visible when its parent is visible.public boolean isVisible()-
Description copied from class:
ComponentDetermines whether this component should be visible when its parent is visible. Components are initially visible, with the exception of top level components such asFrameobjects.- Returns:
trueif the component is visible,falseotherwise- Since:
- JDK1.0
- See Also:
Component.setVisible(boolean)

setBackground 

voidsetBackground(Color bgColor)Sets the background color of this window.public void setBackground(Color bgColor)-
Description copied from class:
DialogSets the background color of this window.If the windowing system supports the
PERPIXEL_TRANSLUCENTtranclucency, 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_TRANSLUCENTtranslucency must be supported by the graphics device where this window is located - The window must be undecorated (see
Frame.setUndecorated(boolean)andDialog.setUndecorated(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 theUnsupportedOperationExceptionorIllegalComponentStateExceptionwill 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
0may 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:
setBackgroundin 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(),Dialog.isUndecorated(),GraphicsDevice.WindowTranslucency,GraphicsDevice.isWindowTranslucencySupported(GraphicsDevice.WindowTranslucency),GraphicsConfiguration.isTranslucencyCapable()
- The

setComponentOrientation 

voidsetComponentOrientation(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:
ComponentSets the language-sensitive orientation that is to be used to order the elements or text within this component. Language-sensitiveLayoutManagerandComponentsubclasses 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 

voidsetCursor(Cursor cursor)Set the cursor image to a specified cursor.public void setCursor(Cursor cursor)-
Description copied from class:
WindowSet 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:
setCursorin classComponent- Parameters:
cursor- One of the constants defined by theCursorclass. 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 

voidsetEnabled(boolean b)Enables or disables this component, depending on the value of the parameterb.public void setEnabled(boolean b)-
Description copied from class:
ComponentEnables 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 

voidsetFont(Font f)Sets the font of this container.public void setFont(Font f)-
Description copied from class:
ContainerSets the font of this container.This method changes layout-related information, and therefore, invalidates the component hierarchy.
- Overrides:
setFontin classComponent- Parameters:
f- The font to become this container's font.- Since:
- JDK1.0
- See Also:
Component.getFont(),Container.invalidate()

setForeground 

voidsetForeground(Color c)Sets the foreground color of this component.public void setForeground(Color c)-
Description copied from class:
ComponentSets the foreground color of this component.- Parameters:
c- the color to become this component's foreground color; if this parameter isnullthen this component will inherit the foreground color of its parent- Since:
- JDK1.0
- See Also:
Component.getForeground()

setLocale 

voidsetLocale(java.util.Locale l)Sets the locale of this component.public void setLocale(java.util.Locale l)-
Description copied from class:
ComponentSets 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 

voidsetName(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:
ComponentSets 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 

voidsetVisible(boolean b)Shows or hides thisDialogdepending on the value of parameterb.public void setVisible(boolean b)-
Description copied from class:
DialogShows or hides thisDialogdepending on the value of parameterb.- Overrides:
setVisiblein classWindow- Parameters:
b- iftrue, makes theDialogvisible, 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 theDialogand 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(),Dialog.isModal()

show 

voidshow()Deprecated. As of JDK version 1.5, replaced bysetVisible(boolean).@Deprecated public void show()Deprecated. As of JDK version 1.5, replaced bysetVisible(boolean).-
Description copied from class:
DialogMakes theDialogvisible. 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:
showin classWindow- See Also:
Component.hide(),Component.isDisplayable(),Component.validate(),Dialog.isModal(),Window.setVisible(boolean)

show 

voidshow(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 

booleanaction(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 AWTEventcoalesceEvents(AWTEvent existingEvent, AWTEvent newEvent)Potentially coalesce an event being posted with an existing event.-
Description copied from class:
ComponentPotentially coalesce an event being posted with an existing event. This method is called byEventQueue.postEventif 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), ornullto 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 unlessnullis returned.This implementation of
coalesceEventscoalesces 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 complexRepaintAreain the peer. The newAWTEventis always returned.- Parameters:
existingEvent- the event already on theEventQueuenewEvent- the event being posted to theEventQueue- Returns:
- a coalesced event, or
nullindicating that no coalescing was done

deliverEvent 

voiddeliverEvent(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 voiddisableEvents(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:
ComponentDisables 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 

voiddispatchEvent(AWTEvent e)Dispatches an event to this component or one of its sub components.
enableEvents 

protected voidenableEvents(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:
ComponentEnables 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
Componentwhich desire to have the specified event types delivered toprocessEventregardless 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 voidfirePropertyChange(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:
ComponentSupport 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 

voidfirePropertyChange(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:
ComponentReports 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 

voidfirePropertyChange(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:
ComponentReports 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 

voidfirePropertyChange(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:
ComponentReports 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 

voidfirePropertyChange(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:
ComponentReports 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 voidfirePropertyChange(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:
ComponentSupport 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 

voidfirePropertyChange(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:
ComponentReports 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 voidfirePropertyChange(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:
ComponentSupport 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 

voidfirePropertyChange(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:
ComponentReports 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 asFooListeners upon thisWindow.public <T extends java.util.EventListener> T[] getListeners(java.lang.Class<T> listenerType)-
Description copied from class:
WindowReturns an array of all the objects currently registered asFooListeners upon thisWindow.FooListeners are registered using theaddFooListenermethod.You can specify the
listenerTypeargument with a class literal, such asFooListener.class. For example, you can query aWindowwfor 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:
getListenersin 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
FooListeners on this window, or an empty array if no such listeners have been added - Throws:
java.lang.ClassCastException- iflistenerTypedoesn't specify a class or interface that implementsjava.util.EventListenerjava.lang.NullPointerException- iflistenerTypeisnull- Since:
- 1.3
- See Also:
Window.getWindowListeners()

handleEvent 

booleanhandleEvent(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 

booleankeyDown(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 

booleankeyUp(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 

booleanmouseDown(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 

booleanmouseDrag(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 

booleanmouseEnter(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 

booleanmouseExit(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 

booleanmouseMove(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 

booleanmouseUp(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 

booleanpostEvent(Event e)Deprecated. As of JDK version 1.1 replaced bydispatchEvent(AWTEvent).Deprecated. As of JDK version 1.1 replaced bydispatchEvent(AWTEvent).
processComponentEvent 

protected voidprocessComponentEvent(ComponentEvent e)Processes component events occurring on this component by dispatching them to any registeredComponentListenerobjects.protected void processComponentEvent(ComponentEvent e)-
Description copied from class:
ComponentProcesses component events occurring on this component by dispatching them to any registeredComponentListenerobjects.This method is not called unless component events are enabled for this component. Component events are enabled when one of the following occurs:
- A
ComponentListenerobject is registered viaaddComponentListener. - Component events are enabled via
enableEvents.
Note that if the event parameter is
nullthe 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 voidprocessContainerEvent(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:
ContainerProcesses 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
nullthe 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 voidprocessEvent(AWTEvent e)Processes events on this window.protected void processEvent(AWTEvent e)-
Description copied from class:
WindowProcesses events on this window. If the event is anWindowEvent, it invokes theprocessWindowEventmethod, else it invokes its superclass'sprocessEvent.Note that if the event parameter is
nullthe behavior is unspecified and may result in an exception.- Overrides:
processEventin 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 voidprocessFocusEvent(FocusEvent e)Processes focus events occurring on this component by dispatching them to any registeredFocusListenerobjects.protected void processFocusEvent(FocusEvent e)-
Description copied from class:
ComponentProcesses focus events occurring on this component by dispatching them to any registeredFocusListenerobjects.This method is not called unless focus events are enabled for this component. Focus events are enabled when one of the following occurs:
- A
FocusListenerobject is registered viaaddFocusListener. - Focus events are enabled via
enableEvents.
If focus events are enabled for a
Component, the currentKeyboardFocusManagerdetermines whether or not a focus event should be dispatched to registeredFocusListenerobjects. If the events are to be dispatched, theKeyboardFocusManagercalls theComponent'sdispatchEventmethod, which results in a call to theComponent'sprocessFocusEventmethod.If focus events are enabled for a
Component, calling theComponent'sdispatchEventmethod with aFocusEventas the argument will result in a call to theComponent'sprocessFocusEventmethod regardless of the currentKeyboardFocusManager.Note that if the event parameter is
nullthe 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 voidprocessHierarchyBoundsEvent(HierarchyEvent e)Processes hierarchy bounds events occurring on this component by dispatching them to any registeredHierarchyBoundsListenerobjects.protected void processHierarchyBoundsEvent(HierarchyEvent e)-
Description copied from class:
ComponentProcesses hierarchy bounds events occurring on this component by dispatching them to any registeredHierarchyBoundsListenerobjects.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
HierarchyBoundsListenerobject is registered viaaddHierarchyBoundsListener. - Hierarchy bounds events are enabled via
enableEvents.
Note that if the event parameter is
nullthe 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 voidprocessHierarchyEvent(HierarchyEvent e)Processes hierarchy events occurring on this component by dispatching them to any registeredHierarchyListenerobjects.protected void processHierarchyEvent(HierarchyEvent e)-
Description copied from class:
ComponentProcesses hierarchy events occurring on this component by dispatching them to any registeredHierarchyListenerobjects.This method is not called unless hierarchy events are enabled for this component. Hierarchy events are enabled when one of the following occurs:
- An
HierarchyListenerobject is registered viaaddHierarchyListener. - Hierarchy events are enabled via
enableEvents.
Note that if the event parameter is
nullthe 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 voidprocessInputMethodEvent(InputMethodEvent e)Processes input method events occurring on this component by dispatching them to any registeredInputMethodListenerobjects.protected void processInputMethodEvent(InputMethodEvent e)-
Description copied from class:
ComponentProcesses input method events occurring on this component by dispatching them to any registeredInputMethodListenerobjects.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
InputMethodListenerobject is registered viaaddInputMethodListener. - Input method events are enabled via
enableEvents.
Note that if the event parameter is
nullthe 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 voidprocessKeyEvent(KeyEvent e)Processes key events occurring on this component by dispatching them to any registeredKeyListenerobjects.protected void processKeyEvent(KeyEvent e)-
Description copied from class:
ComponentProcesses key events occurring on this component by dispatching them to any registeredKeyListenerobjects.This method is not called unless key events are enabled for this component. Key events are enabled when one of the following occurs:
- A
KeyListenerobject is registered viaaddKeyListener. - Key events are enabled via
enableEvents.
If key events are enabled for a
Component, the currentKeyboardFocusManagerdetermines whether or not a key event should be dispatched to registeredKeyListenerobjects. TheDefaultKeyboardFocusManagerwill not dispatch key events to aComponentthat is not the focus owner or is not showing.As of J2SE 1.4,
KeyEvents are redirected to the focus owner. Please see the Focus Specification for further information.Calling a
Component'sdispatchEventmethod with aKeyEventas the argument will result in a call to theComponent'sprocessKeyEventmethod regardless of the currentKeyboardFocusManageras long as the component is showing, focused, and enabled, and key events are enabled on it.If the event parameter is
nullthe 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 voidprocessMouseEvent(MouseEvent e)Processes mouse events occurring on this component by dispatching them to any registeredMouseListenerobjects.protected void processMouseEvent(MouseEvent e)-
Description copied from class:
ComponentProcesses mouse events occurring on this component by dispatching them to any registeredMouseListenerobjects.This method is not called unless mouse events are enabled for this component. Mouse events are enabled when one of the following occurs:
- A
MouseListenerobject is registered viaaddMouseListener. - Mouse events are enabled via
enableEvents.
Note that if the event parameter is
nullthe 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 voidprocessMouseMotionEvent(MouseEvent e)Processes mouse motion events occurring on this component by dispatching them to any registeredMouseMotionListenerobjects.protected void processMouseMotionEvent(MouseEvent e)-
Description copied from class:
ComponentProcesses mouse motion events occurring on this component by dispatching them to any registeredMouseMotionListenerobjects.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
MouseMotionListenerobject is registered viaaddMouseMotionListener. - Mouse motion events are enabled via
enableEvents.
Note that if the event parameter is
nullthe 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 voidprocessMouseWheelEvent(MouseWheelEvent e)Processes mouse wheel events occurring on this component by dispatching them to any registeredMouseWheelListenerobjects.protected void processMouseWheelEvent(MouseWheelEvent e)-
Description copied from class:
ComponentProcesses mouse wheel events occurring on this component by dispatching them to any registeredMouseWheelListenerobjects.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
MouseWheelListenerobject 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
nullthe 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 

voidaddComponentListener(ComponentListener l)Adds the specified component listener to receive component events from this component.public void addComponentListener(ComponentListener l)-
Description copied from class:
ComponentAdds the specified component listener to receive component events from this component. If listenerlisnull, 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 

voidaddContainerListener(ContainerListener l)Adds the specified container listener to receive container events from this container.public void addContainerListener(ContainerListener l)-
Description copied from class:
ContainerAdds 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 

voidaddFocusListener(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:
ComponentAdds the specified focus listener to receive focus events from this component when this component gains input focus. If listenerlisnull, 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 

voidaddHierarchyBoundsListener(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:
ComponentAdds the specified hierarchy bounds listener to receive hierarchy bounds events from this component when the hierarchy to which this container belongs changes. If listenerlisnull, 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 

voidaddHierarchyListener(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:
ComponentAdds the specified hierarchy listener to receive hierarchy changed events from this component when the hierarchy to which this container belongs changes. If listenerlisnull, 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 

voidaddInputMethodListener(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:
ComponentAdds 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 overridesgetInputMethodRequeststo return anInputMethodRequestsinstance. If listenerlisnull, 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 

voidaddKeyListener(KeyListener l)Adds the specified key listener to receive key events from this component.public void addKeyListener(KeyListener l)-
Description copied from class:
ComponentAdds 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 

voidaddMouseListener(MouseListener l)Adds the specified mouse listener to receive mouse events from this component.public void addMouseListener(MouseListener l)-
Description copied from class:
ComponentAdds the specified mouse listener to receive mouse events from this component. If listenerlisnull, 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 

voidaddMouseMotionListener(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:
ComponentAdds the specified mouse motion listener to receive mouse motion events from this component. If listenerlisnull, 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 

voidaddMouseWheelListener(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:
ComponentAdds 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 

voidaddPropertyChangeListener(java.beans.PropertyChangeListener listener)Adds a PropertyChangeListener to the listener list.public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)-
Description copied from class:
WindowAdds 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:
addPropertyChangeListenerin classContainer- Parameters:
listener- the PropertyChangeListener to be added- See Also:
Component.removePropertyChangeListener(java.beans.PropertyChangeListener),Window.addPropertyChangeListener(java.lang.String,java.beans.PropertyChangeListener)

addPropertyChangeListener 

voidaddPropertyChangeListener(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:
WindowAdds 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:
addPropertyChangeListenerin 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:
ComponentReturns an array of all the component listeners registered on this component.- Returns:
- all of this comonent's
ComponentListeners 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:
ContainerReturns an array of all the container listeners registered on this container.- Returns:
- all of this container's
ContainerListeners 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:
ComponentReturns an array of all the focus listeners registered on this component.- Returns:
- all of this component's
FocusListeners 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:
ComponentReturns an array of all the hierarchy bounds listeners registered on this component.- Returns:
- all of this component's
HierarchyBoundsListeners 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:
ComponentReturns an array of all the hierarchy listeners registered on this component.- Returns:
- all of this component's
HierarchyListeners 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:
ComponentReturns an array of all the input method listeners registered on this component.- Returns:
- all of this component's
InputMethodListeners 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:
ComponentReturns an array of all the key listeners registered on this component.- Returns:
- all of this component's
KeyListeners 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:
ComponentReturns an array of all the mouse listeners registered on this component.- Returns:
- all of this component's
MouseListeners 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:
ComponentReturns an array of all the mouse motion listeners registered on this component.- Returns:
- all of this component's
MouseMotionListeners 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:
ComponentReturns an array of all the mouse wheel listeners registered on this component.- Returns:
- all of this component's
MouseWheelListeners 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:
ComponentReturns an array of all the property change listeners registered on this component.- Returns:
- all of this component's
PropertyChangeListeners 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:
ComponentReturns an array of all the listeners which have been associated with the named property.- Returns:
- all of the
PropertyChangeListeners associated with the named property; if no such listeners have been added or ifpropertyNameisnull, 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 

voidremoveComponentListener(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:
ComponentRemoves 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 listenerlisnull, 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 

voidremoveContainerListener(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:
ContainerRemoves 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 

voidremoveFocusListener(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:
ComponentRemoves 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 listenerlisnull, 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 

voidremoveHierarchyBoundsListener(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:
ComponentRemoves 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 listenerlisnull, 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 

voidremoveHierarchyListener(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:
ComponentRemoves 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 listenerlisnull, 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 

voidremoveInputMethodListener(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:
ComponentRemoves 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 listenerlisnull, 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 

voidremoveKeyListener(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:
ComponentRemoves 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 listenerlisnull, 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 

voidremoveMouseListener(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:
ComponentRemoves 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 listenerlisnull, 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 

voidremoveMouseMotionListener(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:
ComponentRemoves 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 listenerlisnull, 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 

voidremoveMouseWheelListener(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:
ComponentRemoves 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 

voidremovePropertyChangeListener(java.beans.PropertyChangeListener listener)Removes a PropertyChangeListener from the listener list.public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)-
Description copied from class:
ComponentRemoves 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 

voidremovePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)Removes aPropertyChangeListenerfrom the listener list for a specific property.public void removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)-
Description copied from class:
ComponentRemoves aPropertyChangeListenerfrom the listener list for a specific property. This method should be used to removePropertyChangeListeners that were registered for a specific bound property.If
propertyNameorlistenerisnull, 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 

booleanareFocusTraversalKeysSet(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:
ContainerReturns 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:
areFocusTraversalKeysSetin 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:
trueif the the Set of focus traversal keys for the given focus traversal operation has been explicitly defined for this Component;falseotherwise.- 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 

ContainergetFocusCycleRootAncestor()Always returnsnullbecause Windows have no ancestors; they represent the top of the Component hierarchy.public final Container getFocusCycleRootAncestor()-
Description copied from class:
WindowAlways returnsnullbecause Windows have no ancestors; they represent the top of the Component hierarchy.- Overrides:
getFocusCycleRootAncestorin 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:
WindowGets a focus traversal key for this Window. (SeesetFocusTraversalKeysfor 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:
getFocusTraversalKeysin 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 

booleangetFocusTraversalKeysEnabled()Returns whether focus traversal keys are enabled for this Component.public boolean getFocusTraversalKeysEnabled()-
Description copied from class:
ComponentReturns 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 

FocusTraversalPolicygetFocusTraversalPolicy()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:
ContainerReturns 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 

booleangotFocus(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 

booleanhasFocus()Returnstrueif thisComponentis the focus owner.public boolean hasFocus()-
Description copied from class:
ComponentReturnstrueif thisComponentis the focus owner. This method is obsolete, and has been replaced byisFocusOwner().- Returns:
trueif thisComponentis the focus owner;falseotherwise- Since:
- 1.2

isFocusable 

booleanisFocusable()Returns whether this Component can be focused.public boolean isFocusable()-
Description copied from class:
ComponentReturns whether this Component can be focused.- Returns:
trueif this Component is focusable;falseotherwise.- Since:
- 1.4
- See Also:
Component.setFocusable(boolean)

isFocusCycleRoot 

booleanisFocusCycleRoot()Always returnstruebecause all Windows must be roots of a focus traversal cycle.public final boolean isFocusCycleRoot()-
Description copied from class:
WindowAlways returnstruebecause all Windows must be roots of a focus traversal cycle.- Overrides:
isFocusCycleRootin classContainer- Returns:
true- Since:
- 1.4
- See Also:
Window.setFocusCycleRoot(boolean),Container.setFocusTraversalPolicy(java.awt.FocusTraversalPolicy),Container.getFocusTraversalPolicy()

isFocusCycleRoot 

booleanisFocusCycleRoot(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:
ContainerReturns 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 returntruefor both such Containers in this case.- Overrides:
isFocusCycleRootin classComponent- Parameters:
container- the Container to be tested- Returns:
trueif the specified Container is a focus-cycle- root of this Container;falseotherwise- Since:
- 1.4
- See Also:
Container.isFocusCycleRoot()

isFocusOwner 

booleanisFocusOwner()Returnstrueif thisComponentis the focus owner.public boolean isFocusOwner()-
Description copied from class:
ComponentReturnstrueif thisComponentis the focus owner.- Returns:
trueif thisComponentis the focus owner;falseotherwise- Since:
- 1.4

isFocusTraversable 

booleanisFocusTraversable()Deprecated. As of 1.4, replaced byisFocusable().@Deprecated public boolean isFocusTraversable()Deprecated. As of 1.4, replaced byisFocusable().-
Description copied from class:
ComponentReturns whether thisComponentcan become the focus owner.- Returns:
trueif thisComponentis focusable;falseotherwise- Since:
- JDK1.1
- See Also:
Component.setFocusable(boolean)

isFocusTraversalPolicyProvider 

booleanisFocusTraversalPolicyProvider()Returns whether this container provides focus traversal policy.public final boolean isFocusTraversalPolicyProvider()-
Description copied from class:
ContainerReturns whether this container provides focus traversal policy. If this property is set totruethen 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:
trueif this container provides focus traversal policy,falseotherwise- Since:
- 1.5
- See Also:
Container.setFocusTraversalPolicy(java.awt.FocusTraversalPolicy),Container.getFocusTraversalPolicy(),Container.setFocusCycleRoot(boolean),Container.setFocusTraversalPolicyProvider(boolean)

isFocusTraversalPolicySet 

booleanisFocusTraversalPolicySet()Returns whether the focus traversal policy has been explicitly set for this Container.public boolean isFocusTraversalPolicySet()-
Description copied from class:
ContainerReturns 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:
trueif the focus traversal policy has been explicitly set for this Container;falseotherwise.- Since:
- 1.4

lostFocus 

booleanlostFocus(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 

voidnextFocus()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 

voidrequestFocus()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:
ComponentRequests 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
requestFocusInWindowwhen 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
requestFocusmethods ofComponentbeing invoked.

requestFocus 

protected booleanrequestFocus(boolean temporary)Requests that thisComponentget the input focus, and that thisComponent's top-level ancestor become the focusedWindow.protected boolean requestFocus(boolean temporary)-
Description copied from class:
ComponentRequests that thisComponentget 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
falseis returned, the request is guaranteed to fail. Iftrueis 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 oftrueindicates 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.clearGlobalFocusOwnerinstead.Because the focus behavior of this method is platform-dependent, developers are strongly encouraged to use
requestFocusInWindowwhen possible.Every effort will be made to ensure that
FocusEvents 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 lightweightComponents. 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
requestFocusmethods ofComponentbeing 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:
falseif the focus change request is guaranteed to fail;trueif it is likely to succeed- Since:
- 1.4
- See Also:
FocusEvent,Component.addFocusListener(java.awt.event.FocusListener),Component.isFocusable(),Component.isDisplayable(),KeyboardFocusManager.clearGlobalFocusOwner()

requestFocusInWindow 

booleanrequestFocusInWindow()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:
ComponentRequests 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
falseis returned, the request is guaranteed to fail. Iftrueis 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 oftrueindicates 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
requestFocuswhen possible. Code which relies onrequestFocusmay 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
requestFocusmethods ofComponentbeing invoked.- Returns:
falseif the focus change request is guaranteed to fail;trueif 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 booleanrequestFocusInWindow(boolean temporary)Requests that thisComponentget the input focus, if thisComponent's top-level ancestor is already the focusedWindow.protected boolean requestFocusInWindow(boolean temporary)-
Description copied from class:
ComponentRequests that thisComponentget 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
falseis returned, the request is guaranteed to fail. Iftrueis 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 oftrueindicates 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.clearGlobalFocusOwnerinstead.The focus behavior of this method can be implemented uniformly across platforms, and thus developers are strongly encouraged to use this method over
requestFocuswhen possible. Code which relies onrequestFocusmay exhibit different focus behavior on different platforms.Every effort will be made to ensure that
FocusEvents 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
requestFocusmethods ofComponentbeing 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:
falseif the focus change request is guaranteed to fail;trueif 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 

voidsetFocusable(boolean focusable)Sets the focusable state of this Component to the specified value.public void setFocusable(boolean focusable)-
Description copied from class:
ComponentSets 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 

voidsetFocusCycleRoot(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:
WindowDoes nothing because Windows must always be roots of a focus traversal cycle. The passed-in value is ignored.- Overrides:
setFocusCycleRootin classContainer- Parameters:
focusCycleRoot- this value is ignored- Since:
- 1.4
- See Also:
Window.isFocusCycleRoot(),Container.setFocusTraversalPolicy(java.awt.FocusTraversalPolicy),Container.getFocusTraversalPolicy()

setFocusTraversalKeys 

voidsetFocusTraversalKeys(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:
ContainerSets 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.
To disable a traversal key, use an empty Set; Collections.EMPTY_SET is recommended.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:
setFocusTraversalKeysin 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 

voidsetFocusTraversalKeysEnabled(boolean focusTraversalKeysEnabled)Sets whether focus traversal keys are enabled for this Component.public void setFocusTraversalKeysEnabled(boolean focusTraversalKeysEnabled)-
Description copied from class:
ComponentSets 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 

voidsetFocusTraversalPolicy(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:
ContainerSets 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 

voidsetFocusTraversalPolicyProvider(boolean provider)Sets whether this container will be used to provide focus traversal policy.public final void setFocusTraversalPolicyProvider(boolean provider)-
Description copied from class:
ContainerSets whether this container will be used to provide focus traversal policy. Container with this property astruewill 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 

voidtransferFocus()Transfers the focus to the next component, as though this Component were the focus owner.public void transferFocus()-
Description copied from class:
ComponentTransfers the focus to the next component, as though this Component were the focus owner.- Since:
- JDK1.1
- See Also:
Component.requestFocus()

transferFocusBackward 

voidtransferFocusBackward()Transfers the focus to the previous component, as though this Component were the focus owner.public void transferFocusBackward()-
Description copied from class:
ComponentTransfers the focus to the previous component, as though this Component were the focus owner.- Since:
- 1.4
- See Also:
Component.requestFocus()

transferFocusDownCycle 

voidtransferFocusDownCycle()Transfers the focus down one focus traversal cycle.public void transferFocusDownCycle()-
Description copied from class:
ContainerTransfers 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 

voidtransferFocusUpCycle()Transfers the focus up one focus traversal cycle.public void transferFocusUpCycle()-
Description copied from class:
ComponentTransfers 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 

FontMetricsgetFontMetrics(Font font)Gets the font metrics for the specified font.-
Description copied from class:
ComponentGets the font metrics for the specified font. Warning: Since Font metrics are affected by theFontRenderContextand 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 ifGraphics2Dfunctionality is being used. Instead metrics can be obtained at rendering time by callingGraphics.getFontMetrics()or text measurement APIs on theFontclass.- 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 

GraphicsgetGraphics()Creates a graphics context for this component.public Graphics getGraphics()-
Description copied from class:
ComponentCreates a graphics context for this component. This method will returnnullif this component is currently not displayable.- Returns:
- a graphics context for this component, or
nullif it has none - Since:
- JDK1.0
- See Also:
Component.paint(java.awt.Graphics)

getGraphicsConfiguration 

GraphicsConfigurationgetGraphicsConfiguration()Gets theGraphicsConfigurationassociated with thisComponent.public GraphicsConfiguration getGraphicsConfiguration()-
Description copied from class:
ComponentGets theGraphicsConfigurationassociated with thisComponent. If theComponenthas not been assigned a specificGraphicsConfiguration, theGraphicsConfigurationof theComponentobject's top-level container is returned. If theComponenthas been created, but not yet added to aContainer, this method returnsnull.- Returns:
- the
GraphicsConfigurationused by thisComponentornull - Since:
- 1.3

getLocationOnScreen 

PointgetLocationOnScreen()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:
ComponentGets 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
Pointrepresenting 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 

PointgetMousePosition()Returns the position of the mouse pointer in thisComponent's coordinate space if theComponentis directly under the mouse pointer, otherwise returnsnull.-
Description copied from class:
ComponentReturns the position of the mouse pointer in thisComponent's coordinate space if theComponentis directly under the mouse pointer, otherwise returnsnull. If theComponentis not showing on the screen, this method returnsnulleven if the mouse pointer is above the area where theComponentwould be displayed. If theComponentis partially or fully obscured by otherComponents or native windows, this method returns a non-null value only if the mouse pointer is located above the unobscured part of theComponent.For
Containers it returns a non-null value if the mouse is above theContaineritself 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
Componentis 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 

ToolkitgetToolkit()Returns the toolkit of this frame.public Toolkit getToolkit()-
Description copied from class:
WindowReturns the toolkit of this frame.- Overrides:
getToolkitin classComponent- Returns:
- the toolkit of this window.
- See Also:
Toolkit,Toolkit.getDefaultToolkit(),Component.getToolkit()
-
-
Hierarchy Methods Modifier and Type Method and Description 
add 

Componentadd(Component comp)Appends the specified component to the end of this container.-
Description copied from class:
ContainerAppends 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- ifcompisnull- See Also:
Container.addImpl(java.awt.Component, java.lang.Object, int),Container.invalidate(),Container.validate(),JComponent.revalidate()

add 

Componentadd(Component comp, int index)Adds the specified component to this container at the given position.-
Description copied from class:
ContainerAdds 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-1to append the component to the end- Returns:
- the component
comp - Throws:
java.lang.NullPointerException- ifcompisnulljava.lang.IllegalArgumentException- ifindexis 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 

voidadd(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:
ContainerAdds 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- ifcompisnull- Since:
- JDK1.1
- See Also:
Container.addImpl(java.awt.Component, java.lang.Object, int),Container.invalidate(),Container.validate(),JComponent.revalidate(),LayoutManager

add 

voidadd(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:
ContainerAdds 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;-1means insert at the end component- Throws:
java.lang.NullPointerException- ifcompisnulljava.lang.IllegalArgumentException- ifindexis 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 

Componentadd(java.lang.String name, Component comp)Adds the specified component to this container.-
Description copied from class:
ContainerAdds 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- ifcompisnull- See Also:
Container.add(Component, Object),Container.invalidate()

addImpl 

protected voidaddImpl(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:
ContainerAdds 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 theaddLayoutComponentmethod.The constraints are defined by the particular layout manager being used. For example, the
BorderLayoutclass defines five constraints:BorderLayout.NORTH,BorderLayout.SOUTH,BorderLayout.EAST,BorderLayout.WEST, andBorderLayout.CENTER.The
GridBagLayoutclass requires aGridBagConstraintsobject. 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-1means append to the end- Throws:
java.lang.IllegalArgumentException- ifindexis invalid; ifcompis 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- ifcompis an ancestor of this containerjava.lang.IllegalArgumentException- if adding a window to a containerjava.lang.NullPointerException- ifcompisnull- Since:
- JDK1.1
- See Also:
Container.add(Component),Container.add(Component, int),Container.add(Component, java.lang.Object),Container.invalidate(),LayoutManager,LayoutManager2

countComponents 

intcountComponents()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 

ComponentgetComponent(int n)Gets the nth component in this container.public Component getComponent(int n)-
Description copied from class:
ContainerGets 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 

intgetComponentCount()Gets the number of components in this panel.public int getComponentCount()-
Description copied from class:
ContainerGets 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:
ContainerGets 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 

intgetComponentZOrder(Component comp)Returns the z-order index of the component inside the container.public int getComponentZOrder(Component comp)-
Description copied from class:
ContainerReturns 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
nullor doesn't belong to the container - Since:
- 1.5
- See Also:
Container.setComponentZOrder(java.awt.Component, int)

isAncestorOf 

booleanisAncestorOf(Component c)Checks if the component is contained in the component hierarchy of this container.
remove 

voidremove(Component comp)Removes the specified component from this container.public void remove(Component comp)-
Description copied from class:
ContainerRemoves the specified component from this container. This method also notifies the layout manager to remove the component from this container's layout via theremoveLayoutComponentmethod.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- ifcompisnull- See Also:
Container.add(java.awt.Component),Container.invalidate(),Container.validate(),Container.remove(int)

remove 

voidremove(int index)Removes the component, specified byindex, from this container.public void remove(int index)-
Description copied from class:
ContainerRemoves the component, specified byindex, from this container. This method also notifies the layout manager to remove the component from this container's layout via theremoveLayoutComponentmethod.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- ifindexis not in range[0, getComponentCount()-1]- Since:
- JDK1.1
- See Also:
Container.add(java.awt.Component),Container.invalidate(),Container.validate(),Container.getComponentCount()

removeAll 

voidremoveAll()Removes all the components from this container.public void removeAll()-
Description copied from class:
ContainerRemoves all the components from this container. This method also notifies the layout manager to remove the components from this container's layout via theremoveLayoutComponentmethod.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 

voidsetComponentZOrder(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:
ContainerMoves 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 callremoveNotifyon 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-
Containercomponents.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- ifcompisnulljava.lang.IllegalArgumentException- ifcompis one of the container's parentsjava.lang.IllegalArgumentException- ifindexis 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 aWindowto a container- Since:
- 1.5
- See Also:
Container.getComponentZOrder(java.awt.Component),Container.invalidate()
-
-
Image Methods Modifier and Type Method and Description 
checkImage 

intcheckImage(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:
ComponentReturns 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
prepareImagemethod to force the loading of an image.Information on the flags returned by this method can be found with the discussion of the
ImageObserverinterface.- Parameters:
image- theImageobject whose status is being checkedobserver- theImageObserverobject to be notified as the image is being prepared- Returns:
- the bitwise inclusive OR of
ImageObserverflags 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 

intcheckImage(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:
ComponentReturns 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
prepareImagemethod to force the loading of an image.The
checkImagemethod ofComponentcalls its peer'scheckImagemethod to calculate the flags. If this component does not yet have a peer, the component's toolkit'scheckImagemethod is called instead.Information on the flags returned by this method can be found with the discussion of the
ImageObserverinterface.- Parameters:
image- theImageobject 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- theImageObserverobject to be notified as the image is being prepared- Returns:
- the bitwise inclusive OR of
ImageObserverflags 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 

ImagecreateImage(java.awt.image.ImageProducer producer)Creates an image from the specified image producer.
createImage 

ImagecreateImage(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:
ComponentCreates 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
nullif 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.VolatileImagecreateVolatileImage(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:
ComponentCreates 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
nullif 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.VolatileImagecreateVolatileImage(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:
ComponentCreates 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 theVolatileImageinterface.- 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 

booleanimageUpdate(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:
ComponentRepaints the component when the image has changed. ThisimageUpdatemethod of anImageObserveris called when more information about an image which had been previously requested using an asynchronous routine such as thedrawImagemethod ofGraphicsbecomes available. See the definition ofimageUpdatefor more information on this method and its arguments.The
imageUpdatemethod ofComponentincrementally draws an image on the component as more of the bits of the image are available.If the system property
awt.image.incrementaldrawis 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.redrawrateis 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, andheightarguments depends on the value of theinfoflagsargument.- Specified by:
imageUpdatein interfacejava.awt.image.ImageObserver- Parameters:
img- the image being observedinfoflags- seeimageUpdatefor more informationx- the x coordinatey- the y coordinatew- the widthh- the height- Returns:
falseif the infoflags indicate that the image is completely loaded;trueotherwise.- 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 

booleanprepareImage(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:
ComponentPrepares 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- theImagefor which to prepare a screen representationobserver- theImageObserverobject to be notified as the image is being prepared- Returns:
trueif the image has already been fully prepared;falseotherwise- Since:
- JDK1.0

prepareImage 

booleanprepareImage(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:
ComponentPrepares 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 ofImagefor which to prepare a screen representationwidth- the width of the desired screen representationheight- the height of the desired screen representationobserver- theImageObserverobject to be notified as the image is being prepared- Returns:
trueif the image has already been fully prepared;falseotherwise- Since:
- JDK1.0
- See Also:
ImageObserver
-
-
Layout Methods Modifier and Type Method and Description 
bounds 

Rectanglebounds()Deprecated. As of JDK version 1.1, replaced bygetBounds().
contains 

booleancontains(int x, int y)Checks whether this component "contains" the specified point, wherexandyare defined to be relative to the coordinate system of this component.public boolean contains(int x, int y)-
Description copied from class:
ComponentChecks whether this component "contains" the specified point, wherexandyare 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 

booleancontains(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:
ComponentChecks 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- ifpisnull- Since:
- JDK1.1
- See Also:
Component.getComponentAt(Point)

doLayout 

voiddoLayout()Causes this container to lay out its components.public void doLayout()-
Description copied from class:
ContainerCauses this container to lay out its components. Most programs should not call this method directly, but should invoke thevalidatemethod instead.- Overrides:
doLayoutin classComponent- Since:
- JDK1.1
- See Also:
LayoutManager.layoutContainer(java.awt.Container),Container.setLayout(java.awt.LayoutManager),Container.validate()

findComponentAt 

ComponentfindComponentAt(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:
ContainerLocates 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 

ComponentfindComponentAt(Point p)Locates the visible child component that contains the specified point.-
Description copied from class:
ContainerLocates 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- ifpisnull- Since:
- 1.2
- See Also:
Component.contains(int, int),Container.getComponentAt(int, int)

getAlignmentX 

floatgetAlignmentX()Returns the alignment along the x axis.public float getAlignmentX()-
Description copied from class:
ContainerReturns 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:
getAlignmentXin classComponent

getAlignmentY 

floatgetAlignmentY()Returns the alignment along the y axis.public float getAlignmentY()-
Description copied from class:
ContainerReturns 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:
getAlignmentYin classComponent

getBaseline 

intgetBaseline(int width, int height)Returns the baseline.public int getBaseline(int width, int height)-
Description copied from class:
ComponentReturns the baseline. The baseline is measured from the top of the component. This method is primarily meant forLayoutManagers to align components along their baseline. A return value less than 0 indicates this component does not have a reasonable baseline and thatLayoutManagers 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
getBaselineResizeBehaviorcan 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.BaselineResizeBehaviorgetBaselineResizeBehavior()Returns an enum indicating how the baseline of the component changes as the size changes.public Component.BaselineResizeBehavior getBaselineResizeBehavior()-
Description copied from class:
ComponentReturns 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 usinggetBaselineand if a value >= 0 is returned use this method. It is acceptable for this method to return a value other thanBaselineResizeBehavior.OTHEReven ifgetBaselinereturns 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 

RectanglegetBounds()Gets the bounds of this component in the form of aRectangleobject.public Rectangle getBounds()-
Description copied from class:
ComponentGets the bounds of this component in the form of aRectangleobject. 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 

RectanglegetBounds(Rectangle rv)Stores the bounds of this component into "return value" rv and return rv.-
Description copied from class:
ComponentStores the bounds of this component into "return value" rv and return rv. If rv isnulla newRectangleis allocated. This version ofgetBoundsis useful if the caller wants to avoid allocating a newRectangleobject on the heap.- Parameters:
rv- the return value, modified to the components bounds- Returns:
- rv

getComponentAt 

ComponentgetComponentAt(int x, int y)Locates the component that contains the x,y position.public Component getComponentAt(int x, int y)-
Description copied from class:
ContainerLocates 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:
getComponentAtin 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 

ComponentgetComponentAt(Point p)Gets the component that contains the specified point.-
Description copied from class:
ContainerGets the component that contains the specified point.- Overrides:
getComponentAtin classComponent- Parameters:
p- the point.- Returns:
- returns the component that contains the point,
or
nullif the component does not contain the point. - Since:
- JDK1.1
- See Also:
Component.contains(int, int)

getHeight 

intgetHeight()Returns the current height of this component.public int getHeight()-
Description copied from class:
ComponentReturns the current height of this component. This method is preferable to writingcomponent.getBounds().height, orcomponent.getSize().heightbecause it doesn't cause any heap allocations.- Returns:
- the current height of this component
- Since:
- 1.2

getInsets 

InsetsgetInsets()Determines the insets of this container, which indicate the size of the container's border.public Insets getInsets()-
Description copied from class:
ContainerDetermines the insets of this container, which indicate the size of the container's border.A
Frameobject, 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 

LayoutManagergetLayout()Gets the layout manager for this container.public LayoutManager getLayout()-
Description copied from class:
ContainerGets the layout manager for this container.

getLocation 

PointgetLocation()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:
ComponentGets 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
Pointrepresenting 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 

PointgetLocation(Point rv)Stores the x,y origin of this component into "return value" rv and return rv.-
Description copied from class:
ComponentStores the x,y origin of this component into "return value" rv and return rv. If rv isnulla newPointis allocated. This version ofgetLocationis useful if the caller wants to avoid allocating a newPointobject on the heap.- Parameters:
rv- the return value, modified to the components location- Returns:
- rv

getMaximumSize 

DimensiongetMaximumSize()Returns the maximum size of this container.public Dimension getMaximumSize()-
Description copied from class:
ContainerReturns the maximum size of this container. If the maximum size has not been set explicitly byComponent.setMaximumSize(Dimension)and theLayoutManagerinstalled on thisContaineris 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 invokemaximumLayoutSizeon theLayoutManager2every time this method is invoked, rather theLayoutManager2will only be queried after theContainerbecomes invalid.- Overrides:
getMaximumSizein classComponent- Returns:
- an instance of
Dimensionthat represents the maximum size of this container. - See Also:
Container.getPreferredSize(),Container.getMinimumSize(),Container.getLayout(),LayoutManager2.maximumLayoutSize(Container),Component.getMaximumSize()

getMinimumSize 

DimensiongetMinimumSize()Returns the minimum size of this container.public Dimension getMinimumSize()-
Description copied from class:
ContainerReturns the minimum size of this container. If the minimum size has not been set explicitly byComponent.setMinimumSize(Dimension)and thisContainerhas anon-nullLayoutManager, 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 invokeminimumLayoutSizeon theLayoutManagerevery time this method is invoked, rather theLayoutManagerwill only be queried after theContainerbecomes invalid.- Overrides:
getMinimumSizein classComponent- Returns:
- an instance of
Dimensionthat represents the minimum size of this container. - Since:
- JDK1.1
- See Also:
Container.getPreferredSize(),Container.getMaximumSize(),Container.getLayout(),LayoutManager.minimumLayoutSize(Container),Component.getMinimumSize()

getMousePosition 

PointgetMousePosition(boolean allowChildren)Returns the position of the mouse pointer in thisContainer's coordinate space if theContaineris under the mouse pointer, otherwise returnsnull.-
Description copied from class:
ContainerReturns the position of the mouse pointer in thisContainer's coordinate space if theContaineris under the mouse pointer, otherwise returnsnull. This method is similar toComponent.getMousePosition()with the exception that it can take theContainer's children into account. IfallowChildrenisfalse, this method will return a non-null value only if the mouse pointer is above theContainerdirectly, not above the part obscured by children. IfallowChildrenistrue, this method returns a non-null value if the mouse pointer is aboveContaineror 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 

DimensiongetPreferredSize()Returns the preferred size of this container.public Dimension getPreferredSize()-
Description copied from class:
ContainerReturns the preferred size of this container. If the preferred size has not been set explicitly byComponent.setPreferredSize(Dimension)and thisContainerhas anon-nullLayoutManager, 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 invokepreferredLayoutSizeon theLayoutManagerevery time this method is invoked, rather theLayoutManagerwill only be queried after theContainerbecomes invalid.- Overrides:
getPreferredSizein classComponent- Returns:
- an instance of
Dimensionthat represents the preferred size of this container. - See Also:
Container.getMinimumSize(),Container.getMaximumSize(),Container.getLayout(),LayoutManager.preferredLayoutSize(Container),Component.getPreferredSize()

getSize 

DimensiongetSize()Returns the size of this component in the form of aDimensionobject.public Dimension getSize()-
Description copied from class:
ComponentReturns the size of this component in the form of aDimensionobject. Theheightfield of theDimensionobject contains this component's height, and thewidthfield of theDimensionobject contains this component's width.- Returns:
- a
Dimensionobject that indicates the size of this component - Since:
- JDK1.1
- See Also:
Component.setSize(int, int)

getSize 

DimensiongetSize(Dimension rv)Stores the width/height of this component into "return value" rv and return rv.-
Description copied from class:
ComponentStores the width/height of this component into "return value" rv and return rv. If rv isnulla newDimensionobject is allocated. This version ofgetSizeis useful if the caller wants to avoid allocating a newDimensionobject on the heap.- Parameters:
rv- the return value, modified to the components size- Returns:
- rv

getWidth 

intgetWidth()Returns the current width of this component.public int getWidth()-
Description copied from class:
ComponentReturns the current width of this component. This method is preferable to writingcomponent.getBounds().width, orcomponent.getSize().widthbecause it doesn't cause any heap allocations.- Returns:
- the current width of this component
- Since:
- 1.2

getX 

intgetX()Returns the current x coordinate of the components origin.public int getX()-
Description copied from class:
ComponentReturns the current x coordinate of the components origin. This method is preferable to writingcomponent.getBounds().x, orcomponent.getLocation().xbecause it doesn't cause any heap allocations.- Returns:
- the current x coordinate of the components origin
- Since:
- 1.2

getY 

intgetY()Returns the current y coordinate of the components origin.public int getY()-
Description copied from class:
ComponentReturns the current y coordinate of the components origin. This method is preferable to writingcomponent.getBounds().y, orcomponent.getLocation().ybecause it doesn't cause any heap allocations.- Returns:
- the current y coordinate of the components origin
- Since:
- 1.2

insets 

Insetsinsets()Deprecated. As of JDK version 1.1, replaced bygetInsets().
inside 

booleaninside(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 

voidinvalidate()Invalidates the container.public void invalidate()-
Description copied from class:
ContainerInvalidates the container.If the
LayoutManagerinstalled on this container is an instance of theLayoutManager2interface, then theLayoutManager2.invalidateLayout(Container)method is invoked on it supplying thisContaineras the argument.Afterwards this method marks this container invalid, and invalidates its ancestors. See the
Component.invalidate()method for more details.- Overrides:
invalidatein classComponent- See Also:
Container.validate(),Container.layout(),LayoutManager2

isMaximumSizeSet 

booleanisMaximumSizeSet()Returns true if the maximum size has been set to a non-nullvalue otherwise returns false.public boolean isMaximumSizeSet()-
Description copied from class:
ComponentReturns true if the maximum size has been set to a non-nullvalue otherwise returns false.- Returns:
- true if
maximumSizeis non-null, false otherwise - Since:
- 1.5

isMinimumSizeSet 

booleanisMinimumSizeSet()Returns whether or notsetMinimumSizehas been invoked with a non-null value.public boolean isMinimumSizeSet()-
Description copied from class:
ComponentReturns whether or notsetMinimumSizehas been invoked with a non-null value.- Returns:
- true if
setMinimumSizehas been invoked with a non-null value. - Since:
- 1.5

isPreferredSizeSet 

booleanisPreferredSizeSet()Returns true if the preferred size has been set to a non-nullvalue otherwise returns false.public boolean isPreferredSizeSet()-
Description copied from class:
ComponentReturns true if the preferred size has been set to a non-nullvalue otherwise returns false.- Returns:
- true if
setPreferredSizehas been invoked with a non-null value. - Since:
- 1.5

isValid 

booleanisValid()Determines whether this component is valid.public boolean isValid()-
Description copied from class:
ComponentDetermines 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:
trueif the component is valid,falseotherwise- Since:
- JDK1.0
- See Also:
Component.validate(),Component.invalidate()

isValidateRoot 

booleanisValidateRoot()Indicates if this container is a validate root.public boolean isValidateRoot()-
Description copied from class:
WindowIndicates if this container is a validate root.Windowobjects are the validate roots, and, therefore, they override this method to returntrue.- Overrides:
isValidateRootin classContainer- Returns:
true- Since:
- 1.7
- See Also:
Container.isValidateRoot()

layout 

voidlayout()Deprecated. As of JDK version 1.1, replaced bydoLayout().@Deprecated public void layout()Deprecated. As of JDK version 1.1, replaced bydoLayout().
locate 

Componentlocate(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 

Pointlocation()Deprecated. As of JDK version 1.1, replaced bygetLocation().
minimumSize 

DimensionminimumSize()Deprecated. As of JDK version 1.1, replaced bygetMinimumSize().Deprecated. As of JDK version 1.1, replaced bygetMinimumSize().
move 

voidmove(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 

DimensionpreferredSize()Deprecated. As of JDK version 1.1, replaced bygetPreferredSize().Deprecated. As of JDK version 1.1, replaced bygetPreferredSize().
reshape 

voidreshape(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 

voidresize(Dimension d)Deprecated. As of JDK version 1.1, replaced bysetSize(Dimension).Deprecated. As of JDK version 1.1, replaced bysetSize(Dimension).
resize 

voidresize(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 

voidrevalidate()Revalidates the component hierarchy up to the nearest validate root.public void revalidate()-
Description copied from class:
ComponentRevalidates 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 

voidsetBounds(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:
WindowMoves and resizes this component. The new location of the top-left corner is specified byxandy, and the new size is specified bywidthandheight.This method changes layout-related information, and therefore, invalidates the component hierarchy.
The
widthorheightvalues 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
Windowobject is placed and sized in a way that corresponds closely to the desktop settings.- Overrides:
setBoundsin classComponent- Parameters:
x- the new x-coordinate of this componenty- the new y-coordinate of this componentwidth- the newwidthof this componentheight- the newheightof 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 

voidsetBounds(Rectangle r)Moves and resizes this component to conform to the new bounding rectangler.public void setBounds(Rectangle r)-
Description copied from class:
WindowMoves and resizes this component to conform to the new bounding rectangler. This component's new position is specified byr.xandr.y, and its new size is specified byr.widthandr.heightThis method changes layout-related information, and therefore, invalidates the component hierarchy.
The
r.widthorr.heightvalues 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
Windowobject is placed and sized in a way that corresponds closely to the desktop settings.- Overrides:
setBoundsin 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 

voidsetLayout(LayoutManager mgr)Sets the layout manager for this container.public void setLayout(LayoutManager mgr)-
Description copied from class:
ContainerSets 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 

voidsetLocation(int x, int y)Moves this component to a new location.public void setLocation(int x, int y)-
Description copied from class:
WindowMoves this component to a new location. The top-left corner of the new location is specified by thexandyparameters 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
Windowobject is placed and sized in a way that corresponds closely to the desktop settings.- Overrides:
setLocationin 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 

voidsetLocation(Point p)Moves this component to a new location.public void setLocation(Point p)-
Description copied from class:
WindowMoves this component to a new location. The top-left corner of the new location is specified by pointp. Pointpis 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
Windowobject is placed and sized in a way that corresponds closely to the desktop settings.- Overrides:
setLocationin 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 

voidsetMaximumSize(Dimension maximumSize)Sets the maximum size of this component to a constant value.public void setMaximumSize(Dimension maximumSize)-
Description copied from class:
ComponentSets the maximum size of this component to a constant value. Subsequent calls togetMaximumSizewill always return this value. Setting the maximum size tonullrestores the default behavior.- Parameters:
maximumSize- aDimensioncontaining the desired maximum allowable size- Since:
- 1.5
- See Also:
Component.getMaximumSize(),Component.isMaximumSizeSet()

setMinimumSize 

voidsetMinimumSize(Dimension minimumSize)Sets the minimum size of this window to a constant value.public void setMinimumSize(Dimension minimumSize)-
Description copied from class:
WindowSets the minimum size of this window to a constant value. Subsequent calls togetMinimumSizewill always return this value. If current window's size is less thanminimumSizethe size of the window is automatically enlarged to honor the minimum size.If the
setSizeorsetBoundsmethods are called afterwards with a width or height less than that was specified by thesetMinimumSizemethod the window is automatically enlarged to meet theminimumSizevalue. TheminimumSizevalue also affects the behaviour of thepackmethod.The default behavior is restored by setting the minimum size parameter to the
nullvalue.Resizing operation may be restricted if the user tries to resize window below the
minimumSizevalue. This behaviour is platform-dependent.- Overrides:
setMinimumSizein 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 

voidsetPreferredSize(Dimension preferredSize)Sets the preferred size of this component to a constant value.public void setPreferredSize(Dimension preferredSize)-
Description copied from class:
ComponentSets the preferred size of this component to a constant value. Subsequent calls togetPreferredSizewill always return this value. Setting the preferred size tonullrestores the default behavior.- Parameters:
preferredSize- The new preferred size, or null- Since:
- 1.5
- See Also:
Component.getPreferredSize(),Component.isPreferredSizeSet()

setSize 

voidsetSize(Dimension d)Resizes this component so that it has widthd.widthand heightd.height.public void setSize(Dimension d)-
Description copied from class:
WindowResizes this component so that it has widthd.widthand heightd.height.This method changes layout-related information, and therefore, invalidates the component hierarchy.
The
d.widthandd.heightvalues 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
Windowobject is placed and sized in a way that corresponds closely to the desktop settings.- Overrides:
setSizein 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 

voidsetSize(int width, int height)Resizes this component so that it has widthwidthand heightheight.public void setSize(int width, int height)-
Description copied from class:
WindowResizes this component so that it has widthwidthand heightheight.This method changes layout-related information, and therefore, invalidates the component hierarchy.
The
widthandheightvalues 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
Windowobject is placed and sized in a way that corresponds closely to the desktop settings.- Overrides:
setSizein 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 

Dimensionsize()Deprecated. As of JDK version 1.1, replaced bygetSize().
validate 

voidvalidate()Validates this container and all of its subcomponents.public void validate()-
Description copied from class:
ContainerValidates 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
Containeris not valid, this method invokes thevalidateTreemethod and marks thisContaineras valid. Otherwise, no action is performed.- Overrides:
validatein classComponent- See Also:
Container.add(java.awt.Component),Container.invalidate(),Container.isValidateRoot(),JComponent.revalidate(),Container.validateTree()

validateTree 

protected voidvalidateTree()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:
ContainerRecursively 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 

booleangetIgnoreRepaint()public boolean getIgnoreRepaint()
paint 

voidpaint(Graphics g)Paints the container.public void paint(Graphics g)-
Description copied from class:
WindowPaints 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:
paintin classContainer- Parameters:
g- the specified Graphics window- Since:
- 1.7
- See Also:
Component.update(Graphics)

paintAll 

voidpaintAll(Graphics g)Paints this component and all of its subcomponents.public void paintAll(Graphics g)-
Description copied from class:
ComponentPaints 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 

voidpaintComponents(Graphics g)Paints each of the components in this container.public void paintComponents(Graphics g)-
Description copied from class:
ContainerPaints 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 

voidrepaint()Repaints this component.public void repaint()-
Description copied from class:
ComponentRepaints this component.If this component is a lightweight component, this method causes a call to this component's
paintmethod as soon as possible. Otherwise, this method causes a call to this component'supdatemethod 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 

voidrepaint(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:
ComponentRepaints the specified rectangle of this component.If this component is a lightweight component, this method causes a call to this component's
paintmethod as soon as possible. Otherwise, this method causes a call to this component'supdatemethod 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 

voidrepaint(long tm)Repaints the component.public void repaint(long tm)-
Description copied from class:
ComponentRepaints the component. If this component is a lightweight component, this results in a call topaintwithintmmilliseconds.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 

voidrepaint(long tm, int x, int y, int width, int height)Repaints the specified rectangle of this component withintmmilliseconds.public void repaint(long tm, int x, int y, int width, int height)-
Description copied from class:
ComponentRepaints the specified rectangle of this component withintmmilliseconds.If this component is a lightweight component, this method causes a call to this component's
paintmethod. Otherwise, this method causes a call to this component'supdatemethod.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 

voidsetIgnoreRepaint(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:
ComponentSets 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 

voidupdate(Graphics g)Updates the container.public void update(Graphics g)-
Description copied from class:
ContainerUpdates 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:
updatein classComponent- Parameters:
g- the specified Graphics window- See Also:
Component.update(Graphics)
-
-
Printing Methods Modifier and Type Method and Description 
list 

voidlist()Prints a listing of this component to the standard system output streamSystem.out.public void list()-
Description copied from class:
ComponentPrints a listing of this component to the standard system output streamSystem.out.- Since:
- JDK1.0
- See Also:
System.out

list 

voidlist(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:
ComponentPrints a listing of this component to the specified output stream.- Parameters:
out- a print stream- Throws:
java.lang.NullPointerException- ifoutisnull- Since:
- JDK1.0

list 

voidlist(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:
ContainerPrints 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+2and so on.- Overrides:
listin classComponent- Parameters:
out- a print streamindent- the number of spaces to indent- Throws:
java.lang.NullPointerException- ifoutisnull- Since:
- JDK1.0
- See Also:
Component.list(java.io.PrintStream, int)

list 

voidlist(java.io.PrintWriter out)Prints a listing to the specified print writer.public void list(java.io.PrintWriter out)-
Description copied from class:
ComponentPrints a listing to the specified print writer.- Parameters:
out- the print writer to print to- Throws:
java.lang.NullPointerException- ifoutisnull- Since:
- JDK1.1

list 

voidlist(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:
ContainerPrints 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+2and so on.- Overrides:
listin classComponent- Parameters:
out- a print writerindent- the number of spaces to indent- Throws:
java.lang.NullPointerException- ifoutisnull- Since:
- JDK1.1
- See Also:
Component.list(java.io.PrintWriter, int)

print 

voidprint(Graphics g)Prints the container.public void print(Graphics g)-
Description copied from class:
ContainerPrints 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:
printin classComponent- Parameters:
g- the specified Graphics window- See Also:
Component.update(Graphics)

printAll 

voidprintAll(Graphics g)Prints this component and all of its subcomponents.public void printAll(Graphics g)-
Description copied from class:
ComponentPrints 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 

voidprintComponents(Graphics g)Prints each of the components in this container.public void printComponents(Graphics g)-
Description copied from class:
ContainerPrints 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 

voidadd(PopupMenu popup)Adds the specified popup menu to the component.public void add(PopupMenu popup)-
Description copied from class:
ComponentAdds the specified popup menu to the component.- Parameters:
popup- the popup menu to be added to the component.- Throws:
java.lang.NullPointerException- ifpopupisnull- Since:
- JDK1.1
- See Also:
Component.remove(MenuComponent)

addNotify 

voidaddNotify()Creates the file dialog's peer.public void addNotify()-
Creates the file dialog's peer. The peer allows us to change the look of the file dialog without changing its functionality.
- Overrides:
addNotifyin classDialog- See Also:
Component.isDisplayable(),Window.removeNotify()

addWindowFocusListener 

voidaddWindowFocusListener(WindowFocusListener l)Adds the specified window focus listener to receive window events from this window.public void addWindowFocusListener(WindowFocusListener l)-
Description copied from class:
WindowAdds 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 

voidaddWindowListener(WindowListener l)Adds the specified window listener to receive window events from this window.public void addWindowListener(WindowListener l)-
Description copied from class:
WindowAdds 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 

voidaddWindowStateListener(WindowStateListener l)Adds the specified window state listener to receive window events from this window.public void addWindowStateListener(WindowStateListener l)-
Description copied from class:
WindowAdds the specified window state listener to receive window events from this window. Iflisnull, 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 

voidapplyResourceBundle(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 

voidapplyResourceBundle(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 

voidcreateBufferStrategy(int numBuffers)Creates a new strategy for multi-buffering on this component.public void createBufferStrategy(int numBuffers)-
Description copied from class:
WindowCreates 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 aBufferStrategywith 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 

voidcreateBufferStrategy(int numBuffers, BufferCapabilities caps)Creates a new strategy for multi-buffering on this component with the required buffer capabilities.-
Description copied from class:
WindowCreates 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 

voiddispose()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:
WindowReleases all of the native screen resources used by thisWindow, its subcomponents, and all of its owned children. That is, the resources for theseComponents will be destroyed, any memory they consume will be returned to the OS, and they will be marked as undisplayable.The
Windowand its subcomponents can be made displayable again by rebuilding the native resources with a subsequent call topackorshow. The states of the recreatedWindowand its subcomponents will be identical to the states of these objects at the point where theWindowwas 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.BufferStrategygetBufferStrategy()Returns theBufferStrategyused by this component.public java.awt.image.BufferStrategy getBufferStrategy()-
Description copied from class:
WindowReturns theBufferStrategyused by this component. This method will return null if aBufferStrategyhas not yet been created or has been disposed.- Returns:
- the buffer strategy used by this component
- Since:
- 1.4
- See Also:
Window.createBufferStrategy(int)

getDirectory 

java.lang.StringgetDirectory()Gets the directory of this file dialog.public java.lang.String getDirectory()-
Gets the directory of this file dialog.
- Returns:
- the (potentially
nullor invalid) directory of thisFileDialog - See Also:
setDirectory(java.lang.String)

getDropTarget 

java.awt.dnd.DropTargetgetDropTarget()Gets theDropTargetassociated with thisComponent.public java.awt.dnd.DropTarget getDropTarget()-
Description copied from class:
ComponentGets theDropTargetassociated with thisComponent.

getFile 

java.lang.StringgetFile()Gets the selected file of this file dialog.public java.lang.String getFile()-
Gets the selected file of this file dialog. If the user selected
CANCEL, the returned file isnull.- Returns:
- the currently selected file of this file dialog window,
or
nullif none is selected - See Also:
setFile(java.lang.String)

getFilenameFilter 

java.io.FilenameFiltergetFilenameFilter()Determines this file dialog's filename filter.public java.io.FilenameFilter getFilenameFilter()-
Determines this file dialog's filename filter. A filename filter allows the user to specify which files appear in the file dialog window. Filename filters do not function in Sun's reference implementation for Microsoft Windows.
- Returns:
- this file dialog's filename filter
- See Also:
FilenameFilter,setFilenameFilter(java.io.FilenameFilter)

getFiles 

java.io.File[]getFiles()Returns files that the user selects.public java.io.File[] getFiles()-
Returns files that the user selects.
If the user cancels the file dialog, then the method returns an empty array.
- Returns:
- files that the user selects or an empty array if the user cancels the file dialog.
- Since:
- 1.7
- See Also:
setFile(String),getFile()

getFocusableWindowState 

booleangetFocusableWindowState()Returns whether this Window can become the focused Window if it meets the other requirements outlined inisFocusableWindow.public boolean getFocusableWindowState()-
Description copied from class:
WindowReturns whether this Window can become the focused Window if it meets the other requirements outlined inisFocusableWindow. If this method returnsfalse, thenisFocusableWindowwill returnfalseas well. If this method returnstrue, thenisFocusableWindowmay returntrueorfalsedepending 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 

ComponentgetFocusOwner()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:
WindowReturns 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:
WindowReturns 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.InputContextgetInputContext()Gets the input context for this window.public java.awt.im.InputContext getInputContext()-
Description copied from class:
WindowGets 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:
getInputContextin classComponent- Returns:
- the input context used by this component;
nullif no context can be determined - Since:
- 1.2
- See Also:
Component.getInputContext()

getInputMethodRequests 

java.awt.im.InputMethodRequestsgetInputMethodRequests()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:
ComponentGets 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 anInputMethodRequestsinstance. At the same time, it also has to handle input method events.- Returns:
- the input method request handler for this component,
nullby default - Since:
- 1.2
- See Also:
Component.addInputMethodListener(java.awt.event.InputMethodListener)

getModalExclusionType 

Dialog.ModalExclusionTypegetModalExclusionType()Returns the modal exclusion type of this window.public Dialog.ModalExclusionType getModalExclusionType()-
Description copied from class:
WindowReturns 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.ModalityTypegetModalityType()Returns the modality type of this dialog.public Dialog.ModalityType getModalityType()-
Description copied from class:
DialogReturns the modality type of this dialog.- Returns:
- modality type of this dialog
- Since:
- 1.6
- See Also:
Dialog.setModalityType(java.awt.Dialog.ModalityType)

getMode 

intgetMode()Indicates whether this file dialog box is for loading from a file or for saving to a file.public int getMode()-
Indicates whether this file dialog box is for loading from a file or for saving to a file.
- Returns:
- the mode of this file dialog window, either
FileDialog.LOADorFileDialog.SAVE - See Also:
LOAD,SAVE,setMode(int)

getMostRecentFocusOwner 

ComponentgetMostRecentFocusOwner()Returns the child Component of this Window that will receive the focus when this Window is focused.public Component getMostRecentFocusOwner()-
Description copied from class:
WindowReturns 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 

floatgetOpacity()Returns the opacity of the window.public float getOpacity()-
Description copied from class:
WindowReturns 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 

WindowgetOwner()Returns the owner of this window.
getPeer 

java.awt.peer.ComponentPeergetPeer()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 

ShapegetShape()Returns the shape of the window.public Shape getShape()-
Description copied from class:
WindowReturns 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
nullif no shape is specified for the window - Since:
- 1.7
- See Also:
Window.setShape(Shape),GraphicsDevice.WindowTranslucency

getTitle 

java.lang.StringgetTitle()Gets the title of the dialog.public java.lang.String getTitle()-
Description copied from class:
DialogGets 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:
Dialog.setTitle(java.lang.String)

getTreeLock 

java.lang.ObjectgetTreeLock()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:
ComponentGets 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.TypegetType()Returns the type of the window.public Window.Type getType()-
Description copied from class:
WindowReturns the type of the window.- Since:
- 1.7
- See Also:
Window.setType(java.awt.Window.Type)

getWarningString 

java.lang.StringgetWarningString()Gets the warning string that is displayed with this window.public final java.lang.String getWarningString()-
Description copied from class:
WindowGets 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'scheckTopLevelWindowmethod returnsfalsewhen this window is passed to it as an argument.If the window is secure, then
getWarningStringreturnsnull. If the window is insecure, this method checks for the system propertyawt.appletWarningand 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:
WindowReturns an array of all the window focus listeners registered on this window.- Returns:
- all of this window's
WindowFocusListeners 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:
WindowReturns an array of all the window listeners registered on this window.- Returns:
- all of this window's
WindowListeners 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:
WindowReturns an array of all the window state listeners registered on this window.- Returns:
- all of this window's
WindowStateListeners 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 

booleanisActive()Returns whether this Window is active.public boolean isActive()-
Description copied from class:
WindowReturns 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 

booleanisAlwaysOnTop()Returns whether this window is an always-on-top window.public final boolean isAlwaysOnTop()-
Description copied from class:
WindowReturns whether this window is an always-on-top window.- Returns:
true, if the window is in always-on-top state,falseotherwise- Since:
- 1.5
- See Also:
Window.setAlwaysOnTop(boolean)

isAlwaysOnTopSupported 

booleanisAlwaysOnTopSupported()Returns whether the always-on-top mode is supported for this window.public boolean isAlwaysOnTopSupported()-
Description copied from class:
WindowReturns 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 

booleanisAutoRequestFocus()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:
WindowReturns 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
autoRequestFocusvalue oftrue.- Returns:
autoRequestFocusvalue- Since:
- 1.7
- See Also:
Window.setAutoRequestFocus(boolean)

isFocusableWindow 

booleanisFocusableWindow()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:
WindowReturns 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:
trueif this Window can be the focused Window;falseotherwise- Since:
- 1.4
- See Also:
Window.getFocusableWindowState(),Window.setFocusableWindowState(boolean),Window.isShowing(),Component.isFocusable()

isFocused 

booleanisFocused()Returns whether this Window is focused.public boolean isFocused()-
Description copied from class:
WindowReturns 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 

booleanisLocationByPlatform()Returnstrueif 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:
WindowReturnstrueif this Window will appear at the default location for the native windowing system the next time this Window is made visible. This method always returnsfalseif 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 

booleanisModal()Indicates whether the dialog is modal.public boolean isModal()-
Description copied from class:
DialogIndicates whether the dialog is modal.This method is obsolete and is kept for backwards compatiblity only. Use
getModalityType()instead.- Returns:
trueif this dialog window is modal;falseotherwise- See Also:
Dialog.DEFAULT_MODALITY_TYPE,Dialog.ModalityType.MODELESS,Dialog.setModal(boolean),Dialog.getModalityType(),Dialog.setModalityType(java.awt.Dialog.ModalityType)

isMultipleMode 

booleanisMultipleMode()Returns whether the file dialog allows the multiple file selection.public boolean isMultipleMode()-
Returns whether the file dialog allows the multiple file selection.
- Returns:
trueif the file dialog allows the multiple file selection;falseotherwise.- Since:
- 1.7
- See Also:
setMultipleMode(boolean)

isResizable 

booleanisResizable()Indicates whether this dialog is resizable by the user.public boolean isResizable()-
Description copied from class:
DialogIndicates whether this dialog is resizable by the user. By default, all dialogs are initially resizable.- Returns:
trueif the user can resize the dialog;falseotherwise.- See Also:
Dialog.setResizable(boolean)

isUndecorated 

booleanisUndecorated()Indicates whether this dialog is undecorated.public boolean isUndecorated()-
Description copied from class:
DialogIndicates whether this dialog is undecorated. By default, all dialogs are initially decorated.- Returns:
trueif dialog is undecorated;falseotherwise.- Since:
- 1.4
- See Also:
Dialog.setUndecorated(boolean)

pack 

voidpack()Causes this Window to be sized to fit the preferred size and layouts of its subcomponents.public void pack()-
Description copied from class:
WindowCauses 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 thesetMinimumSizemethod.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.StringparamString()Returns a string representing the state of thisFileDialogwindow.protected java.lang.String paramString()-
Returns a string representing the state of this
FileDialogwindow. 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 benull.- Overrides:
paramStringin classDialog- Returns:
- the parameter string of this file dialog window

processWindowEvent 

protected voidprocessWindowEvent(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:
WindowProcesses 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
nullthe 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 voidprocessWindowFocusEvent(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:
WindowProcesses 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
nullthe 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 voidprocessWindowStateEvent(WindowEvent e)Processes window state event occuring on this window by dispatching them to any registeredWindowStateListenerobjects.protected void processWindowStateEvent(WindowEvent e)-
Description copied from class:
WindowProcesses window state event occuring on this window by dispatching them to any registeredWindowStateListenerobjects. 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
WindowStateListeneris registered viaaddWindowStateListener - window state events are enabled via
enableEvents
Note that if the event parameter is
nullthe 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 

voidremove(MenuComponent popup)Removes the specified popup menu from the component.public void remove(MenuComponent popup)-
Description copied from class:
ComponentRemoves the specified popup menu from the component.- Specified by:
removein interfaceMenuContainer- Parameters:
popup- the popup menu to be removed- Since:
- JDK1.1
- See Also:
Component.add(PopupMenu)

removeNotify 

voidremoveNotify()Makes this Container undisplayable by removing its connection to its native screen resource.public void removeNotify()-
Description copied from class:
WindowMakes 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:
removeNotifyin classContainer- See Also:
Component.isDisplayable(),Container.addNotify()

removeWindowFocusListener 

voidremoveWindowFocusListener(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:
WindowRemoves 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 

voidremoveWindowListener(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:
WindowRemoves 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 

voidremoveWindowStateListener(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:
WindowRemoves the specified window state listener so that it no longer receives window events from this window. Iflisnull, 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 

voidsetAlwaysOnTop(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:
WindowSets 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 totruebut 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
falsethe 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 offalseon 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 

voidsetAutoRequestFocus(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:
WindowSets 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()

setDirectory 

voidsetDirectory(java.lang.String dir)Sets the directory of this file dialog window to be the specified directory.public void setDirectory(java.lang.String dir)-
Sets the directory of this file dialog window to be the specified directory. Specifying a
nullor an invalid directory implies an implementation-defined default. This default will not be realized, however, until the user has selected a file. Until this point,getDirectory()will return the value passed into this method.Specifying "" as the directory is exactly equivalent to specifying
nullas the directory.- Parameters:
dir- the specified directory- See Also:
getDirectory()

setDropTarget 

voidsetDropTarget(java.awt.dnd.DropTarget dt)Associate aDropTargetwith this component.public void setDropTarget(java.awt.dnd.DropTarget dt)-
Description copied from class:
ComponentAssociate aDropTargetwith this component. TheComponentwill receive drops only if it is enabled.- Parameters:
dt- The DropTarget- See Also:
Component.isEnabled()

setFile 

voidsetFile(java.lang.String file)Sets the selected file for this file dialog window to be the specified file.public void setFile(java.lang.String file)-
Sets the selected file for this file dialog window to be the specified file. This file becomes the default file if it is set before the file dialog window is first shown.
Specifying "" as the file is exactly equivalent to specifying
nullas the file.- Parameters:
file- the file being set- See Also:
getFile(),getFiles()

setFilenameFilter 

voidsetFilenameFilter(java.io.FilenameFilter filter)Sets the filename filter for this file dialog window to the specified filter.public void setFilenameFilter(java.io.FilenameFilter filter)-
Sets the filename filter for this file dialog window to the specified filter. Filename filters do not function in Sun's reference implementation for Microsoft Windows.
- Parameters:
filter- the specified filter- See Also:
FilenameFilter,getFilenameFilter()

setFocusableWindowState 

voidsetFocusableWindowState(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:
WindowSets 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, thenisFocusableWindowwill returnfalse. If this Window's focusable Window state is set totrue, thenisFocusableWindowmay returntrueorfalsedepending upon the other requirements which must be met in order for a Window to be focusable.Setting a Window's focusability state to
falseis 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 visibleWindowcan have a delayed effect on some platforms the actual change may happen only when theWindowbecomes hidden and then visible again. To ensure consistent behavior across platforms, set theWindow's focusable state when theWindowis 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 

voidsetIconImage(Image image)Sets the image to be displayed as the icon for this window.public void setIconImage(Image image)-
Description copied from class:
WindowSets 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 

voidsetIconImages(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:
WindowSets the sequence of images to be displayed as the icon for this window. Subsequent calls togetIconImageswill always return a copy of theiconslist.Depending on the platform capabilities one or several images of different dimensions will be used as the window's icon.
The
iconslist 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
nullor 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 

voidsetLocationByPlatform(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:
WindowSets 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,setLocationandsetBoundsafter callingsetLocationByPlatformclear 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();
flagwill befalse.In the following sample:
The window will be shown at (10, 10) andsetLocationByPlatform(true); setLocation(10, 10); boolean flag = isLocationByPlatform(); setVisible(true);
flagwill befalse.- Parameters:
locationByPlatform-trueif this Window should appear at the default location,falseif at the current location- Throws:
- if the window is showing on screen and locationByPlatform isIllegalComponentStateExceptiontrue.- Since:
- 1.5
- See Also:
Window.setLocation(int, int),Window.isShowing(),Window.setVisible(boolean),Window.isLocationByPlatform(),System.getProperty(String)

setLocationRelativeTo 

voidsetLocationRelativeTo(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:
WindowSets 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 theGraphicsConfigurationassociated with this component isnull, the window is placed in the center of the screen. The center point can be obtained with theGraphicsEnvironment.getCenterPointmethod. - 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 theGraphicsConfigurationassociated with this component. - If the component is not
nulland 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
GraphicsConfigurationis 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
Componentthat 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
Windowobject 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 

voidsetModal(boolean modal)Specifies whether this dialog should be modal.public void setModal(boolean modal)-
Description copied from class:
DialogSpecifies 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:
Dialog.DEFAULT_MODALITY_TYPE,Dialog.ModalityType.MODELESS,Dialog.isModal(),Dialog.getModalityType(),Dialog.setModalityType(java.awt.Dialog.ModalityType)

setModalExclusionType 

voidsetModalExclusionType(Dialog.ModalExclusionType exclusionType)Specifies the modal exclusion type for this window.public void setModalExclusionType(Dialog.ModalExclusionType exclusionType)-
Description copied from class:
WindowSpecifies the modal exclusion type for this window. If a window is modal excluded, it is not blocked by some modal dialogs. SeeDialog.ModalExclusionTypefor possible modal exclusion types.If the given type is not supported,
NO_EXCLUDEis 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; anullvalue 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 

voidsetModalityType(Dialog.ModalityType type)Sets the modality type for this dialog.public void setModalityType(Dialog.ModalityType type)-
Description copied from class:
DialogSets the modality type for this dialog. SeeModalityTypefor possible modality types.If the given modality type is not supported,
MODELESSis 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.nullvalue 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:
Dialog.getModalityType(),Toolkit.isModalityTypeSupported(java.awt.Dialog.ModalityType)

setMode 

voidsetMode(int mode)Sets the mode of the file dialog.public void setMode(int mode)-
Sets the mode of the file dialog. If
modeis not a legal value, an exception will be thrown andmodewill not be set.

setMultipleMode 

voidsetMultipleMode(boolean enable)Enables or disables multiple file selection for the file dialog.public void setMultipleMode(boolean enable)-
Enables or disables multiple file selection for the file dialog.
- Parameters:
enable- iftrue, multiple file selection is enabled;false- disabled.- Since:
- 1.7
- See Also:
isMultipleMode()

setOpacity 

voidsetOpacity(float opacity)Sets the opacity of the window.public void setOpacity(float opacity)-
Description copied from class:
DialogSets 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
TRANSLUCENTtranslucency must be supported by the underlying system - The window must be undecorated (see
Frame.setUndecorated(boolean)andDialog.setUndecorated(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 theIllegalComponentStateExceptionwill 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:
setOpacityin classWindow- Parameters:
opacity- the opacity level to set to the window- See Also:
Window.getOpacity(),Window.setBackground(Color),Window.setShape(Shape),Frame.isUndecorated(),Dialog.isUndecorated(),GraphicsDevice.WindowTranslucency,GraphicsDevice.isWindowTranslucencySupported(GraphicsDevice.WindowTranslucency)
- The

setResizable 

voidsetResizable(boolean resizable)Sets whether this dialog is resizable by the user.public void setResizable(boolean resizable)-
Description copied from class:
DialogSets whether this dialog is resizable by the user.- Parameters:
resizable-trueif the user can resize this dialog;falseotherwise.- See Also:
Dialog.isResizable()

setShape 

voidsetShape(Shape shape)Sets the shape of the window.public void setShape(Shape shape)-
Description copied from class:
DialogSets the shape of the window.Setting a shape cuts off some parts of the window. Only the parts that belong to the given
Shaperemain 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_TRANSPARENTtranslucency must be supported by the underlying system - The window must be undecorated (see
Frame.setUndecorated(boolean)andDialog.setUndecorated(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 theUnsupportedOperationExceptionorIllegalComponentStateExceptionwill 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.WindowTranslucencyfor more details.- Overrides:
setShapein classWindow- Parameters:
shape- the shape to set to the window- See Also:
Window.getShape(),Window.setBackground(Color),Window.setOpacity(float),Frame.isUndecorated(),Dialog.isUndecorated(),GraphicsDevice.WindowTranslucency,GraphicsDevice.isWindowTranslucencySupported(GraphicsDevice.WindowTranslucency)
- The

setTitle 

voidsetTitle(java.lang.String title)Sets the title of the Dialog.public void setTitle(java.lang.String title)-
Description copied from class:
DialogSets 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:
Dialog.getTitle()

setType 

voidsetType(Window.Type type)Sets the type of the window.public void setType(Window.Type type)-
Description copied from class:
WindowSets 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 

voidsetUndecorated(boolean undecorated)Disables or enables decorations for this dialog.public void setUndecorated(boolean undecorated)-
Description copied from class:
DialogDisables 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
IllegalComponentStateExceptionwill be thrown. Refer toWindow.setShape(java.awt.Shape),Window.setOpacity(float)andWindow.setBackground(java.awt.Color)for details- Parameters:
undecorated-trueif no dialog decorations are to be enabled;falseif dialog decorations are to be enabled- Throws:
IllegalComponentStateException- if the dialog is displayableIllegalComponentStateException- ifundecoratedisfalse, and this dialog does not have the default shapeIllegalComponentStateException- ifundecoratedisfalse, and this dialog opacity is less than1.0fIllegalComponentStateException- ifundecoratedisfalse, and the alpha value of this dialog background color is less than1.0f- Since:
- 1.4
- See Also:
Dialog.isUndecorated(),Component.isDisplayable(),Window.getShape(),Window.getOpacity(),Window.getBackground()

toBack 

voidtoBack()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()-
Description copied from class:
DialogIf 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:
toBackin classWindow- See Also:
Window.toBack()

toFront 

voidtoFront()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:
WindowIf 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
autoRequestFocusis of thetruevalue. - 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.StringtoString()Returns a string representation of this component and its values.public java.lang.String toString()-
Description copied from class:
ComponentReturns a string representation of this component and its values.- Overrides:
toStringin classjava.lang.Object- Returns:
- a string representation of this component
- Since:
- JDK1.0
-
-
-
