Generated by
JDiff

java.awt Documentation Differences

This file contains all the changes in documentation in the package java.awt as colored differences. Deletions are shown like this, and additions are shown like this.
If no deletions or additions are shown in an entry, the HTML tags will be what has changed. The new HTML tags are shown in the differences. If no documentation existed, and then some was added in a later version, this change is noted in the appropriate class pages of differences, but the change is not shown on this page. Only changes in existing text are shown here. Similarly, documentation which was inherited from another class or interface is not shown here.
Note that an HTML error in the new documentation may cause the display of other documentation changes to be presented incorrectly. For instance, failure to close a <code> tag will cause all subsequent paragraphs to be displayed differently.

Class AWTError

Thrown when a serious Abstract Window Toolkit error has occurred. @version 1.12 0213 12/0203/0001 @author Arthur van Hoff

Class AWTEvent

The root event class for all AWT events. This class and its subclasses supercede the original java.awt.Event class. Subclasses of this root AWTEvent class defined outside of the java.awt.event package should define event ID values greater than the value defined by RESERVED_ID_MAX.

The event masks defined in this class are needed by Component subclasses which are using Component.enableEvents() to select for event types not selected by registered listeners. If a listener is registered on a component the appropriate event mask is already set internally by the component.

The masks are also used to specify to which types of events an AWTEventListener should listen. The masks are bitwise-ORed together and passed to Toolkit.addAWTEventListener. @see Component#enableEvents @see Toolkit#addAWTEventListener @see java.awt.event.ActionEvent @see java.awt.event.AdjustmentEvent @see java.awt.event.ComponentEvent @see java.awt.event.ContainerEvent @see java.awt.event.FocusEvent @see java.awt.event.InputMethodEvent @see java.awt.event.InvocationEvent @see java.awt.event.ItemEvent @see java.awt.event.HierarchyEvent @see java.awt.event.KeyEvent @see java.awt.event.MouseEvent @see java.awt.event.MouseWheelEvent @see java.awt.event.PaintEvent @see java.awt.event.TextEvent @see java.awt.event.WindowEvent @author Carl Quinn @author Amy Fowler @version 1.38 0248 12/1103/0001 @since 1.1

Class AWTEvent, String paramString()

Returns a string representing the state of this eventEvent. This method is intended to be used only for debugging purposes and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null. @return a string representation of this event.

Class AWTEventMulticaster

A class which implements efficient and thread-safe multi-cast event dispatching for the AWT events defined in the java.awt.event package. This class will manage an immutable structure consisting of a chain of event listeners and will dispatch events to those listeners. Because the structure is immutable it is safe to use this API to add/remove listeners during the process of an event dispatch operation. An example of how this class could be used to implement a new component which fires "action" events:
 public myComponent extends Component { ActionListener actionListener = null; public synchronized void addActionListener(ActionListener l) { actionListener = AWTEventMulticaster.add(actionListener l); } public synchronized void removeActionListener(ActionListener l) { actionListener = AWTEventMulticaster.remove(actionListener l); } public void processEvent(AWTEvent e) { // when event occurs which causes "action" semantic if (actionListener = null) { actionListener.actionPerformed(new ActionEvent()); } } 
@author John Rose @author Amy Fowler @version 1.25 0231 12/0203/0001 @since 1.1

Class AWTException

Signals that an Absract Window Toolkit exception has occurred. @version 1.13 0214 12/0203/0001 @author Arthur van Hoff

Class AWTPermission

This class is for AWT permissions. An AWTPermission contains a target name but no actions list; you either have the named permission or you don't.

The target name is the name of the AWT permission (see below). The naming convention follows the hierarchical property naming convention. Also an asterisk could be used to represent all AWT permissions.

The following table lists all the possible AWTPermission target names and for each provides a description of what the permission allows and a discussion of the risks of granting code the permission.

Permission Target Name What the Permission Allows Risks of Allowing this Permission
accessClipboard Posting and retrieval of information to and from the AWT clipboard This would allow malfeasant code to share potentially sensitive or confidential information.
accessEventQueue Access to the AWT event queue After retrieving the AWT event queue malicious code may peek at and even remove existing events from its event queue as well as post bogus events which may purposefully cause the application or applet to misbehave in an insecure manner.
listenToAllAWTEvents Listen to all AWT events system-wide After adding an AWT event listener malicious code may scan all AWT events dispatched in the system allowing it to read all user input (such as passwords). Each AWT event listener is called from within the context of that event queue's EventDispatchThread so if the accessEventQueue permission is also enabled malicious code could modify the contents of AWT event queues system-wide causing the application or applet to misbehave in an insecure manner.
showWindowWithoutWarningBanner Display of a window without also displaying a banner warning that the window was created by an applet Without this warning an applet may pop up windows without the user knowing that they belong to an applet. Since users may make security-sensitive decisions based on whether or not the window belongs to an applet (entering a username and password into a dialog box for example) disabling this warning banner may allow applets to trick the user into entering such information.
readDisplayPixels Readback of pixels from the display screen Interfaces such as the java.awt.Composite interface or the java.awt.Robot class allow arbitrary code to examine pixels on the display enable malicious code to snoop on the activities of the user.
createRobot Create java.awt.Robot objects The java.awt.Robot object allows code to generate native-level mouse and keyboard events as well as read the screen. It could allow malicious code to control the system run other programs read the display and deny mouse and keyboard access to the user.
fullScreenExclusive Enter full-screen exclusive mode Entering full-screen exclusive mode allows direct access to low-level graphics card memory. This could be used to spoof the system since the program is in direct control of rendering.
@see java.security.BasicPermission @see java.security.Permission @see java.security.Permissions @see java.security.PermissionCollection @see java.lang.SecurityManager @version 1.18 0221 12/0203/0001 @author Marianne Mueller @author Roland Schemers

Class AWTPermission, constructor AWTPermission(String)

Creates a new AWTPermission with the specified name. The name is the symbolic name of the AWTPermission such as "topLevelWindow" "systemClipboard" etc. An asterisk may be used to indicate all AWT permissions. @param name the name of the AWTPermission.
Class AWTPermission, constructor AWTPermission(String, String)

Creates a new AWTPermission object with the specified name. The name is the symbolic name of the AWTPermission and the actions Stringstring is currently unused and should be null. This constructor exists for use by the Policy object to instantiate new Permissionpermission objects. @param name the name of the AWTPermission. @param actions should be null.

Class ActiveEvent

An interface for events that know how dispatch themselves. By implementing this interface an event can be placed upon the event queue and its dispatch() method will be called when the event is dispatched using the EventDispatchThread.

This is a very useful mechanism for avoiding deadlocks. If a thread is executing in a critical section (i.e. it has entered one or more monitors) calling other synchronized code may cause deadlocks. To avoid the potential deadlocks an ActiveEvent can be created to run the second section of code at later time. If there is contention on the monitor the second thread will simply block until the first thread has finished its work and exited its monitors.

For security reasons it is often desirable to use an ActiveEvent to avoid calling untrusted code from a critical thread. For instance peer implementations can use this facility to avoid making calls into user code from a system thread. Doing so avoids potential deadlocks and denial-of-service attacks. @author Timothy Prinzing @version 1.9 0210 12/0203/0001 @since 1.2


Class Adjustable

The interface for objects which have an adjustable numeric value contained within a bounded range of values. @version 1.10 0214 12/0203/0001 @author Amy Fowler @author Tim Prinzing
Class Adjustable, void addAdjustmentListener(AdjustmentListener)

AddAdds a listener to recievereceive adjustment events when the value of the adjustable object changes. @param l the listener to recievereceive events @see AdjustmentEvent
Class Adjustable, int getBlockIncrement()

Gets the block value increment for the adjustable object. @return the block value increment for the adjustable object
Class Adjustable, int getMaximum()

Gets the maximum value of the adjustable object. @return the maximum value of the adjustable object
Class Adjustable, int getMinimum()

Gets the minimum value of the adjustable object. @return the minimum value of the adjustable object
Class Adjustable, int getOrientation()

Gets the orientation of the adjustable object. @return the orientation of the adjustable object; either HORIZONTAL VERTICAL or NO_ORIENTATION
Class Adjustable, int getUnitIncrement()

Gets the unit value increment for the adjustable object. @return the unit value increment for the adjustable object
Class Adjustable, int getValue()

Gets the current value of the adjustable object. @return the current value of the adjustable object
Class Adjustable, int getVisibleAmount()

Gets the length of the propertionalproportional indicator. @return the length of the proportional indicator
Class Adjustable, void setVisibleAmount(int)

Sets the length of the proportionlproportional indicator of the adjustable object. @param v the length of the indicator
Class Adjustable, int HORIZONTAL

TheIndicates that the Adjustable has horizontal orientation.
Class Adjustable, int VERTICAL

TheIndicates that the Adjustable has vertical orientation.

Class AlphaComposite

This AlphaComposite class implements the basic alpha compositing rules for combining source and destination pixels to achieve blending and transparency effects with graphics and images. The rules implemented by this class are a subsetthe set of the Porter-Duff rules described in T. Porter and T. Duff "Compositing Digital Images" SIGGRAPH 84 253-259.

If any input does not have an alpha channel an alpha value of 1.0 which is completely opaque is assumed for all pixels. A constant alpha value can also be specified to be multiplied with the alpha value of the source pixels.

The following abbreviations are used in the description of the rules:

The color and alpha components produced by the compositing operation are calculated as follows:

 Cd = Cs*Fs + Cd*Fd Ad = As*Fs + Ad*Fd 
where Fs and Fd are specified by each rule. The above equations assume that both source and destination pixels have the color components premultiplied by the alpha component. Similarly the equations expressed in the definitions of compositing rules below assume premultiplied alpha.

For performance reasons it is preferrable that Rasters passed to the compose method of a CompositeContext object created by the AlphaComposite class have premultiplied data. If either source or destination Rasters are not premultiplied however appropriate conversions are performed before and after the compositing operation.

The alpha resulting from the compositing operation is stored in the destination if the destination has an alpha channel. Otherwise the resulting color is divided by the resulting alpha before being stored in the destination and the alpha is discarded. If the alpha value is 0.0 the color values are set to 0.0. @see Composite @see CompositeContext @version 10 Feb 1997

Class AlphaComposite, AlphaComposite getInstance(int)

Creates an AlphaComposite object with the specified rule. @param rule the compositing rule @throws IllegalArgumentException if rule is not one of the following: #CLEAR #SRC #DST #SRC_OVER #DST_OVER #SRC_IN #DST_IN #SRC_OUT or #DST_OUT #SRC_ATOP #DST_ATOP or #XOR

Class BasicStroke

The BasicStroke class defines a basic set of rendering attributes for the outlines of graphics primitives which are rendered with a Graphics2D object that has its Stroke attribute set to this BasicStroke. The rendering attributes defined by BasicStroke describe the shape of the mark made by a pen drawn along the outline of a Shape and the decorations applied at the ends and joins of path segments of the Shape. These rendering attributes include:
width
The pen width measured perpendicularly to the pen trajectory.
end caps
The decoration applied to the ends of unclosed subpaths and dash segments. Subpaths that start and end on the same point are still considered unclosed if they do not have a CLOSE segment. See SEG_CLOSE for more information on the CLOSE segment. The three different decorations are: #CAP_BUTT #CAP_ROUND and #CAP_SQUARE
line joins
The decoration applied at the intersection of two path segments and at the intersection of the endpoints of a subpath that is closed using SEG_CLOSE The three different decorations are: #JOIN_BEVEL #JOIN_MITER and #JOIN_ROUND
miter limit
The limit to trim a line join that has a JOIN_MITER decoration. A line join is trimmed when the ratio of miter length to stroke width is greater than the miterlimit value. The miter length is the diagonal length of the miter which is the distance between the inside corner and the outside corner of the intersection. The smaller the angle formed by two line segments the longer the miter length and the sharper the angle of intersection. The default miterlimit value of 10.0f causes all angles less than 11 degrees to be trimmed. Trimming miters converts the decoration of the line join to bevel.
dash attributes
The definition of how to make a dash pattern by alternating between opaque and transparent sections.
All attributes that specify measurements and distances controlling the shape of the returned outline are measured in the same coordinate system as the original unstroked Shape argument. When a Graphics2D object uses a Stroke object to redefine a path during the execution of one of its draw methods the geometry is supplied in its original form before the Graphics2D transform attribute is applied. Therefore attributes such as the pen width are interpreted in the user space coordinate system of the Graphics2D object and are subject to the scaling and shearing effects of the user-space-to-device-space transform in that particular Graphics2D. For example the width of a rendered shape's outline is determined not only by the width attribute of this BasicStroke but also by the transform attribute of the Graphics2D object. Consider this code:
// sets the Graphics2D object's Tranform attribute g2d.scale(10 10); // sets the Graphics2D object's Stroke attribute g2d.setStroke(new BasicStroke(1.5f));
Assuming there are no other scaling transforms added to the Graphics2D object the resulting line will be approximately 15 pixels wide. As the example code demonstrates a floating-point line offers better precision especially when large transforms are used with a Graphics2D object. When a line is diagonal the exact width depends on how the rendering pipeline chooses which pixels to fill as it traces the theoretical widened outline. The choice of which pixels to turn on is affected by the antialiasing attribute because the antialiasing rendering pipeline can choose to color partially-covered pixels.

For more information on the user space coordinate system and the rendering process see the Graphics2D class comments. @see Graphics2D @version 1.37 0212/0903/01 @author Jim Graham


Class BorderLayout

A border layout lays out a container arranging and resizing its components to fit in five regions: north south east west and center. Each region may contain no more than one component and is identified by a corresponding constant: NORTH SOUTH EAST WEST and CENTER. When adding a component to a container with a border layout use one of these five constants for example:
 Panel p = new Panel(); p.setLayout(new BorderLayout()); p.add(new Button("Okay") BorderLayout.SOUTH); 
As a convenience BorderLayout interprets the absence of a string specification the same as the constant CENTER:
 Panel p2 = new Panel(); p2.setLayout(new BorderLayout()); p2.add(new TextArea()); // Same as p.add(new TextArea() BorderLayout.CENTER); 

In addition BorderLayout supports fourthe relative positioning constants BEFORE_FIRSTPAGE_LINESTART AFTERPAGE_LAST_LINEEND BEFORE_LINE_BEGINSSTART and AFTER_LINE_ENDSEND. In a container whose ComponentOrientation is set to ComponentOrientation.LEFT_TO_RIGHT these constants map to NORTH SOUTH WEST and EAST respectively.

MixingFor compatibility with previous releases BorderLayout also includes the two typesrelative positioning ofconstants BEFORE_FIRST_LINE AFTER_LAST_LINE BEFORE_LINE_BEGINS and AFTER_LINE_ENDS. These are equivalent to PAGE_START PAGE_END LINE_START and LINE_END respectively. For consistency with the relative positioning constants used by other components the latter constants are preferred.

Mixing both absolute and relative positioning constants can lead to unpredicable results. If you use both types the relative constants will take precedence. For example if you add components using both the NORTH and BEFORE_FIRSTPAGE_LINESTART constants in a container whose orientation is LEFT_TO_RIGHT only the BEFORE_FIRSTPAGE_LINESTART will be layed out.

NOTE: Currently (in the Java 2 platform v1.2) BorderLayout does not support vertical orientations. The isVertical setting on the container's ComponentOrientation is not respected.

The components are laid out according to their preferred sizes and the constraints of the container's size. The NORTH and SOUTH components may be stretched horizontally; the EAST and WEST components may be stretched vertically; the CENTER component may stretch both horizontally and vertically to fill any space left over.

Here is an example of five buttons in an applet laid out using the BorderLayout layout manager:

The code for this applet is as follows:


 import java.awt.*; import java.applet.Applet; public class buttonDir extends Applet { public void init() { setLayout(new BorderLayout()); add(new Button("North") BorderLayout.NORTH); add(new Button("South") BorderLayout.SOUTH); add(new Button("East") BorderLayout.EAST); add(new Button("West") BorderLayout.WEST); add(new Button("Center") BorderLayout.CENTER); } } 

@version 1.45 0249 12/0203/0001 @author Arthur van Hoff @see java.awt.Container#add(String Component) @see java.awt.ComponentOrientation @since JDK1.0

Class BorderLayout, String AFTER_LAST_LINE

The componentSynonym for comes after thePAGE_END. last line of theExists for compatibility with layout'sprevious contentversions. For Western top-to-bottom left-to-rightPAGE_END orientations this is equivalent to SOUTHpreferred. @see java.awt.Component#getComponentOrientationPAGE_END @since 1.2
Class BorderLayout, String AFTER_LINE_ENDS

TheSynonym component goes at the end of the line direction for the layoutLINE_END. For WesternExists top-to-bottomfor left-to-rightcompatibility orientations thiswith previous isversions. equivalentLINE_END to EASTis preferred. @see java.awt.Component#getComponentOrientationLINE_END @since 1.2
Class BorderLayout, String BEFORE_FIRST_LINE

The componentSynonym for comes before thePAGE_START. first line of theExists for compatibility with layout'sprevious contentversions. For Western top-to-bottom left-to-rightPAGE_START orientations this is equivalent to NORTHpreferred. @see java.awt.Component#getComponentOrientationPAGE_START @since 1.2
Class BorderLayout, String BEFORE_LINE_BEGINS

TheSynonym component goes at the beginning of the line direction for the layoutLINE_START. For WesternExists top-to-bottomfor left-to-rightcompatibility orientations thiswith previous isversions. equivalentLINE_START to WESTis preferred. @see java.awt.Component#getComponentOrientationLINE_START @since 1.2

Class Button

This class creates a labeled button. The application can cause some action to happen when the button is pushed. This image depicts three views of a "Quit" button as it appears under the Solaris operating system:

The first view shows the button as it appears normally. The second view shows the button when it has input focus. Its outline is darkened to let the user know that it is an active object. The third view shows the button when the user clicks the mouse over the button and thus requests that an action be performed.

The gesture of clicking on a button with the mouse is associated with one instance of ActionEvent which is sent out when the mouse is both pressed and released over the button. If an application is interested in knowing when the button has been pressed but not released as a separate gesture it can specialize processMouseEvent or it can register itself as a listener for mouse events by calling addMouseListener. Both of these methods are defined by Component the abstract superclass of all components.

When a button is pressed and released AWT sends an instance of ActionEvent to the button by calling processEvent on the button. The button's processEvent method receives all events for the button; it passes an action event along by calling its own processActionEvent method. The latter method passes the action event on to any action listeners that have registered an interest in action events generated by this button.

If an application wants to perform some action based on a button being pressed and released it should implement ActionListener and register the new listener to receive events from this button by calling the button's addActionListener method. The application can make use of the button's action command as a messaging protocol. @version 1.58 0368 12/1403/0001 @author Sami Shaio @see java.awt.event.ActionEvent @see java.awt.event.ActionListener @see java.awt.Component#processMouseEvent @see java.awt.Component#addMouseListener @since JDK1.0

Class Button, constructor Button()

Constructs a Button with no label. @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true @see java.awt.GraphicsEnvironment#isHeadless
Class Button, constructor Button(String)

Constructs a Button with the specified label. @param label A string label for the button. @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true @see java.awt.GraphicsEnvironment#isHeadless
Class Button, void addActionListener(ActionListener)

Adds the specified action listener to receive action events from this button. Action events occur when a user presses or releases the mouse over this button. If l is null no exception is thrown and no action is performed. @param l the action listener @see java.awt.event.ActionListener#removeActionListener @see #getActionListeners @see java.awt.Button#removeActionListenerevent.ActionListener @since JDK1.1
Class Button, AccessibleContext getAccessibleContext()

Gets the AccessibleContext associated with this Button. For buttons the AccessibleContext takes the form of an AccessibleAWTButton. A new AccessibleAWTButton instance is created if necessary. @return an AccessibleAWTButton that serves as the AccessibleContext of this Button @beaninfo expert: true description: The AccessibleContext associated with this Button.
Class Button, EventListener[] getListeners(Class)

ReturnReturns an array of all the listenersobjects that were addedcurrently registered as toFooListeners the Buttonupon this withButton. addXXXListener()FooListeners where XXX isare registered using the nameaddFooListener ofmethod.

You can specify the listenerType argument. For example to get all ofwith a class literal such as theFooListener.class. ActionListener(s)For forexample theyou can query givena Button b onefor its wouldaction writelisteners with the following code:

 ActionListener[] als = (ActionListener[])(b.getListeners(ActionListener.class)) ;
If no such listenerlisteners exist list exists thenthis method returns an empty array is returned. @param listenerType Typethe type of listeners requested; this parameter should specify an interface that descends from java.util.EventListener @return allan array of theall objects registered as FooListeners on this button or an empty array if no such listeners of the specifiedhave been added type@exception supported byClassCastException if thislistenerType
buttondoesn't specify a class or interface that implements java.util.EventListener @see #getActionListeners @since 1.3
Class Button, String paramString()

Returns the parametera string representing the state of this buttonButton. This stringmethod is usefulintended to be used only for debugging purposes and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null. @return the parameter string of this button.
Class Button, void processActionEvent(ActionEvent)

Processes action events occurring on this button by dispatching them to any registered ActionListener objects.

This method is not called unless action events are enabled for this button. Action events are enabled when one of the following occurs:

Note that if the event parameter is null the behavior is unspecified and may result in an exception. @param e the action event. @see java.awt.event.ActionListener @see java.awt.Button#addActionListener @see java.awt.Component#enableEvents @since JDK1.1

Class Button, void processEvent(AWTEvent)

Processes events on this button. If an event is an instance of ActionEvent this method invokes the processActionEvent method. Otherwise it invokes processEvent on the superclass.

Note that if the event parameter is null the behavior is unspecified and may result in an exception. @param e the event. @see java.awt.event.ActionEvent @see java.awt.Button#processActionEvent @since JDK1.1

Class Button, void removeActionListener(ActionListener)

Removes the specified action listener so that it no longer receives action events from this button. Action events occur when a user presses or releases the mouse over this button. If l is null no exception is thrown and no action is performed. @param l the action listener @see java.awt.event.ActionListener#addActionListener @see #getActionListeners @see java.awt.Button#addActionListenerevent.ActionListener @since JDK1.1

Class Canvas

A Canvas component represents a blank rectangular area of the screen onto which the application can draw or from which the application can trap input events from the user.

An application must subclass the Canvas class in order to get useful functionality such as creating a custom component. The paint method must be overridden in order to perform custom graphics on the canvas. @version 1.28 0332 12/1503/0001 @author Sami Shaio @since JDK1.0

Class Canvas, void paint(Graphics)

ThisPaints method is called to repaint this canvas.

Most applications that subclass Canvas should override this method in order to perform some useful operation. The paint method provided by Canvas redraws this(typically canvas'scustom rectangle inpainting of the background colorcanvas). The graphics context's origin (0default  0)operation is the top-leftsimply corner of thisto clear the canvas. ItsApplications clipping region is the area of the contextthat override this method need not call super.paint(g). @param g the graphicsspecified Graphics context. @see java.awt.#update(Graphics) @see Component#paint(Graphics)

Class Canvas, void update(Graphics)

Updates this componentcanvas.

The AWT callsThis themethod updateis methodcalled in response to a call to repaintupdate or paint. You can assume that theThe backgroundcanvas is notfirst cleared. The updatemethod of Component does the following: Clears this component by filling it with the background color. Sets the color of the graphics context to be the foregroundand color of thisthen completely redrawn component.by Callscalling this componentcanvas's paint method to completely redraw this component. Note: The origin of the graphics context itsapplications that override this method should either call super.update(0  0g) coordinate point is the top-left corner of this component. The clipping regionor ofincorporate the graphicsfunctionality context is thedescribed bounding rectangle of this componentabove into their own code. @param g the specified context to use forGraphics updating.context @see java.awt.Component#paint(Graphics) @see java.awt.Component#repaintupdate(Graphics) @since JDK1.0


Class CardLayout

A CardLayout object is a layout manager for a container. It treats each component in the container as a card. Only one card is visible at a time and the container acts as a stack of cards. The first component added to a CardLayout object is the visible component when the container is first displayed.

The ordering of cards is determined by the container's own internal ordering of its component objects. CardLayout defines a set of methods that allow an application to flip through these cards sequentially or to show a specified card. The CardLayouCardLayout#addLayoutComponent method can be used to associate a string identifier with a given card for fast random access. @version 1.30 0635 12/3003/0001 @author Arthur van Hoff @see java.awt.Container @since JDK1.0

Class CardLayout, void removeLayoutComponent(Component)

Removes the specified component from the layout. If the card was visible on top the next card underneath it is shown. @param comp the component to be removed. @see java.awt.Container#remove(java.awt.Component) @see java.awt.Container#removeAll()

Class Checkbox

A check box is a graphical component that can be in either an "on" (true) or "off" (false) state. Clicking on a check box changes its state from "on" to "off " or from "off" to "on."

The following code example creates a set of check boxes in a grid layout:


 setLayout(new GridLayout(3 1)); add(new Checkbox("one" null true)); add(new Checkbox("two")); add(new Checkbox("three")); 

This image depicts the check boxes and grid layout created by this code example:

The button labeled one is in the "on" state and the other two are in the "off" state. In this example which uses the GridLayout class the states of the three check boxes are set independently.

Alternatively several check boxes can be grouped together under the control of a single object using the CheckboxGroup class. In a check box group at most one button can be in the "on" state at any given time. Clicking on a check box to turn it on forces any other check box in the same group that is on into the "off" state. @version 1.59 0372 12/1403/0001 @author Sami Shaio @see java.awt.GridLayout @see java.awt.CheckboxGroup @since JDK1.0

Class Checkbox, constructor Checkbox()

Creates a check box with no label. The state of this check box is set to "off " and it is not part of any check box group. @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true @see java.awt.GraphicsEnvironment#isHeadless
Class Checkbox, constructor Checkbox(String)

Creates a check box with the specified label. The state of this check box is set to "off " and it is not part of any check box group. @param label a string label for this check box or null for no label. @exception HeadlessException if GraphicsEnvironment.isHeadless returns true @see java.awt.GraphicsEnvironment#isHeadless
Class Checkbox, constructor Checkbox(String, CheckboxGroup, boolean)

ConstructsCreates a Checkboxcheck box with the specified label set toin the specified statecheck box group and inset to the specified check box groupstate. @param label a string label for this check box or null for no label. @param group a check box group for this check box or null for no group. @param state the initial state of this check box. @exception HeadlessException if GraphicsEnvironment.isHeadless returns true @see java.awt.GraphicsEnvironment#isHeadless @since JDK1.1
Class Checkbox, constructor Checkbox(String, boolean)

Creates a check box with the specified label and sets the specified state. This check box is not part of any check box group. @param label a string label for this check box or null for no label. @param state the initial state of this check box @exception HeadlessException if GraphicsEnvironment.isHeadless returns true @see java.awt.GraphicsEnvironment#isHeadless
Class Checkbox, constructor Checkbox(String, boolean, CheckboxGroup)

CreatesConstructs a check boxCheckbox with the specified label inset to the specified check box groupstate and set toin the specified statecheck box group. @param label a string label for this check box or null for no label. @param state the initial state of this check box. @param group a check box group for this check box or null for no group. @exception HeadlessException if GraphicsEnvironment.isHeadless returns true @see java.awt.GraphicsEnvironment#isHeadless @since JDK1.1
Class Checkbox, void addItemListener(ItemListener)

Adds the specified item listener to receive item events from this check box. Item events are sent to listeners in response to user input but not in response to calls to setState(). If l is null no exception is thrown and no action is performed. @param l the item listener @see java.awt.event.ItemEvent#removeItemListener @see #getItemListeners @see #setState @see java.awt.event.ItemListenerItemEvent @see java.awt.Checkbox#removeItemListenerevent.ItemListener @since JDK1.1
Class Checkbox, CheckboxGroup getCheckboxGroup()

Determines this check box's group. @return this check box's group or null if the check box is not part of a check box group. @see java.awt.Checkbox#setCheckboxGroup
Class Checkbox, String getLabel()

Gets the label of this check box. @return the label of this check box or null if this check box has no label. @see java.awt.Checkbox#setLabel
Class Checkbox, EventListener[] getListeners(Class)

ReturnReturns an array of all the listenersobjects that were addedcurrently registered as toFooListeners the Checkboxupon this withCheckbox. addXXXListener()FooListeners where XXX isare registered using the nameaddFooListener ofmethod.

You can specify the listenerType argument. For example to get all ofwith a class literal such as theFooListener.class. ItemListener(s)For forexample theyou can query givena Checkbox c onefor its woulditem writelisteners with the following code:

 ItemListener[] ils = (ItemListener[])(c.getListeners(ItemListener.class)) ;
If no such listenerlisteners exist list exists thenthis method returns an empty array is returned. @param listenerType Typethe type of listeners requested; this parameter should specify an interface that descends from java.util.EventListener @return allan array of theall objects registered as FooListeners on this checkbox or an empty array if no such listeners of the specifiedhave been added type@exception supported byClassCastException if thislistenerType
checkboxdoesn't specify a class or interface that implements java.util.EventListener @see #getItemListeners @since 1.3
Class Checkbox, boolean getState()

Determines whether this check box is in the "on" or "off" state. The boolean value true indicates the "on" state and false indicates the "off" state. @return the state of this check box as a boolean value. @see java.awt.Checkbox#setState
Class Checkbox, String paramString()

Returns the parametera string representing the state of this check boxCheckbox. This stringmethod is usefulintended to be used only for debugging purposes and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null. @return the parameter string of this check box.
Class Checkbox, void processEvent(AWTEvent)

Processes events on this check box. If the event is an instance of ItemEvent this method invokes the processItemEvent method. Otherwise it calls its superclass's processEvent method.

Note that if the event parameter is null the behavior is unspecified and may result in an exception. @param e the event. @see java.awt.event.ItemEvent @see java.awt.Checkbox#processItemEvent @since JDK1.1

Class Checkbox, void processItemEvent(ItemEvent)

Processes item events occurring on this check box by dispatching them to any registered ItemListener objects.

This method is not called unless item events are enabled for this component. Item events are enabled when one of the following occurs:

Note that if the event parameter is null the behavior is unspecified and may result in an exception. @param e the item event. @see java.awt.event.ItemEvent @see java.awt.event.ItemListener @see java.awt.Checkbox#addItemListener @see java.awt.Component#enableEvents @since JDK1.1

Class Checkbox, void removeItemListener(ItemListener)

Removes the specified item listener so that the item listener no longer receives item events from this check box. If l is null no exception is thrown and no action is performed. @param l the item listener @see java.awt.event.ItemEvent#addItemListener @see #getItemListeners @see java.awt.event.ItemListenerItemEvent @see java.awt.Checkbox#addItemListenerevent.ItemListener @since JDK1.1
Class Checkbox, void setCheckboxGroup(CheckboxGroup)

Sets this check box's group to be the specified check box group. If this check box is already in a different check box group it is first taken out of that group. @param g the new check box group or null to remove this check box from any check box group. @see java.awt.Checkbox#getCheckboxGroup
Class Checkbox, void setLabel(String)

Sets this check box's label to be the string argument. @param label a string to set as the new label or null for no label. @see java.awt.Checkbox#getLabel
Class Checkbox, void setState(boolean)

Sets the state of this check box to the specified state. The boolean value true indicates the "on" state and false indicates the "off" state.

Note that this method should be primarily used to initialize the state of the checkbox. Programmatically setting the state of the checkbox will not trigger an ItemEvent. The only way to trigger an ItemEvent is by user interaction. @param state the boolean state of the check box. @see java.awt.Checkbox#getState


Class CheckboxGroup

The CheckboxGroup class is used to group together a set of Checkbox buttons.

Exactly one check box button in a CheckboxGroup can be in the "on" state at any given time. Pushing any button sets its state to "on" and forces any other button that is in the "on" state into the "off" state.

The following code example produces a new check box group with three check boxes:


 setLayout(new GridLayout(3 1)); CheckboxGroup cbg = new CheckboxGroup(); add(new Checkbox("one" cbg true)); add(new Checkbox("two" cbg false)); add(new Checkbox("three" cbg false)); 

This image depicts the check box group created by this example:

@version 1.29 0230 12/0203/0001 @author Sami Shaio @see java.awt.Checkbox @since JDK1.0


Class CheckboxMenuItem

This class represents a check box that can be included in a menu. ClickingSelecting on the check box in the menu changes its state from "on" to "off" or from "off" to "on."

The following picture depicts a menu which contains an instance of CheckBoxMenuItem:

The item labeled Check shows a check box menu item in its "off" state.

When a check box menu item is selected AWT sends an item event to the item. Since the event is an instance of ItemEvent the processEvent method examines the event and passes it along to processItemEvent. The latter method redirects the event to any ItemListener objects that have registered an interest in item events generated by this menu item. @version 1.49 0362 12/1403/0001 @author Sami Shaio @see java.awt.event.ItemEvent @see java.awt.event.ItemListener @since JDK1.0

Class CheckboxMenuItem, constructor CheckboxMenuItem()

Create a check box menu item with an empty label. The item's state is initially set to "off." @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true @see java.awt.GraphicsEnvironment#isHeadless @since JDK1.1
Class CheckboxMenuItem, constructor CheckboxMenuItem(String)

Create a check box menu item with the specified label. The item's state is initially set to "off." @param label a string label for the check box menu item or null for an unlabeled menu item. @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true @see java.awt.GraphicsEnvironment#isHeadless
Class CheckboxMenuItem, constructor CheckboxMenuItem(String, boolean)

Create a check box menu item with the specified label and state. @param label a string label for the check box menu item or null for an unlabeled menu item. @param state the initial state of the menu item where true indicates "on" and false indicates "off." @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true @see java.awt.GraphicsEnvironment#isHeadless @since JDK1.1
Class CheckboxMenuItem, void addItemListener(ItemListener)

Adds the specified item listener to receive item events from this check box menu item. Item events are sent in response to user actions but not in response to calls to setState(). If l is null no exception is thrown and no action is performed. @param l the item listener @see java.awt.event.ItemEvent#removeItemListener @see #getItemListeners @see #setState @see java.awt.event.ItemListenerItemEvent @see java.awt.Choice#removeItemListenerevent.ItemListener @since JDK1.1
Class CheckboxMenuItem, EventListener[] getListeners(Class)

ReturnReturns an array of all the listenersobjects that were addedcurrently registered as toFooListeners the CheckboxMenuItemupon this withCheckboxMenuItem. addXXXListener()FooListeners where XXX isare registered using the nameaddFooListener ofmethod.

You can specify the listenerType argument. For example to get all ofwith a class literal such as theFooListener.class. ItemListener(s)For forexample theyou can givenquery a CheckboxMenuItem c onefor its item listeners with wouldthe following writecode:

 ItemListener[] ils = (ItemListener[])(c.getListeners(ItemListener.class)) ;
If no such listenerlisteners exist list exists thenthis method returns an empty array is returned. @param listenerType Typethe type of listeners requested; this parameter should specify an interface that descends from java.util.EventListener @return allan array of theall objects registered as FooListeners on this checkbox menuitem or an empty array if no such listeners of the specifiedhave been added type@exception supported byClassCastException if thislistenerType
checkboxdoesn't menuspecify itema class or interface that implements java.util.EventListener @see #getItemListeners @since 1.3
Class CheckboxMenuItem, boolean getState()

Determines whether the state of this check box menu item is "on" or "off." @return the state of this check box menu item where true indicates "on" and false indicates "off." @see java.awt.CheckboxMenuItem#setState
Class CheckboxMenuItem, String paramString()

Returns the parametera string representing the state of this check box menu itemCheckBoxMenuItem. This stringmethod is usefulintended to be used only for debugging purposes and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null. @return the parameter string of this check box menu item.
Class CheckboxMenuItem, void processEvent(AWTEvent)

Processes events on this check box menu item. If the event is an instance of ItemEvent this method invokes the processItemEvent method. If the event is not an item event it invokes processEvent on the superclass.

Check box menu items currently support only item events.

Note that if the event parameter is null the behavior is unspecified and may result in an exception. @param e the event @see java.awt.event.ItemEvent @see java.awt.CheckboxMenuItem#processItemEvent @since JDK1.1

Class CheckboxMenuItem, void processItemEvent(ItemEvent)

Processes item events occurring on this check box menu item by dispatching them to any registered ItemListener objects.

This method is not called unless item events are enabled for this menu item. Item events are enabled when one of the following occurs:

Note that if the event parameter is null the behavior is unspecified and may result in an exception. @param e the item event. @see java.awt.event.ItemEvent @see java.awt.event.ItemListener @see java.awt.CheckboxMenuItem#addItemListener @see java.awt.MenuItem#enableEvents @since JDK1.1

Class CheckboxMenuItem, void removeItemListener(ItemListener)

Removes the specified item listener so that it no longer receives item events from this check box menu item. If l is null no exception is thrown and no action is performed. @param l the item listener @see java.awt.event.ItemEvent#addItemListener @see #getItemListeners @see java.awt.event.ItemListenerItemEvent @see java.awt.Choice#addItemListenerevent.ItemListener @since JDK1.1
Class CheckboxMenuItem, void setState(boolean)

Sets this check box menu item to the specifed state. The boolean value true indicates "on" while false indicates "off." @param

Note bthat this method should be primarily used to initialize the booleanstate of the check box menu item. Programmatically setting the state of thisthe check box menu item will not trigger an ItemEvent. The only way to trigger an ItemEvent is by user interaction. @param b true if the check box menu item is on otherwise false @see java.awt.CheckboxMenuItem#getState


Class Choice

The Choice class presents a pop-up menu of choices. The current choice is displayed as the title of the menu.

The following code example produces a pop-up menu:


 Choice ColorChooser = new Choice(); ColorChooser.add("Green"); ColorChooser.add("Red"); ColorChooser.add("Blue"); 

After this choice menu has been added to a panel it appears as follows in its normal state:

In the picture "Green" is the current choice. Pushing the mouse button down on the object causes a menu to appear with the current choice highlighted.

Some native platforms do not support arbitrary resizing of Choice components and the behavior of setSize()/getSize() is bound by such limitations. Native GUI Choice components' size are often bound by such attributes as font size and length of items contained within the Choice.

@version 1.64 0378 12/1403/0001 @author Sami Shaio @author Arthur van Hoff @since JDK1.0

Class Choice, constructor Choice()

Creates a new choice menu. The menu initially has no items in it.

By default the first item added to the choice menu becomes the selected item until a different selection is made by the user by calling one of the select methods. @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true @see java.awt.ChoiceGraphicsEnvironment#isHeadless @see #select(int) @see java.awt.Choice#select(java.lang.String)

Class Choice, void add(String)

Adds an item to this Choice menu. @param item the item to be added @exception NullPointerException if the item's value is null. @since JDK1.1
Class Choice, void addItem(String)

Obsolete as of Java 2 platform v1.1. Please use the add method instead.

Adds an item to this Choice menu. @param item the item to be added @exception NullPointerException Ifif the item's value is equal to null.

Class Choice, void addItemListener(ItemListener)

Adds the specified item listener to receive item events from this Choice menu. Item events are sent in response to user input but not in response to calls to select. If l is null no exception is thrown and no action is performed. @param l the item listener. @see java.awt.event.ItemEvent#removeItemListener @see #getItemListeners @see #select @see java.awt.event.ItemListenerItemEvent @see java.awt.Choice#removeItemListenerevent.ItemListener @since JDK1.1
Class Choice, void addNotify()

Creates the Choice's peer. This peer allows us to change the look of the Choice without changing its functionality. @see java.awt.Toolkit#createChoice(java.awt.Choice) @see java.awt.Component#getToolkit()
Class Choice, AccessibleContext getAccessibleContext()

Gets the AccessibleContext associated with this Choice. For Choice components the AccessibleContext takes the form of an AccessibleAWTChoice. A new AccessibleAWTChoice instance is created if necessary. @return an AccessibleAWTChoice that serves as the AccessibleContext of this Choice
Class Choice, String getItem(int)

Gets the string at the specified index in this Choice menu. @param index the index at which to begin. @see java.awt.Choice#getItemCount
Class Choice, int getItemCount()

Returns the number of items in this Choice menu. @seereturn java.awt.the number of items in this Choice menu @see #getItem @since JDK1.1
Class Choice, EventListener[] getListeners(Class)

ReturnReturns an array of all the listenersobjects that were addedcurrently registered as toFooListeners the Choiceupon this withChoice. addXXXListener()FooListeners where XXX isare registered using the nameaddFooListener ofmethod.

You can specify the listenerType argument. For example to get all ofwith a class literal such as theFooListener.class. ItemListener(s)For forexample theyou can query givena Choice c onefor its woulditem writelisteners with the following code:

 ItemListener[] ils = (ItemListener[])(c.getListeners(ItemListener.class)) ;
If no such listenerlisteners exist list exists thenthis method returns an empty array is returned. @param listenerType Typethe type of listeners requested; this parameter should specify an interface that descends from java.util.EventListener @return allan array of theall objects registered as FooListeners on this choice or an empty array if no such listeners of the specifiedhave been added type@exception supported byClassCastException if thislistenerType
choicedoesn't specify a class or interface that implements java.util.EventListener @see #getItemListeners @since 1.3
Class Choice, String getSelectedItem()

Gets a representation of the current choice as a string. @return a string representation of the currently selected item in this choice menu. @see java.awt.Choice#getSelectedIndex
Class Choice, Object[] getSelectedObjects()

Returns an array (length 1) containing the currently selected item. If this choice has no items returns null. @see ItemSelectable
Class Choice, void insert(String, int)

Inserts the item into this choice at the specified position. Existing items at an index greater than or equal to index are shifted up by one to accommodate the new item. If index is greater than or equal to the number of items in this choice item is added to the end of this choice.

If the item is the first one being added to the choice then the item becomes selected. Otherwise if the selected item was one of the items shifted the first item in the choice becomes the selected item. If the selected item was no among those shifted it remains the selected item. @param item the non-null item to be inserted @param index the position at which the item should be inserted @exception IllegalArgumentException if index is less than 0.

Class Choice, String paramString()

Returns the parametera string representing the state of this choiceChoice menu. This stringmethod is usefulintended to be used only for debugging purposes and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null. @return the parameter string of this Choice menu.
Class Choice, void processEvent(AWTEvent)

Processes events on this choice. If the event is an instance of ItemEvent it invokes the processItemEvent method. Otherwise it calls its superclass's processEvent method.

Note that if the event parameter is null the behavior is unspecified and may result in an exception. @param e the event. @see java.awt.event.ItemEvent @see java.awt.Choice#processItemEvent @since JDK1.1

Class Choice, void processItemEvent(ItemEvent)

Processes item events occurring on this Choice menu by dispatching them to any registered ItemListener objects.

This method is not called unless item events are enabled for this component. Item events are enabled when one of the following occurs:

Note that if the event parameter is null the behavior is unspecified and may result in an exception. @param e the item event. @see java.awt.event.ItemEvent @see java.awt.event.ItemListener @see java.awt.Choice#addItemListener @see java.awt.Component#enableEvents @since JDK1.1

Class Choice, void remove(String)

RemoveRemoves the first occurrence of item from the Choice menu. If the item being removed is the currently selected item then the first item in the choice becomes the selected item. Otherwise the currently selected item remains selected (and the selected index is updated accordingly). @param item the item to remove from this Choice menu. @exception IllegalArgumentException if the item doesn't exist in the choice menu. @since JDK1.1
Class Choice, void remove(int)

Removes an item from the choice menu at the specified position. If the item being removed is the currently selected item then the first item in the choice becomes the selected item. Otherwise the currently selected item remains selected (and the selected index is @param position the position of the item. @throws IndexOutOfBoundsException if the specified position is out of bounds @since JDK1.1
Class Choice, void removeAll()

Removes all items from the choice menu. @see java.awt.Choice#remove @since JDK1.1
Class Choice, void removeItemListener(ItemListener)

Removes the specified item listener so that it no longer receives item events from this Choice menu. If l is null no exception is thrown and no action is performed. @param l the item listener. @see java.awt.event.ItemEvent#addItemListener @see #getItemListeners @see java.awt.event.ItemListenerItemEvent @see java.awt.Choice#addItemListenerevent.ItemListener @since JDK1.1
Class Choice, void select(String)

Sets the selected item in this Choice menu to be the item whose name is equal to the specified string. If more than one item matches (is equal to) the specified string the one with the smallest index is selected.

Note that this method should be primarily used to initially select an item in this component. Programmatically calling this method will not trigger an ItemEvent. The only way to trigger an ItemEvent is by user interaction. @param str the specified string @see java.awt.Choice#getSelectedItem @see java.awt.Choice#getSelectedIndex

Class Choice, void select(int)

Sets the selected item in this Choice menu to be the item at the specified position.

Note that this method should be primarily used to initially select an item in this component. Programmatically calling this method will not trigger an ItemEvent. The only way to trigger an ItemEvent is by user interaction. @param pos the positon of the selected item. @exception IllegalArgumentException if the specified position is invalid.greater than the number of items or less than zero @see java.awt.Choice#getSelectedItem @see java.awt.Choice#getSelectedIndex


Class Component

A component is an object having a graphical representation that can be displayed on the screen and that can interact with the user. Examples of components are the buttons checkboxes and scrollbars of a typical graphical user interface.

The Component class is the abstract superclass of the nonmenu-related Abstract Window Toolkit components. Class Component can also be extended directly to create a lightweight component. A lightweight component is a component that is not associated with a native opaque window.

Serialization

It is important to note that only AWT listeners which conform to the Serializable protocol will be saved when the object is stored. If an AWT object has listeners that aren't marked serializable they will be dropped at writeObject time. Developers will need as always to consider the implications of making an object serializable. One situation to watch out for is this:
 import java.awt.*; import java.awt.event.*; import java.io.Serializable; class MyApp implements ActionListener Serializable { BigObjectThatShouldNotBeSerializedWithAButton bigOne; Button aButton = new Button(); MyApp() { // Oops now aButton has a listener with a reference // to bigOne aButton.addActionListener(this); } public void actionPerformed(ActionEvent e) { System.out.println("Hello There"); } } 
In this example serializing aButton by itself will cause MyApp and everything it refers to to be serialized as well. The problem is that the listener is serializable by coincidence not by design. To separate the decisions about MyApp and the ActionListener being serializable one can use a nested class as in the following example:
 import java.awt.*; import java.awt.event.*; import java.io.Serializable; class MyApp java.io.Serializable { BigObjectThatShouldNotBeSerializedWithAButton bigOne; Button aButton = new Button(); class MyActionListener implements ActionListener { public void actionPerformed(ActionEvent e) { System.out.println("Hello There"); } } MyApp() { aButton.addActionListener(new MyActionListener()); } } 
@version 1.265 02330 12/2803/0001 @author Arthur van Hoff @author Sami Shaio

Class Component.AccessibleAWTComponent, boolean contains(Point)

Checks whether the specified point is within this object's bounds where the point's x and y coordinates are defined to be relative to the coordinate system of the object. @param p the Point relative to the coordinate system of the object @return true if object contains Point; otherwise false
Class Component.AccessibleAWTComponent, Accessible getAccessibleAt(Point)

Returns the Accessible child if one exists contained at the local coordinate Point. Otherwise returns null. @param p Thethe point defining the top-left corner of the Accessible given in the coordinate space of the object's parent. @return the Accessible if it exists at the specified location; else null
Class Component.AccessibleAWTComponent, Accessible getAccessibleChild(int)

ReturnReturns the nth Accessible child of the object. @param i zero-based index of child @return the nth Accessible child of the object
Class Component.AccessibleAWTComponent, int getAccessibleChildrenCount()

Returns the number of accessible children in the object. If all of the children of this object implement Accessible thanthen this method should return the number of children of this object. @return the number of accessible children in the object.
Class Component.AccessibleAWTComponent, AccessibleComponent getAccessibleComponent()

GetGets the AccessibleComponent associated with this object if one exists. Otherwise return null. @return the component
Class Component.AccessibleAWTComponent, String getAccessibleDescription()

GetGets the accessible description of this object. This should be a concise localized description of what this object is - what is its meaning to the user. If the object has a tooltip the tooltip text may be an appropriate string to return assuming it contains a concise description of the object (instead of just the name of the object - e.g. a "Save" icon on a toolbar that had "save" as the tooltip text shouldn't return the tooltip text as the description but something like "Saves the current text document" instead). @return the localized description of the object -- can be null if this object does not have a description @see javax.accessibility.AccessibleContext#setAccessibleDescription
Class Component.AccessibleAWTComponent, int getAccessibleIndexInParent()

GetGets the index of this object in its accessible parent. @return the index of this object in its parent; or -1 if this object does not have an accessible parent. @see #getAccessibleParent
Class Component.AccessibleAWTComponent, String getAccessibleName()

GetGets the accessible name of this object. This should almost never return java.awt.Component.getName() as that generally isn't a localized name and doesn't have meaning for the user. If the object is fundamentally a text object (e.g. a menu item) the accessible name should be the text of the object (e.g. "save"). If the object has a tooltip the tooltip text may also be an appropriate String to return. @return the localized name of the object -- can be null if this object does not have a name @see javax.accessibility.AccessibleContext#setAccessibleName
Class Component.AccessibleAWTComponent, Accessible getAccessibleParent()

GetGets the Accessible parent of this object. If the parent of this object implements Accessible this method should simply return getParent(). @return the Accessible parent of this object -- can be null if this object does not have an Accessible parent
Class Component.AccessibleAWTComponent, AccessibleRole getAccessibleRole()

GetGets the role of this object. @return an instance of AccessibleRole describing the role of the object @see javax.accessibility.AccessibleRole
Class Component.AccessibleAWTComponent, AccessibleStateSet getAccessibleStateSet()

GetGets the state of this object. @return an instance of AccessibleStateSet containing the current state set of the object @see javax.accessibility.AccessibleState
Class Component.AccessibleAWTComponent, Color getBackground()

GetGets the background color of this object. @return the background color if supported of the object; otherwise null
Class Component.AccessibleAWTComponent, Rectangle getBounds()

Gets the bounds of this object in the form of a Rectangle object. The bounds specify this object's width height and location relative to its parent. @return Aa rectangle indicating this component's bounds; null if this object is not on the screen.
Class Component.AccessibleAWTComponent, Cursor getCursor()

GetGets the Cursor of this object. @return the Cursor if supported of the object; otherwise null
Class Component.AccessibleAWTComponent, Font getFont()

GetGets the Font of this object. @return the Font if supported for the object; otherwise null
Class Component.AccessibleAWTComponent, FontMetrics getFontMetrics(Font)

GetGets the FontMetrics of this object. @param f the Font @return the FontMetrics if supported the object; otherwise null @see #getFont
Class Component.AccessibleAWTComponent, Color getForeground()

GetGets the foreground color of this object. @return the foreground color if supported of the object; otherwise null
Class Component.AccessibleAWTComponent, Locale getLocale()

ReturnReturns the locale of this object. @return the locale of this object
Class Component.AccessibleAWTComponent, Point getLocation()

Gets the location of the object relative to the parent in the form of a point specifying the object's top-left corner in the screen's coordinate space. @return Anan instance of Point representing the top-left corner of the objectsobject's bounds in the coordinate space of the screen; null if this object or its parent are not on the screen
Class Component.AccessibleAWTComponent, Point getLocationOnScreen()

Returns the location of the object on the screen. @return location of object on screen -- can be null if this object is not on the screen
Class Component.AccessibleAWTComponent, Dimension getSize()

Returns the size of this object in the form of a Dimension object. The height field of the Dimension object contains this objects's height and the width field of the Dimension object contains this object's width. @return Aa Dimension object that indicates the size of this component; null if this object is not on the screen
Class Component.AccessibleAWTComponent, boolean isEnabled()

DetermineDetermines if the object is enabled. @return true if object is enabled; otherwise false
Class Component.AccessibleAWTComponent, boolean isShowing()

DetermineDetermines if the object is showing. This is determined by checking the visibility of the object and ancestors of the object. Note: this will return true even if the object is obscured by another (for example it happens to be underneath a menu that was pulled down). @return true if object is showing; otherwise false
Class Component.AccessibleAWTComponent, boolean isVisible()

DetermineDetermines if the object is visible. Note: this means that the object intends to be visible; however it may not in fact be showing on the screen because one of the objects that this object is contained by is not visible. To determine if an object is showing on the screen use isShowing(). @return true if object is visible; otherwise false
Class Component.AccessibleAWTComponent, void setBackground(Color)

SetSets the background color of this object. (For transparency see isOpaque.) @param c the new Color for the background @see Component#isOpaque
Class Component.AccessibleAWTComponent, void setBounds(Rectangle)

Sets the bounds of this object in the form of a Rectangle object. The bounds specify this object's width height and location relative to its parent. @param Aa rectangle indicating this component's bounds
Class Component.AccessibleAWTComponent, void setCursor(Cursor)

SetSets the Cursor of this object. @param c the new Cursor for the object
Class Component.AccessibleAWTComponent, void setEnabled(boolean)

SetSets the enabled state of the object. @param b if true enables this object; otherwise disables it
Class Component.AccessibleAWTComponent, void setFont(Font)

SetSets the Font of this object. @param f the new Font for the object
Class Component.AccessibleAWTComponent, void setForeground(Color)

SetSets the foreground color of this object. @param c the new Color for the foreground
Class Component.AccessibleAWTComponent, void setLocation(Point)

Sets the location of the object relative to the parent. @param p the coordinates of the object
Class Component.AccessibleAWTComponent, void setSize(Dimension)

Resizes this object so that it has width width and height. @param d - Thethe dimension specifying the new size of the object.
Class Component.AccessibleAWTComponent, void setVisible(boolean)

SetSets the visible state of the object. @param b if true shows this object; otherwise hides it

Class Component, void add(PopupMenu)

Adds the specified popup menu to the component. @param popup the popup menu to be added to the component. @see java.awt.Component#remove(java.awt.MenuComponent) @since JDK1.1
Class Component, void addComponentListener(ComponentListener)

Adds the specified component listener to receive component events from this component. If listener l is null no exception is thrown and no action is performed. @param l the component listenerlistene. @see java.awt.event.ComponentEvent @see java.awt.event.ComponentListener @see java.awt.Component#removeComponentListener @see #getComponentListeners @since JDK1.1
Class Component, void addFocusListener(FocusListener)

Adds the specified focus listener to receive focus events from this component when this component gains input focus. If listener l is null no exception is thrown and no action is performed. @param l the focus listener. @see java.awt.event.FocusEvent @see java.awt.event.FocusListener @see java.awt.Component#removeFocusListener @see #getFocusListeners @since JDK1.1
Class Component, void addHierarchyBoundsListener(HierarchyBoundsListener)

Adds the specified hierarchy bounds listener to receive hierarchy bounds events from this component when the hierarchy to which this container belongs changes. If listener l is null no exception is thrown and no action is performed. @param l the hierarchy bounds listener. @see java.awt.event.HierarchyEvent @see java.awt.event.HierarchyBoundsListener @see java.awt.Component#removeHierarchyBoundsListener @see #getHierarchyBoundsListeners @since 1.3
Class Component, void addHierarchyListener(HierarchyListener)

Adds the specified hierarchy listener to receive hierarchy changed events from this component when the hierarchy to which this container belongs changes. If listener l is null no exception is thrown and no action is performed. @param l the hierarchy listener. @see java.awt.event.HierarchyEvent @see java.awt.event.HierarchyListener @see java.awt.Component#removeHierarchyListener @see #getHierarchyListeners @since 1.3
Class Component, void addInputMethodListener(InputMethodListener)

Adds the specified input method listener to receive input method events from this component. A component will only receive input method events from input methods if it also overrides getInputMethodRequests to return an InputMethodRequests instance. If listener l is null no exception is thrown and no action is performed. @param l the input method listener. @see java.awt.event.InputMethodEvent @see java.awt.event.InputMethodListener @see java.awt.Component#removeInputMethodListener @see java.awt.Component#getInputMethodListeners @see #getInputMethodRequests @since 1.2
Class Component, void addKeyListener(KeyListener)

Adds the specified key listener to receive key events from this component. If l is null no exception is thrown and no action is performed. @param l the key listener. @see java.awt.event.KeyEvent @see java.awt.event.KeyListener @see java.awt.Component#removeKeyListener @see #getKeyListeners @since JDK1.1
Class Component, void addMouseListener(MouseListener)

Adds the specified mouse listener to receive mouse events from this component. If listener l is null no exception is thrown and no action is performed. @param l the mouse listener. @see java.awt.event.MouseEvent @see java.awt.event.MouseListener @see java.awt.Component#removeMouseListener @see #getMouseListeners @since JDK1.1
Class Component, void addMouseMotionListener(MouseMotionListener)

Adds the specified mouse motion listener to receive mouse motion events from this component. If listener l is null no exception is thrown and no action is performed. @param l the mouse motion listener. @see java.awt.event.MouseMotionEvent @see java.awt.event.MouseMotionListener @see java.awt.Component#removeMouseMotionListener @see #getMouseMotionListeners @since JDK1.1
Class Component, void addNotify()

Makes this Component displayable by connecting it to a native screen resource. This method is called internally by the toolkit and should not be called directly by programs. @see java.awt.Component#isDisplayable @see java.awt.Component#removeNotify @since JDK1.0
Class Component, void addPropertyChangeListener(PropertyChangeListener)

AddAdds a PropertyChangeListener to the listener list. The listener is registered for all bound properties. A PropertyChangeEvent will getof this class including the firedfollowing: in Note that if this Component is inheriting a bound property then no event will be fired in response to a change in the inherited property.

If listener is null no exception is thrown and no action is performed. @param listener Thethe PropertyChangeListener to be added @see #removePropertyChangeListener @see #getPropertyChangeListeners @see #addPropertyChangeListener(java.lang.String java.beans.PropertyChangeListener)

Class Component, void addPropertyChangeListener(String, PropertyChangeListener)

AddAdds a PropertyChangeListener to the listener list for a specific property. The listenerspecified willproperty may be invokeduser-defined only whenor one aof the callfollowing: on Note that specificif this Component is inheriting a bound property then no event will be fired in response to a change in the inherited property.

If listener is null no exception is thrown and no action is performed. @param propertyName The nameone of the property to listennames listed on.above @param listener Thethe PropertyChangeListener to be added @see #removePropertyChangeListener(java.lang.String) @see #getPropertyChangeListeners(java.lang.String) @see #addPropertyChangeListener(java.beans.PropertyChangeListener)

Class Component, int checkImage(Image, ImageObserver)

Returns the status of the construction of a screen representation of the specified image.

This method does not cause the image to begin loading. An application must use the prepareImage method to force the loading of an image.

Information on the flags returned by this method can be found with the discussion of the ImageObserver interface. @param image the Image object whose status is being checked. @param observer the ImageObserver object to be notified as the image is being prepared. @return the bitwise inclusive OR of ImageObserver flags indicating what information about the image is currently available. @see java.awt.Component#prepareImage(java.awt.Image int int java.awt.image.ImageObserver) @see java.awt.Toolkit#checkImage(java.awt.Image int int java.awt.image.ImageObserver) @see java.awt.image.ImageObserver @since JDK1.0

Class Component, int checkImage(Image, int, int, ImageObserver)

Returns the status of the construction of a screen representation of the specified image.

This method does not cause the image to begin loading. An application must use the prepareImage method to force the loading of an image.

The checkImage method of Component calls its peer's checkImage method to calculate the flags. If this component does not yet have a peer the component's toolkit's checkImage method is called instead.

Information on the flags returned by this method can be found with the discussion of the ImageObserver interface. @param image the Image object whose status is being checked. @param width the width of the scaled version whose status is to be checked. @param height the height of the scaled version whose status is to be checked. @param observer the ImageObserver object to be notified as the image is being prepared. @return the bitwise inclusive OR of ImageObserver flags indicating what information about the image is currently available. @see java.awt.Component#prepareImage(java.awt.Image int int java.awt.image.ImageObserver) @see java.awt.Toolkit#checkImage(java.awt.Image int int java.awt.image.ImageObserver) @see java.awt.image.ImageObserver @since JDK1.0

Class Component, AWTEvent coalesceEvents(AWTEvent, AWTEvent)

Potentially coalesce an event being posted with an existing event. This method is called by EventQueue.postEvent if an event with the same ID as the event to be posted is found in the queue (both events must have this component as their source). This method either returns a coalesced event which replaces the existing event (and the new event is then discarded) or null to indicate that no combining should be done (add the second event to the end of the queue). Either event parameter may be modified and returned as the other one is discarded unless null is returned.

This implementation of coalesceEvents coalesces two event types: mouse move (and drag) events and paint (and update) events. For mouse move events the last event is always returned causing intermediate moves to be discarded. For paint events the new event is coalesced into a complex RepaintArea in the peer. The new EventAWTEvent is always returned. @param existingEvent the event already on the EventQueue. @param newEvent the event being posted to the EventQueue. @return a coalesced event or null indicating that no coalescing was done.

Class Component, boolean contains(Point)

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. @param p the point. @see java.awt.Component#getComponentAt(java.awt.Point) @since JDK1.1
Class Component, boolean contains(int, int)

Checks whether this component "contains" the specified point where x and y are defined to be relative to the coordinate system of this component. @param x the x coordinate of the point. @param y the y coordinate of the point. @see java.awt.Component#getComponentAt(int int) @since JDK1.1
Class Component, Image createImage(ImageProducer)

Creates an image from the specified image producer. @param producer the image producer @return the image produced. @since JDK1.0
Class Component, Image createImage(int, int)

Creates an off-screen drawable image to be used for double buffering. @param width the specified width. @param height the specified height. @return an off-screen drawable image which can be used for double buffering. The return value may be null if the component is not displayable. This will always happen if GraphicsEnvironment.isHeadless() returns true. @see #isDisplayable @see GraphicsEnvironment#isHeadless @since JDK1.0
Class Component, void disableEvents(long)

Disables the events defined by the specified event mask parameter from being delivered to this component. @param eventsToDisable the event mask defining the event types @see java.awt.Component#enableEvents @since JDK1.1
Class Component, void dispatchEvent(AWTEvent)

Dispatches an event to this component or one of its sub components. Calls processEvent() before returning for 1.1-style events which have been enabled for the Component. @param e the event
Class Component, void enableEvents(long)

Enables the events defined by the specified event mask parameter to be delivered to this component.

Event types are automatically enabled when a listener for that event type is added to the component.

This method only needs to be invoked by subclasses of Component which desire to have the specified event types delivered to processEvent regardless of whether or not a listener is registered. @param eventsToEnable the event mask defining the event types. @see java.awt.Component#processEvent @see java.awt.Component#disableEvents @see AWTEvent @since JDK1.1

Class Component, void enableInputMethods(boolean)

Enables or disables input method support for this component. If input method support is enabled and the component also processes key events incoming events are offered to the current input method and will only be processed by the component or dispatched to its listeners if the input method does not consume them. By default input method support is enabled. @param enable true to enable false to disable. @see java.awt.Component#processKeyEvent @since 1.2
Class Component, AccessibleContext getAccessibleContext()

GetGets the AccessibleContext associated with this Component. The method implemented by this base class returns null. Classes that extend Component should implement this method to return the AccessibleContext associated with the subclass. @return the AccessibleContext of this Component
Class Component, Color getBackground()

Gets the background color of this component. @return Thisthis component's background color.; Ifif this component does not have a background color the background color of its parent is returned. @see java.awt.Component#setBackground(java.awt.Color) @since JDK1.0
Class Component, Rectangle getBounds()

Gets the bounds of this component in the form of a Rectangle object. The bounds specify this component's width height and location relative to its parent. @return Aa rectangle indicating this component's bounds. @see #setBounds @see #getLocation @see #getSize
Class Component, Rectangle getBounds(Rectangle)

StoreStores the bounds of this component into "return value" rv and return rv. If rv is null a new Rectangle is allocated. This version of getBounds() is useful if the caller wants to avoid allocating a new Rectangle object on the heap. @param rv the return value modified to the components bounds @return rv
Class Component, ColorModel getColorModel()

Gets the instance of ColorModel used to display the component on the output device. @return Thethe color model used by this component. @see java.awt.image.ColorModel @see java.awt.peer.ComponentPeer#getColorModel() @see java.awt.Toolkit#getColorModel() @since JDK1.0
Class Component, Component getComponentAt(Point)

Returns the component or subcomponent that contains the specified point. @param p the point. @see java.awt.Component#contains @since JDK1.1
Class Component, Component getComponentAt(int, int)

Determines if this component or one of its immediate subcomponents contains the (x  y) location and if so returns the containing component. This method only looks one level deep. If the point (x  y) is inside a subcomponent that itself has subcomponents it does not go looking down the subcomponent tree.

The locate method of Component simply returns the component itself if the (x  y) coordinate location is inside its bounding box and null otherwise. @param x the x coordinate. @param y the y coordinate. @return the component or subcomponent that contains the (x  y) location; null if the location is outside this component. @see java.awt.Component#contains(int int) @since JDK1.0

Class Component, ComponentOrientation getComponentOrientation()

RetrieveRetrieves the language-sensitive orientation that is to be used to order the elements or text within this component. LayoutManager and Component subclasses that wish to respect orientation should call this method to get the component's orientation before performing layout or drawing. @see java.awt.ComponentOrientation @author Laura Werner IBM
Class Component, Cursor getCursor()

Gets the cursor set in the component. If the component does not have a cursor set the cursor of its parent is returned. If no Cursorcursor is set in the entire hierarchy Cursor.DEFAULT_CURSOR is returned. @see #setCursor @since JDK1.1
Class Component, DropTarget getDropTarget()

GetGets the DropTarget associated with this Component.
Class Component, Font getFont()

Gets the font of this component. @return Thisthis component's font.; Ifif a font has not been set for this component the font of its parent is returned. @see #setFont @since JDK1.0
Class Component, FontMetrics getFontMetrics(Font)

Gets the font metrics for the specified font. @param font Thethe font for which font metrics is to be obtained. @return Thethe font metrics for font. @param font the font. @return the font metrics for the specified font. @see java.awt.Component#getFont @see java.awt.Component#getPeer() @see java.awt.peer.ComponentPeer#getFontMetrics(java.awt.Font) @see java.awt.Toolkit#getFontMetrics(java.awt.Font) @since JDK1.0
Class Component, Color getForeground()

Gets the foreground color of this component. @return Thisthis component's foreground color.; Ifif this component does not have a foreground color the foreground color of its parent is returned. @see #setForeground @since JDK1.0 @beaninfo bound: true
Class Component, Graphics getGraphics()

Creates a graphics context for this component. This method will return null if this component is currently not displayable. @return Aa graphics context for this component or null if it has none. @see java.awt.Component#paint @since JDK1.0
Class Component, GraphicsConfiguration getGraphicsConfiguration()

GetGets the GraphicsConfiguration associated with this Component. If the Component has not been assigned a specific GraphicsConfiguration the GraphicsConfiguration of the Component object's top-level container is returned. If the Component has been created but not yet added to a Container this method returns null. @return the GraphicsConfiguration used by this Component or null @since 1.3
Class Component, int getHeight()

ReturnReturns the current height of this component. This method is preferable to writing component.getBounds().height or component.getSize().height because it doesn't cause any heap allocations. @return the current height of this component. @since 1.2
Class Component, InputContext getInputContext()

Gets the input context used by this component for handling the communication with input methods when text is entered in this component. By default the input context used for the parent component is returned. Components may override this to return a private input context. @return Thethe input context used by this component.; Nullnull if no context can be determined. @since 1.2
Class Component, InputMethodRequests getInputMethodRequests()

Gets the input method request handler which supports requests from input methods for this component. A component that supports on-the-spot text input must override this method to return an InputMethodRequests instance. At the same time it also has to handle input method events. @return the input method request handler for this component null by default. @see #addInputMethodListener @since 1.2
Class Component, EventListener[] getListeners(Class)

ReturnReturns an array of all the listenersobjects that were addedcurrently registered as toFooListeners the Componentupon this withComponent. addXXXListener()FooListeners where XXX isare registered using the nameaddFooListener method.

ofYou can specify the listenerType argument. For example to get all ofwith a class literal such as theFooListener.class. For MouseListeners for the givenexample you can query a Component c onefor its mouse listeners with the would writefollowing code:

 MouseListener[] mls = (MouseListener[])(c.getListeners(MouseListener.class)) ;
If no such listenerlisteners exist list exists thenthis method returns an empty array is returned. @param listenerType Typethe type of listeners requested. This; this parameter mustshould be aspecify an interface that descends from java.util.EventListener or subclass. @returnsreturn an array of all listenersobjects added toregistered as thisFooListeners Component using addXXXListeneron this component or an empty array if no such listeners have been added to this Component. @throwsexception ClassCastException if the listenerType parameter isdoesn't notspecify a class or interface that implements java.util.EventListener or@see subclass.#getComponentListeners @see #getFocusListeners @see #getHierarchyListeners @see #getHierarchyBoundsListeners @see #getKeyListeners @see #getMouseListeners @see #getMouseMotionListeners @see #getMouseWheelListeners @see #getInputMethodListeners @see #getPropertyChangeListeners @since 1.3
Class Component, Locale getLocale()

Gets the locale of this component. @return Thisthis component's locale.; Ifif this component does not have a locale the locale of its parent is returned. @see #setLocale @exception IllegalComponentStateException Ifif the Component does not have its own locale and has not yet been added to a containment hierarchy such that the locale can be determined from the containing parent. @since JDK1.1
Class Component, Point getLocation()

Gets the location of this component in the form of a point specifying the component's top-left corner. The location will be relative to the parent's coordinate space.

Due to the asynchronous nature of native event handling this method can return outdated values (for instance after several calls of setLocation() in rapid succession). For this reason the recommended method of obtaining a Componentcomponent's position is within java.awt.event.ComponentListener.componentMoved() which is called after the operating system has finished moving the Componentcomponent.

@return Anan instance of Point representing the top-left corner of the component's bounds in the coordinate space of the component's parent. @see #setLocation @see #getLocationOnScreen @since JDK1.1
Class Component, Point getLocation(Point)

StoreStores the x y origin of this component into "return value" rv and return rv. If rv is null a new Point is allocated. This version of getLocation() is useful if the caller wants to avoid allocating a new Point object on the heap. @param rv the return value modified to the components location @return rv
Class Component, Point getLocationOnScreen()

Gets the location of this component in the form of a point specifying the component's top-left corner in the screen's coordinate space. @return Anan instance of Point representing the top-left corner of the component's bounds in the coordinate space of the screen. @throws IllegalComponentStateException if the component is not showing on the screen @see #setLocation @see #getLocation
Class Component, Dimension getMaximumSize()

Gets the maximum size of this component. @return Aa dimension object indicating this component's maximum size. @see #getMinimumSize @see #getPreferredSize @see LayoutManager
Class Component, Dimension getMinimumSize()

Gets the mininimum size of this component. @return Aa dimension object indicating this component's minimum size. @see #getPreferredSize @see java.awtLayoutManagerLayoutManager
Class Component, String getName()

Gets the name of the component. @return Thisthis component's name. @see #setName @since JDK1.1
Class Component, Container getParent()

Gets the parent of this component. @return Thethe parent container of this component. @since JDK1.0
Class Component, ComponentPeer getPeer()

@deprecated As of JDK version 1.1 programs should not directly manipulate peers.; replaced by boolean isDisplayable().
Class Component, Dimension getPreferredSize()

Gets the preferred size of this component. @return Aa dimension object indicating this component's preferred size. @see #getMinimumSize @see java.awt.LayoutManager
Class Component, Dimension getSize()

Returns the size of this component in the form of a Dimension object. The height field of the Dimension object contains this component's height and the width field of the Dimension object contains this component's width. @return Aa Dimension object that indicates the size of this component. @see #setSize @since JDK1.1
Class Component, Dimension getSize(Dimension)

StoreStores the width/height of this component into "return value" rv and return rv. If rv is null a new Dimension object is allocated. This version of getSize() is useful if the caller wants to avoid allocating a new Dimension object on the heap. @param rv the return value modified to the components size @return rv
Class Component, Toolkit getToolkit()

Gets the toolkit of this component. Note that the frame that contains a component controls which toolkit is used by that component. Therefore if the component is moved from one frame to another the toolkit it uses may change. @return Thethe toolkit of this component. @since JDK1.0
Class Component, Object getTreeLock()

Gets the locking object for AWT component-tree and layout Gets this component's locking object (the object that owns the thread sychronization monitor) for AWT component-tree and layout operations. @return Thisthis component's locking object.
Class Component, int getWidth()

ReturnReturns the current width of this component. This method is preferable to writing component.getBounds().width or component.getSize().width because it doesn't cause any heap allocations. @return the current width of this component. @since 1.2
Class Component, int getX()

ReturnReturns the current x coordinate of the components origin. This method is preferable to writing component.getBounds().x or component.getLocation().x because it doesn't cause any heap allocations. @return the current x coordinate of the components origin. @since 1.2
Class Component, int getY()

ReturnReturns the current y coordinate of the components origin. This method is preferable to writing component.getBounds().y or component.getLocation().y because it doesn't cause any heap allocations. @return the current y coordinate of the components origin. @since 1.2
Class Component, boolean hasFocus()

Returns true if this Component hasis the keyboard focus owner. This method is obsolete and has been replaced by isFocusOwner(). @return true if this Component hasis the keyboard focus. owner; false otherwise @since 1.2
Class Component, boolean imageUpdate(Image, int, int, int, int, int)

Repaints the component when the image has changed. This imageUpdate method of an ImageObserver is called when more information about an image which had been previously requested using an asynchronous routine such as the drawImage method of Graphics becomes available. See the definition of imageUpdate for more information on this method and its arguments.

The imageUpdate method of Component incrementally draws an image on the component as more of the bits of the image are available.

If the system property awt.image.incrementalDraw is missing or has the value true the image is incrementally drawn. If the system property has any other value then the image is not drawn until it has been completely loaded.

Also if incremental drawing is in effect the value of the system property awt.image.redrawrate is interpreted as an integer to give the maximum redraw rate in milliseconds. If the system property is missing or cannot be interpreted as an integer the redraw rate is once every 100ms.

The interpretation of the x y width and height arguments depends on the value of the infoflags argument. @param img the image being observed. @param infoflags see imageUpdate for more information. @param x the x coordinate. @param y the y coordinate. @param w the width. @param h the height. @return false if the infoflags indicate that the image is completely loaded; true otherwise. @see java.awt.image.ImageObserver @see java.awt.Graphics#drawImage(java.awt.Image int int java.awt.Color java.awt.image.ImageObserver) @see java.awt.Graphics#drawImage(java.awt.Image int int java.awt.image.ImageObserver) @see java.awt.Graphics#drawImage(java.awt.Image int int int int java.awt.Color java.awt.image.ImageObserver) @see java.awt.Graphics#drawImage(java.awt.Image int int int int java.awt.image.ImageObserver) @see java.awt.image.ImageObserver#imageUpdate(java.awt.Image int int int int int) @since JDK1.0

Class Component, void invalidate()

Invalidates this component. This component and all parents above it are marked as needing to be laid out. This method can be called often so it needs to execute quickly. @see java.awt.Component#validate @see java.awt.Component#doLayout @see java.awt.LayoutManager @since JDK1.0
Class Component, boolean isDisplayable()

Determines whether this component is displayable. A component is displayable when it is connected to a native screen resource.

A component is made displayable either when it is added to a displayable containment hierarchy or when its containment hierarchy is made displayable. A containment hierarchy is made displayable when its ancestor window is either packed or made visible.

A component is made undisplayable either when it is removed from a displayable containment hierarchy or when its containment hierarchy is made undisplayable. A containment hierarchy is made undisplayable when its ancestor window is disposed. @return true if the component is displayable; false otherwise. @see java.awt.Container#add(java.awt.Component) @see java.awt.Window#pack @see java.awt.Window#show @see java.awt.Container#remove(java.awt.Component) @see java.awt.Window#dispose @since 1.2

Class Component, boolean isEnabled()

Determines whether this component is enabled. An enabled component can respond to user input and generate events. Components are enabled initially by default. A component may be enabled or disabled by calling its setEnabled method. @return true if the component is enabled; false otherwise. @see #setEnabled @since JDK1.0
Class Component, boolean isFocusTraversable()

Returns the value of a flag that indicates whether this component can be traversed using Tab or Shift-Tab keyboard focus traversal. If this method returns "false" this component may still request the keyboard focus using requestFocus()Component but it will not automaticallycan be assignedbecome the focus during tab traversalowner. @return true if this componentComponent is focus-traverablefocusable; false otherwise. @see #setFocusable @since JDK1.1 @deprecated As of 1.4 replaced by isFocusable().
Class Component, boolean isLightweight()

A lightweight component doesn't have a native toolkit peer. Subclasses of Component and Container other than the ones defined in this package like Button or Scrollbar are lightweight. All of the Swing components are lightweights.

This method will always return false if this Componentcomponent is not displayable because it is impossible to determine the weight of an undisplayable Componentcomponent. @return true if this component has a lightweight peer; false if it has a native peer or no peer. @see #isDisplayable @since 1.2

Class Component, boolean isOpaque()

Returns true if this component is completely opaque returns false by default.

An opaque component paints every pixel within its rectangular region. A non-opaque component paints only some of its pixels allowing the pixels underneath it to "show through". A component that does not fully paint its pixels therefore provides a degree of transparency. Only lightweight components can be transparent.

Subclasses that guarantee to always completely paint their contents should override this method and return true. All of the "heavyweight" AWT components are opaque. @return true if this component is completely opaque. @see #isLightweight @since 1.2

Class Component, boolean isShowing()

Determines whether this component is showing on screen. This means that the component must be visible and it must be in a container that is visible and showing. @return true if the component is showing; false otherwise. @see #setVisible @since JDK1.0
Class Component, boolean isValid()

Determines whether this component is valid. A component is valid when it is correctly sized and positioned within its parent container and all its children are also valid. Components are invalidated when they are first shown on the screen. @return true if the component is valid; false otherwise. @see #validate @see #invalidate @since JDK1.0
Class Component, boolean isVisible()

Determines whether this component should be visible when its parent is visible. Components are initially visible with the exception of top level components such as Frame objects. @return true if the component is visible; false otherwise. @see #setVisible @since JDK1.0
Class Component, void list(PrintStream)

Prints a listing of this component to the specified output stream. @param out a print stream. @since JDK1.0
Class Component, void list(PrintStream, int)

Prints out a list starting at the specified indentionindentation to the specified print stream. @param out a print stream. @param indent number of spaces to indent. @see java.io.PrintStream#println(java.lang.Object) @since JDK1.0
Class Component, void list(PrintWriter)

Prints a listing to the specified print writer. @param out Thethe print writer to print to. @since JDK1.1
Class Component, void list(PrintWriter, int)

Prints out a list starting at the specified indentionindentation to the specified print writer. @param out Thethe print writer to print to. @param indent Thethe number of spaces to indent. @see java.io.PrintStream#println(java.lang.Object) @since JDK1.1
Class Component, void paint(Graphics)

Paints this component.

This method is called when the contents of the component should be painted in response to the component first being shown or damage needing repair. The clip rectangle in the Graphics parameter will be set to the area which needs to be painted. Subclasses of Component that override this method need not call super.paint(g).

For performance reasons Components with zero width or height aren't considered to need painting when they are first shown and also aren't considered to need repair. @param g Thethe graphics context to use for painting. @see java.awt.Component#update @since JDK1.0

Class Component, void paintAll(Graphics)

Paints this component and all of its subcomponents.

The origin of the graphics context its (0  0) coordinate point is the top-left corner of this component. The clipping region of the graphics context is the bounding rectangle of this component. @param g the graphics context to use for painting. @see java.awt.Component#paint @since JDK1.0

Class Component, String paramString()

Returns a string representing the state of this component. This method is intended to be used only for debugging purposes and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null. @return a string representation of this component's state. @since JDK1.0
Class Component, boolean prepareImage(Image, ImageObserver)

Prepares an image for rendering on this component. The image data is downloaded asynchronously in another thread and the appropriate screen representation of the image is generated. @param image the Image for which to prepare a screen representation. @param observer the ImageObserver object to be notified as the image is being prepared. @return true if the image has already been fully prepared; false otherwise. @since JDK1.0
Class Component, boolean prepareImage(Image, int, int, ImageObserver)

Prepares an image for rendering on this component at the specified width and height.

The image data is downloaded asynchronously in another thread and an appropriately scaled screen representation of the image is generated. @param image the instance of Image for which to prepare a screen representation. @param width the width of the desired screen representation. @param height the height of the desired screen representation. @param observer the ImageObserver object to be notified as the image is being prepared. @return true if the image has already been fully prepared; false otherwise. @see java.awt.image.ImageObserver @since JDK1.0

Class Component, void print(Graphics)

Prints this component. Applications should override this method for components that must do special processing before being printed or should be printed differently than they are painted.

The default implementation of this method calls the paint method.

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. @param g the graphics context to use for printing. @see java.awt.Component#paint(java.awt.Graphics) @since JDK1.0

Class Component, void printAll(Graphics)

Prints this component and all of its subcomponents.

The origin of the graphics context its (0  0) coordinate point is the top-left corner of this component. The clipping region of the graphics context is the bounding rectangle of this component. @param g the graphics context to use for printing. @see java.awt.Component#print(java.awt.Graphics) @since JDK1.0

Class Component, void processComponentEvent(ComponentEvent)

Processes component events occurring on this component by dispatching them to any registered ComponentListener objects.

This method is not called unless component events are enabled for this component. Component events are enabled when one of the following occurs:

Note that if the event parameter is null the behavior is unspecified and may result in an exception. @param e the component event. @see java.awt.event.ComponentEvent @see java.awt.event.ComponentListener @see java.awt.Component#addComponentListener @see java.awt.Component#enableEvents @since JDK1.1

Class Component, void processEvent(AWTEvent)

Processes events occurring on this component. By default this method calls the appropriate process<event type>Event method for the given class of event.

Note that if the event parameter is null the behavior is unspecified and may result in an exception. @param e the event. @see java.awt.Component#processComponentEvent @see java.awt.Component#processFocusEvent @see java.awt.Component#processKeyEvent @see java.awt.Component#processMouseEvent @see java.awt.Component#processMouseMotionEvent @see java.awt.Component#processInputMethodEvent @see java.awt.Component#processHierarchyEvent @see #processMouseWheelEvent @since JDK1.1

Class Component, void processFocusEvent(FocusEvent)

Processes focus events occurring on this component by dispatching them to any registered FocusListener objects.

This method is not called unless focus events are enabled for this component. Focus events are enabled when one of the following occurs:

Note that if the event parameter is null the behavior is unspecified and may result in an exception. @param e the focus event. @see java.awt.event.FocusEvent @see java.awt.event.FocusListener @see java.awt.Component#addFocusListener @see java.awt.Component#enableEvents @since JDK1.1

Class Component, void processHierarchyBoundsEvent(HierarchyEvent)

Processes hierarchy bounds events occurring on this component by dispatching them to any registered HierarchyBoundsListener objects.

This method is not called unless hierarchy bounds events are enabled for this component. Hierarchy bounds events are enabled when one of the following occurs:

Note that if the event parameter is null the behavior is unspecified and may result in an exception. @param e the hierarchy event @see java.awt.event.HierarchyEvent @see java.awt.event.HierarchyBoundsListener @see java.awt.Component#addHierarchyBoundsListener @see java.awt.Component#enableEvents @since 1.3

Class Component, void processHierarchyEvent(HierarchyEvent)

Processes hierarchy events occurring on this component by dispatching them to any registered HierarchyListener objects.

This method is not called unless hierarchy events are enabled for this component. Hierarchy events are enabled when one of the following occurs:

Note that if the event parameter is null the behavior is unspecified and may result in an exception. @param e the hierarchy event @see java.awt.event.HierarchyEvent @see java.awt.event.HierarchyListener @see java.awt.Component#addHierarchyListener @see java.awt.Component#enableEvents @since 1.3

Class Component, void processInputMethodEvent(InputMethodEvent)

Processes input method events occurring on this component by dispatching them to any registered InputMethodListener objects.

This method is not called unless input method events are enabled for this component. Input method events are enabled when one of the following occurs:

Note that if the event parameter is null the behavior is unspecified and may result in an exception. @param e the input method event @see java.awt.event.InputMethodEvent @see java.awt.event.InputMethodListener @see java.awt.Component#addInputMethodListener @see java.awt.Component#enableEvents @since 1.2

Class Component, void processKeyEvent(KeyEvent)

Processes key events occurring on this component by dispatching them to any registered KeyListener objects.

This method is not called unless key events are enabled for this component. Key events are enabled when one of the following occurs:

Note that this method is not called by the event dispatch thread if the component is not the focus owner of if the component is not showing. This method is called when key events are registered via the addKeyListener or enableEvents methods but as of release 1.4 the implementation of the AWT event dispatching thread redirects KeyEvent to the focus owner. Please see the Focus Specification for further information.

If the event parameter is null the behavior is unspecified and may result in an exception. @param e the key event. @see java.awt.event.KeyEvent @see java.awt.event.KeyListener @see java.awt.Component#addKeyListener @see java.awt.Component#enableEvents @see #isShowing @since JDK1.1

Class Component, void processMouseEvent(MouseEvent)

Processes mouse events occurring on this component by dispatching them to any registered MouseListener objects.

This method is not called unless mouse events are enabled for this component. Mouse events are enabled when one of the following occurs:

Note that if the event parameter is null the behavior is unspecified and may result in an exception. @param e the mouse event. @see java.awt.event.MouseEvent @see java.awt.event.MouseListener @see java.awt.Component#addMouseListener @see java.awt.Component#enableEvents @since JDK1.1

Class Component, void processMouseMotionEvent(MouseEvent)

Processes mouse motion events occurring on this component by dispatching them to any registered MouseMotionListener objects.

This method is not called unless mouse motion events are enabled for this component. Mouse motion events are enabled when one of the following occurs:

Note that if the event parameter is null the behavior is unspecified and may result in an exception. @param e the mouse motion event. @see java.awt.event.MouseMotionEvent @see java.awt.event.MouseMotionListener @see java.awt.Component#addMouseMotionListener @see java.awt.Component#enableEvents @since JDK1.1

Class Component, void remove(MenuComponent)

Removes the specified popup menu from the component. @param popup the popup menu to be removed. @see java.awt.Component#add(java.awt.PopupMenu) @since JDK1.1
Class Component, void removeComponentListener(ComponentListener)

Removes the specified component listener so that it no longer receives component events from this component. This method performs no function nor does it throw an exception if the listener specified by the argument was not previously added to this component. If listener l is null no exception is thrown and no action is performed. @param l the component listener. @see java.awt.event.ComponentEvent @see java.awt.event.ComponentListener @see java.awt.Component#addComponentListener @see #getComponentListeners @since JDK1.1
Class Component, void removeFocusListener(FocusListener)

Removes the specified focus listener so that it no longer receives focus events from this component. This method performs no function nor does it throw an exception if the listener specified by the argument was not previously added to this component. If listener l is null no exception is thrown and no action is performed. @param l the focus listener. @see java.awt.event.FocusEvent @see java.awt.event.FocusListener @see java.awt.Component#addFocusListener @see #getFocusListeners @since JDK1.1
Class Component, void removeHierarchyBoundsListener(HierarchyBoundsListener)

Removes the specified hierarchy bounds listener so that it no longer receives hierarchy bounds events from this component. This method performs no function nor does it throw an exception if the listener specified by the argument was not previously added to this component. If listener l is null no exception is thrown and no action is performed. @param l the hierarchy bounds listener. @see java.awt.event.HierarchyEvent @see java.awt.event.HierarchyBoundsListener @see java.awt.Component#addHierarchyBoundsListener @see #getHierarchyBoundsListeners @since 1.3
Class Component, void removeHierarchyListener(HierarchyListener)

Removes the specified hierarchy listener so that it no longer receives hierarchy changed events from this component. This method performs no function nor does it throw an exception if the listener specified by the argument was not previously added to this component. If listener l is null no exception is thrown and no action is performed. @param l the hierarchy listener. @see java.awt.event.HierarchyEvent @see java.awt.event.HierarchyListener @see java.awt.Component#addHierarchyListener @see #getHierarchyListeners @since 1.3
Class Component, void removeInputMethodListener(InputMethodListener)

Removes the specified input method listener so that it no longer receives input method events from this component. This method performs no function nor does it throw an exception if the listener specified by the argument was not previously added to this component. If listener l is null no exception is thrown and no action is performed. @param l the input method listener. @see java.awt.event.InputMethodEvent @see java.awt.event.InputMethodListener @see java.awt.Component#addInputMethodListener @see #getInputMethodListeners @since 1.2
Class Component, void removeKeyListener(KeyListener)

Removes the specified key listener so that it no longer receives key events from this component. This method performs no function nor does it throw an exception if the listener specified by the argument was not previously added to this component. If listener l is null no exception is thrown and no action is performed. @param l the key listener. @see java.awt.event.KeyEvent @see java.awt.event.KeyListener @see java.awt.Component#addKeyListener @see #getKeyListeners @since JDK1.1
Class Component, void removeMouseListener(MouseListener)

Removes the specified mouse listener so that it no longer receives mouse events from this component. This method performs no function nor does it throw an exception if the listener specified by the argument was not previously added to this component. If listener l is null no exception is thrown and no action is performed. @param l the mouse listener. @see java.awt.event.MouseEvent @see java.awt.event.MouseListener @see java.awt.Component#addMouseListener @see #getMouseListeners @since JDK1.1
Class Component, void removeMouseMotionListener(MouseMotionListener)

Removes the specified mouse motion listener so that it no longer receives mouse motion events from this component. This method performs no function nor does it throw an exception if the listener specified by the argument was not previously added to this component. If listener l is null no exception is thrown and no action is performed. @param l the mouse motion listener. @see java.awt.event.MouseMotionEvent @see java.awt.event.MouseMotionListener @see java.awt.Component#addMouseMotionListener @see #getMouseMotionListeners @since JDK1.1
Class Component, void removeNotify()

Makes this Component undisplayable by destroying it native screen resource. This method is called by the toolkit internally and should not be called directly by programs. @see java.awt.Component#isDisplayable @see java.awt.Component#addNotify @since JDK1.0
Class Component, void removePropertyChangeListener(PropertyChangeListener)

RemoveRemoves a PropertyChangeListener from the listener list. This removesmethod ashould PropertyChangeListenerbe used to remove PropertyChangeListeners that waswere registered for all bound properties of this class.

If listener is null no exception is thrown and no action is performed. @param listener Thethe PropertyChangeListener to be removed @see #addPropertyChangeListener @see #getPropertyChangeListeners @see #removePropertyChangeListener(java.lang.String java.beans.PropertyChangeListener)

Class Component, void removePropertyChangeListener(String, PropertyChangeListener)

RemoveRemoves a PropertyChangeListener from the listener list for a specific property. This method should be used to remove PropertyChangeListeners that were registered for a specific bound property.

If listener is null no exception is thrown and no action is performed. @param propertyName The name ofa thevalid property that was listened on.name @param listener Thethe PropertyChangeListener to be removed @see #addPropertyChangeListener(java.lang.String) @see #getPropertyChangeListeners(java.lang.String) @see #removePropertyChangeListener(java.beans.PropertyChangeListener)

Class Component, void repaint()

Repaints this component.

This method causes a call to this component's update method as soon as possible. @see java.awt.Component#update(java.awt.Graphics) @since JDK1.0

Class Component, void repaint(int, int, int, int)

Repaints the specified rectangle of this component.

This method causes a call to this component's update method as soon as possible. @param x the x coordinate. @param y the y coordinate. @param width the width. @param height the height. @see java.awt.Component#update(java.awt.Graphics) @since JDK1.0

Class Component, void repaint(long)

Repaints the component. This will result in a call to update within tm milliseconds. @param tm maximum time in milliseconds before update @see #paint @see java.awt.Component#update(java.awt.Graphics) @since JDK1.0
Class Component, void repaint(long, int, int, int, int)

Repaints the specified rectangle of this component within tm milliseconds.

This method causes a call to this component's update method. @param tm maximum time in milliseconds before update. @param x the x coordinate. @param y the y coordinate. @param width the width. @param height the height. @see java.awt.Component#update(java.awt.Graphics) @since JDK1.0

Class Component, void setBackground(Color)

Sets the background color of this component.

The background color affects each component differently and the parts of the component that are affected by the background color may differ between operating systems. @param c Thethe color to become this component's color.; Ifif this parameter is null then this component will inherit the background color of its parent. background color. @see #getBackground @since JDK1.0 @beaninfo bound: true

Class Component, void setBounds(Rectangle)

Moves and resizes this component to conform to the new bounding rectangle r. This component's new position is specified by r.x and r.y and its new size is specified by r.width and r.height @param r Thethe new bounding rectangle for this component. @see java.awt.Component#getBounds @see java.awt.Component#setLocation(int int) @see java.awt.Component#setLocation(java.awt.Point) @see java.awt.Component#setSize(int int) @see java.awt.Component#setSize(java.awt.Dimension) @since JDK1.1
Class Component, void setBounds(int, int, int, int)

Moves and resizes this component. The new location of the top-left corner is specified by x and y and the new size is specified by width and height. @param x Thethe new x-coordinate of this component. @param y Thethe new y-coordinate of this component. @param width Thethe new width of this component. @param height Thethe new height of this component. @see java.awt.Component#getBounds @see java.awt.Component#setLocation(int int) @see java.awt.Component#setLocation(java.awt.Point) @see java.awt.Component#setSize(int int) @see java.awt.Component#setSize(java.awt.Dimension) @since JDK1.1
Class Component, void setComponentOrientation(ComponentOrientation)

SetSets the language-sensitive orientation that is to be used to order the elements or text within this component. Language-sensitive LayoutManager and Component subclasses will use this property to determine how to lay out and draw components.

At construction time a component's orientation is set to ComponentOrientation.UNKNOWN indicating that it has not been specified explicitly. The UNKNOWN orientation behaves the same as ComponentOrientation.LEFT_TO_RIGHT.

To set the orientation of a single component use this method. To apply aset ResourceBundle'sthe orientation toof an entire component hierarchy use java.awt.Window.applyResourceBundle.applyComponentOrientation @see java.awt.ComponentOrientation @see java.awt.Window#applyResourceBundle(java.util.ResourceBundle) @author Laura Werner IBM @beaninfo bound: true

Class Component, void setCursor(Cursor)

Sets the cursor image to the specified cursor. This cursor image is displayed when the contains method for this component returns true for the current cursor location and this Component is visible displayable and enabled. Setting the cursor of a Container causes that cursor to be displayed within all of the container's subcomponents except for those that have a non-null cursor. @param cursor One of the constants defined by the Cursor class. If; if this parameter is null then this component will inherit the cursor of its parent. @see #isEnabled @see #isShowing @see java.awt.Component#getCursor @see java.awt.Component#contains @see java.awt.Toolkit#createCustomCursor @see java.awt.Cursor @since JDK1.1
Class Component, void setDropTarget(DropTarget)

Associate a DropTarget with this Componentcomponent. The Component will receive drops only if it is enabled. @see #isEnabled @param dt The DropTarget
Class Component, void setEnabled(boolean)

Enables or disables this component depending on the value of the parameter b. 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. @param b If true this component is enabled; otherwise this component is disabled. @see #isEnabled @see #isLightweight @since JDK1.1

Class Component, void setFont(Font)

Sets the font of this component. @param f Thethe font to become this component's font.; Ifif this parameter is null then this component will inherit the font of its parent. @see #getFont @since JDK1.0 @beaninfo bound: true
Class Component, void setForeground(Color)

Sets the foreground color of this component. @param c Thethe color to become this component's foreground color.; Ifif this parameter is null then this component will inherit the foreground color of its parent. @see #getForeground @since JDK1.0
Class Component, void setLocale(Locale)

Sets the locale of this component. This is a bound property. @param l Thethe locale to become this component's locale. @see #getLocale @since JDK1.1
Class Component, void setLocation(Point)

Moves this component to a new location. The top-left corner of the new location is specified by point p. Point p is given in the parent's coordinate space. @param p Thethe point defining the top-left corner of the new location given in the coordinate space of this component's parent. @see #getLocation @see #setBounds @since JDK1.1
Class Component, void setLocation(int, int)

Moves this component to a new location. The top-left corner of the new location is specified by the x and y parameters in the coordinate space of this component's parent. @param x Thethe x-coordinate of the new location's top-left corner in the parent's coordinate space. @param y Thethe y-coordinate of the new location's top-left corner in the parent's coordinate space. @see #getLocation @see #setBounds @since JDK1.1
Class Component, void setName(String)

Sets the name of the component to the specified string. @param name Thethe string that is to be this component's name. @see #getName @since JDK1.1
Class Component, void setSize(Dimension)

Resizes this component so that it has width d.width and height d.height. @param d Thethe dimension specifying the new size of this component. @see #setSize @see #setBounds @since JDK1.1
Class Component, void setSize(int, int)

Resizes this component so that it has width width and height height. @param width Thethe new width of this component in pixels. @param height Thethe new height of this component in pixels. @see #getSize @see #setBounds @since JDK1.1
Class Component, void setVisible(boolean)

Shows or hides this component depending on the value of parameter b. @param b Ifif true shows this component; otherwise hides this component. @see #isVisible @since JDK1.1
Class Component, String toString()

Returns a string representation of this component and its values. @return a string representation of this component. @since JDK1.0
Class Component, void transferFocus()

Transfers the focus to the next component as though this Component were the focus owner. @see java.awt.Component#requestFocus() @since JDK1.1s1
Class Component, void update(Graphics)

Updates this component.

The AWT calls the update method in response to a call to repaint. The appearance of the component on the screen has not changed since the last call to update or paint. You can assume that the background is not cleared.

The updatemethod of Component doescalls this thecomponent's following:paint method to Clearsredraw this component. byThis method filling it with the backgroundis commonly overridden by subclasses color.which Setsneed the color of the graphics contextto do additional work in response to bea thecall to foregroundrepaint. colorSubclasses of thisComponent component.that Callsoverride this component'smethod paintshould method toeither call completelysuper.update(g) redraw thisor call component.paint directly.

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. @param g the specified context to use for updating. @see java.awt.Component#paint @see java.awt.Component#repaint() @since JDK1.0

Class Component, void validate()

Ensures that this component has a valid layout. This method is primarily intended to operate on instances of Container. @see java.awt.Component#invalidate @see java.awt.Component#doLayout() @see java.awt.LayoutManager @see java.awt.Container#validate @since JDK1.0

Class ComponentOrientation, ComponentOrientation getOrientation(Locale)

ReturnReturns the orientation that is appropriate for the given locale. @param locale used as a key to look up the orientation in an internalspecified resource bundle.locale
Class ComponentOrientation, ComponentOrientation getOrientation(ResourceBundle)

ReturnReturns the orientation appropriate for the given ResourceBundle's localization. Three approaches are tried innin the following order:
  1. Retrieve a ComponentOrientation object from the ResourceBundle using the string "Orientation" as the key.
  2. Use the ResourceBundle.getLocale to determine the bundle's locale then return the orientation for that locale.
  3. Return the default locale's orientation.
@deprecated As of J2SE 1.4 use #getOrientation(java.util.Locale)

Class Container

A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT components.

Components added to a container are tracked in a list. The order of the list will define the components' front-to-back stacking order within the container. If no index is specified when adding a component to a container it will be added to the end of the list (and hence to the bottom of the stacking order). @version 1.181 04222 12/0603/0001 @author Arthur van Hoff @author Sami Shaio @see java.awt.Container#add(java.awt.Component int) @see java.awt.Container#getComponent(int) @see java.awt.LayoutManager @since JDK1.0


Class Container.AccessibleAWTContainer.AccessibleContainerHandler

Fire PropertyChange listener if one is registered when children are added/ or removed.

Class Container.AccessibleAWTContainer, Accessible getAccessibleAt(Point)

Returns the Accessible child if one exists contained at the local coordinate Point. @param p Thethe point defining the top-left corner of the Accessible given in the coordinate space of the object's parent. @return the Accessible if it exists at the specified location; else null
Class Container.AccessibleAWTContainer, Accessible getAccessibleChild(int)

ReturnReturns the nth Accessible child of the object. @param i zero-based index of child @return the nth Accessible child of the object
Class Container.AccessibleAWTContainer, int getAccessibleChildrenCount()

Returns the number of accessible children in the object. If all of the children of this object implement Accessible thanthen this method should return the number of children of this object. @return the number of accessible children in the object.

Class Container, Component add(Component)

AddsAppends the specified component to the end of this container. This is a convenience method for #addImpl @param comp the component to be added. @see #addImpl @return the component argument.
Class Container, void add(Component, Object)

Adds the specified component to the end of this container. Also notifies the layout manager to add the component to this container's layout using the specified constraints object. This is a convenience method for #addImpl @param comp the component to be added @param constraints an object expressing layout contraints for this component @see java.awt.#addImpl @see LayoutManager @since JDK1.1
Class Container, void add(Component, Object, int)

Adds the specified component to this container with the specified constraints at the specified index. Also notifies the layout manager to add the component to the this container's layout using the specified constraints object. This is a convenience method for #addImpl @param comp the component to be added @param constraints an object expressing layout contraints for this @param index the position in the container's list at which to insert the component. -1 means insert at the end. component @see #addImpl @see #remove @see LayoutManager
Class Container, Component add(Component, int)

Adds the specified component to this container at the given position. This is a convenience method for #addImpl @param comp the component to be added. @param index the position at which to insert the component or -1 to insertappend the component atto the end. @return the component comp @see #addImpl @see #remove
Class Container, Component add(String, Component)

Adds the specified component to this container. ItThis is stronglya advised to useconvenience method for the#addImpl

This method is obsolete as of 1.1. Please use the method add(Component Object) in place of this methodinstead.

Class Container, void addContainerListener(ContainerListener)

Adds the specified container listener to receive container events from this container. If l is null no exception is thrown and no action is performed. @param l the container listener @see #removeContainerListener @see #getContainerListeners
Class Container, void addImpl(Component, Object, int)

Adds the specified component to this container at the specified index. This method also notifies the layout manager to add the component to this container's layout using the specified constraints object via the addLayoutComponent method. The constraints are defined by the particular layout manager being used. For example the BorderLayout class defines five constraints: BorderLayout.NORTH BorderLayout.SOUTH BorderLayout.EAST BorderLayout.WEST and BorderLayout.CENTER.

Note that if the component already exists in this container or a child of this container it is removed from that container before being 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)

@param comp the component to be added. @param constraints an object expressing layout contraintsconstraints for this component. @param index the position in the container's list at which to insert the component where -1 means insert atappend to the end. @exception IllegalArgumentException if index is invalid @exception IllegalArgumentException if adding the container's parent to itself @exception IllegalArgumentException if adding a window to a container @see java.awt.Container#add(java.awt.Component) @see java.awt.Container#add(java.awt.Component int) @see java.awt.Container#add(java.awt.Component java.lang.Object) @see java.awt.LayoutManager @see LayoutManager2 @since JDK1.1

Class Container, void doLayout()

Causes this container to lay out its components. Most programs should not call this method directly but should invoke the validate method instead. @see java.awt.LayoutManager#layoutContainer @see #setLayout @see #validate @since JDK1.1
Class Container, Component findComponentAt(Point)

Locates the visible child component that contains the specified point. The top-most child component is returned in the case where there is overlap in the components. If the containing child component is a Container this method will continue searching for the deepest nested child component. Components which are not visible are ignored during the search.

The findComponentAt method is different from getComponentAt in that getComponentAt only searches the Container's immediate children; if the containing component is a Container findComponentAt will search that child to find a nested component. @param p the point. @return 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. @see Component#contains @see #getComponentAt @since 1.2

Class Container, Component findComponentAt(int, int)

Locates the visible child component that contains the specified position. The top-most child component is returned in the case where there is overlap in the components. If the containing child component is a Container this method will continue searching for the deepest nested child component. Components which are not visible are ignored during the search.

The findComponentAt method is different from getComponentAt in that getComponentAt only searches the Container's immediate children; if the containing component is a Container findComponentAt will search that child to find a nested component. @param x the x coordinate @param y the y coordinate @return 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. @see Component#contains @see #getComponentAt @since 1.2

Class Container, Component getComponentAt(Point)

Gets the component that contains the specified point. @param p the point. @return returns the component that contains the point or null if the component does not contain the point. @see java.awt.Component#contains @since JDK1.1
Class Container, int getComponentCount()

Gets the number of components in this panel. @return the number of components in this panel. @see java.awt.Container#getComponent @since JDK1.1
Class Container, Insets getInsets()

Determines the insets of this container which indicate the size of the container's border.

A Frame object for example has a top inset that corresponds to the height of the frame's title bar. @return the insets of this container. @see java.awt.Insets @see java.awt.LayoutManager @since JDK1.1

Class Container, EventListener[] getListeners(Class)

ReturnReturns an array of all the listenersobjects that were addedcurrently registered as toFooListeners the Containerupon this withContainer. addXXXListener()FooListeners where XXX isare registered using the nameaddFooListener ofmethod.

You can specify the listenerType argument. For example to get all ofwith a class literal such as theFooListener.class. ContainerListener(s)For forexample theyou can givenquery a Container c onefor its container listeners with wouldthe following writecode:

 ContainerListener[] cls = (ContainerListener[])(c.getListeners(ContainerListener.class)) ;
If no such listenerlisteners exist list exists thenthis method returns an empty array is returned. @param listenerType Typethe type of listeners requested; this parameter should specify an interface that descends from java.util.EventListener @return allan array of theall objects registered as FooListeners on this container or an empty array if no such listeners of the specifiedhave been added type@exception supported byClassCastException if thislistenerType
containerdoesn't specify a class or interface that implements java.util.EventListener @see #getContainerListeners @since 1.3
Class Container, Dimension getMinimumSize()

Returns the minimum size of this container. @return an instance of Dimension that represents the minimum size of this container. @see java.awt.Container#getPreferredSize @see java.awt.Container#getLayout @see java.awt.LayoutManager#minimumLayoutSize(java.awt.Container) @see java.awt.Component#getMinimumSize @since JDK1.1
Class Container, Dimension getPreferredSize()

Returns the preferred size of this container. @return an instance of Dimension that represents the preferred size of this container. @see java.awt.Container#getMinimumSize @see java.awt.Container#getLayout @see java.awt.LayoutManager#preferredLayoutSize(java.awt.Container) @see java.awt.Component#getPreferredSize
Class Container, void list(PrintStream, int)

Prints a listing of this container to the specified output stream. The listing starts at the specified indentation. @param out a print stream. @param indent the number of spaces to indent. @see java.awt.Component#list(java.io.PrintStream int) @since JDKJDK1.0
Class Container, void paint(Graphics)

Paints the container. This forwards the paint to any lightweight components that are children of this container. If this method is reimplemented super.paint(g) should be called so that lightweight components are properly rendered. If a child component is entirely clipped by the current clipping setting in g paint() will not be forwarded to that child. @param g the specified Graphics window @see java.awt.Component#update(java.awt.Graphics)
Class Container, void paintComponents(Graphics)

Paints each of the components in this container. @param g the graphics context. @see java.awt.Component#paint @see java.awt.Component#paintAll
Class Container, String paramString()

Returns the parametera string representing the state of this containerContainer. This stringmethod is usefulintended to be used only for debugging purposes and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null. @return the parameter string of this container.
Class Container, void print(Graphics)

Prints the container. This forwards the print to any lightweight components that are children of this container. If this method is reimplemented super.print(g) should be called so that lightweight components are properly rendered. If a child component is entirely clipped by the current clipping setting in g print() will not be forwarded to that child. @param g the specified Graphics window @see java.awt.Component#update(java.awt.Graphics)
Class Container, void printComponents(Graphics)

Prints each of the components in this container. @param g the graphics context. @see java.awt.Component#print @see java.awt.Component#printAll
Class Container, void processContainerEvent(ContainerEvent)

Processes container events occurring on this container by dispatching them to any registered ContainerListener objects. NOTE: This method will not be called unless container events are enabled for this component; this happens when one of the following occurs: a) Component#enableEvents

Note that if the event parameter is null the behavior is unspecified and may result in an exception. @param e the container event @see Component#enableEvents

Class Container, void processEvent(AWTEvent)

Processes events on this container. If the event is a ContainerEvent it invokes the processContainerEvent method else it invokes its superclass's processEvent.

Note that if the event parameter is null the behavior is unspecified and may result in an exception. @param e the event

Class Container, void removeContainerListener(ContainerListener)

Removes the specified container listener so it no longer receives container events from this container. If l is null no exception is thrown and no action is performed. @param l the container listener @see #addContainerListener @see #getContainerListeners
Class Container, void update(Graphics)

Updates the container. This forwards the update to any lightweight components that are children of this container. If this method is reimplemented super.update(g) should be called so that lightweight components are properly rendered. If a child component is entirely clipped by the current clipping setting in g update() will not be forwarded to that child. @param g the specified Graphics window @see java.awt.Component#update(java.awt.Graphics)

Class Cursor

A class to encapsulate the bitmap representation of the mouse cursor. @see Component#setCursor @version 1.30 0236 12/0203/0001 @author Amy Fowler
Class Cursor, constructor Cursor(int)

Creates a new cursor object with the specified type. @param type the type of cursor @throws IllegalArgumentException if the specified cursor type is invalid
Class Cursor, Cursor getPredefinedCursor(int)

Returns a cursor object with the specified predefined type. @param type the type of predefined cursor @throws IllegalArgumentException if the specified cursor type is invalid
Class Cursor, Cursor getSystemCustomCursor(String)

@return the system specific custom Cursor named Cursor names are for example: "Invalid.16x16" @exception HeadlessException if GraphicsEnvironment.isHeadless returns true

Class Dialog

A Dialog is a top-level window with a title and a border that is typically used to take some form of input from the user. The size of the dialog includes any area designated for the border. The dimensions of the border area can be obtained using the getInsets method however since these dimensions are platform-dependent a valid insets value cannot be obtained until the dialog is made displayable by either calling pack or show. Since the border area is included in the overall size of the dialog the border effectively obscures a portion of the dialog constraining the area available for rendering and/or displaying subcomponents to the rectangle which has an upper-left corner location of (insets.left insets.top) and has a size of width - (insets.left + insets.right) by height - (insets.top + insets.bottom).

The default layout for a dialog is BorderLayout.

A dialog may have its native decorations (i.e. Frame & Titlebar) turned off with setUndecorated. This can only be done while the dialog is not displayable

A dialog must have either a frame or another dialog defined as its owner when it's constructed. When the owner window of a visible dialog is hidden or minimized the dialog will automatically be hidden from the user. When the owner window is subsequently re-opened thenrestored the dialog is made visible to the user again.

In a multi-screen environment you can create a Dialog on a different screen device than its owner. See java.awt.Frame for more information.

A dialog can be either modeless (the default) or modal. A modal dialog is one which blocks input to all other toplevel windows in the appapplication context except for any windows created with the dialog as their owner.

Dialogs are capable of generating the following window eventsWindowEvents: WindowOpened WindowClosing WindowClosed WindowActivated WindowDeactivated WindowGainedFocus WindowLostFocus. @see WindowEvent @see Window#addWindowListener @version 1.69 0483 12/2103/01 @author Sami Shaio @author Arthur van Hoff @since JDK1.0

Class Dialog, constructor Dialog(Dialog)

Constructs an initially invisible non-modal Dialog with an empty title and the specified owner dialog. @param owner the owner of the dialog @exception java.lang.IllegalArgumentException if owner is null. This exception is always thrown when GraphicsEnvironment.isHeadless() returns true @see java.awt.GraphicsEnvironment#isHeadless @since 1.2
Class Dialog, constructor Dialog(Dialog, String)

Constructs an initially invisible non-modal Dialog with the specified owner dialog and title. @param owner the owner of the dialog @param title the title of the dialog. A null value will be accepted without causing a NullPointerException to be thrown. @exception java.lang.IllegalArgumentException if owner is null. This exception is always thrown when GraphicsEnvironment.isHeadless() returns true @see java.awt.GraphicsEnvironment#isHeadless @since 1.2
Class Dialog, constructor Dialog(Dialog, String, boolean)

Constructs an initially invisible Dialog with the specified owner dialog title and modality. @param owner the owner of the dialog @exception IllegalArgumentException if the owner's GraphicsConfiguration is not from a screen device @param title the title of the dialog. A; a null value will be accepted without causing a NullPointerException to be thrown. @param modal if true dialog blocks input to other app windows when shown @exception java.lang.IllegalArgumentException if owner is null; this exception is always thrown when GraphicsEnvironment.isHeadless returns true @see java.awt.GraphicsEnvironment#isHeadless @since 1.2
Class Dialog, constructor Dialog(Frame)

Constructs an initially invisible non-modal Dialog with an empty title and the specified owner frame. @param owner the owner of the dialog @exception IllegalArgumentException if the owner's GraphicsConfiguration is not from a screen device @exception java.lang.IllegalArgumentException if owner is null; this exception is always thrown when GraphicsEnvironment.isHeadless returns true @see java.awt.GraphicsEnvironment#isHeadless @see Component#setSize @see Component#setVisible
Class Dialog, constructor Dialog(Frame, String)

Constructs an initially invisible non-modal Dialog with the specified owner frame and title. @param owner the owner of the dialog @param title the title of the dialog. A; a null value will be accepted without causing a NullPointerException to be thrown. @exception IllegalArgumentException if the owner's GraphicsConfiguration is not from a screen device @exception java.lang.IllegalArgumentException if owner is null; this exception is always thrown when GraphicsEnvironment.isHeadless returns true @see java.awt.GraphicsEnvironment#isHeadless @see Component#setSize @see Component#setVisible
Class Dialog, constructor Dialog(Frame, String, boolean)

Constructs an initially invisible Dialog with the specified owner frame title and modality. @param owner the owner of the dialog @param title the title of the dialog. A; a null value will be accepted without causing a NullPointerException to be thrown. @param modal if true dialog blocks input to other app windows when shown @exception IllegalArgumentException if the owner's GraphicsConfiguration is not from a screen device @exception java.lang.IllegalArgumentException if owner is null. This exception is always thrown when GraphicsEnvironment.isHeadless returns true @see java.awt.GraphicsEnvironment#isHeadless @see Component#setSize @see Component#setVisible
Class Dialog, constructor Dialog(Frame, boolean)

Constructs an initially invisible Dialog with an empty title the specified owner frame and modality. @param owner the owner of the dialog @param modal if true dialog blocks input to other app windows when shown @exception IllegalArgumentException if the owner's GraphicsConfiguration is not from a screen device @exception java.lang.IllegalArgumentException if owner is null; this exception is always thrown when GraphicsEnvironment.isHeadless returns true @see java.awt.GraphicsEnvironment#isHeadless
Class Dialog, boolean isModal()

Indicates whether the dialog is modal. When a modal Dialog is made visible user input will be blocked to the other windows in the appapplication context except for any windows created with this dialog as their owner. @return true if this dialog window is modal; false otherwise. @see java.awt.Dialog#setModal
Class Dialog, String paramString()

Returns the parametera string representing the state of this dialog window. This stringmethod is usefulintended to be used only for debugging purposes and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null. @return the parameter string of this dialog window.
Class Dialog, void setTitle(String)

Sets the title of the Dialog. @param title the title displayed in the dialog's border; a null value results in an empty title @see #getTitle

Class Dimension

The Dimension class encapsulates the width and height of a component (in integer precision) in a single object. The class is associated with certain properties of components. Several methods defined by the Component class and the LayoutManager interface return a Dimension object.

Normally the values of width and height are non-negative integers. The constructors that allow you to create a dimension do not prevent you from setting a negative value for these properties. If the value of width or height is negative the behavior of some methods defined by other objects is undefined. @version 1.26 0230 12/0203/0001 @author Sami Shaio @author Arthur van Hoff @see java.awt.Component @see java.awt.LayoutManager @since JDK1.0

Class Dimension, constructor Dimension(Dimension)

Creates an instance of Dimension whose width and height are the same as for the specified dimension. @param d the specified dimension for the width and height values.
Class Dimension, constructor Dimension(int, int)

Constructs a Dimension and initializes it to the specified width and specified height. @param width the specified width dimension @param height the specified height dimension
Class Dimension, double getHeight()

Returns the height of this dimension in double precision. @return the height of this dimension in double precision
Class Dimension, Dimension getSize()

Gets the size of this Dimension object. This method is included for completeness to parallel the getSize method defined by Component. @return the size of this dimension a new instance of Dimension with the same width and height. @see java.awt.Dimension#setSize @see java.awt.Component#getSize @since JDK1.1
Class Dimension, double getWidth()

Returns the width of this dimension in double precision. @return the width of this dimension in double precision
Class Dimension, int hashCode()

Returns the hash code for this Dimension. @return a hash code for this Dimension.
Class Dimension, void setSize(Dimension)

SetSets the size of this Dimension object to the specified size. This method is included for completeness to parallel the setSize method defined by Component. @param d the new size for this Dimension object. @see java.awt.Dimension#getSize @see java.awt.Component#setSize @since JDK1.1
Class Dimension, void setSize(double, double)

SetSets the size of this Dimension object to the specified width and height in double precision. Note that if width or height are larger than Integer.MAX_VALUE they will be reset to Integer.MAX_VALUE. @param width the new width for the Dimension object @param height the new height for the Dimension object
Class Dimension, void setSize(int, int)

SetSets the size of this Dimension object to the specified width and height. This method is included for completeness to parallel the setSize method defined by Component. @param width the new width for this Dimension object. @param height the new height for this Dimension object. @see java.awt.Dimension#getSize @see java.awt.Component#setSize @since JDK1.1
Class Dimension, String toString()

Returns a string representation of the values of this Dimension object's height and width fields. This method is intended to be used only for debugging purposes and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null. @return a string representation of this Dimension object.
Class Dimension, int height

The height dimension. Negative; negative values can be used. @serial @see #getSize @see #setSize
Class Dimension, int width

The width dimension. Negative; negative values can be used. @serial @see #getSize @see #setSize

Class Event

NOTE: The Event class is obsolete and is available only for backwards compatilibility. It has been replaced by the AWTEvent class and its subclasses.

Event is a platform-independent class that encapsulates events from the platform's Graphical User Interface in the Java 1.0 event model. In Java 1.1 and later versions the Event class is maintained only for backwards compatibilty. The information in this class description is provided to assist programmers in converting Java 1.0 programs to the new event model.

In the Java 1.0 event model an event contains an Event#id field that indicates what type of event it is and which other Event variables are relevant for the event.

For keyboard events Event#key contains a value indicating which key was activated and Event#modifiers contains the modifiers for that event. For the KEY_PRESS and KEY_RELEASE event ids the value of key is the unicode character code for the key. For KEY_ACTION and KEY_ACTION_RELEASE the value of key is one of the defined action-key identifiers in the Event class (PGUP PGDN F1 F2 etc). @version 1.68 0272 12/0203/0001 @author Sami Shaio @since JDK1.0

Class Event, constructor Event(Object, int, Object)

NOTE: The Event class is obsolete and is available only for backwards compatilibility. It has been replaced by the AWTEvent class and its subclasses.

Creates an instance of Event with the specified target component event type and argument. @param target the target component. @param id the event type. @param arg the specified argument.

Class Event, constructor Event(Object, long, int, int, int, int, int)

NOTE: The Event class is obsolete and is available only for backwards compatilibility. It has been replaced by the AWTEvent class and its subclasses.

Creates an instance of Event with the specified target component time stamp event type x and y coordinates keyboard key state of the modifier keys and an argument set to null. @param target the target component. @param when the time stamp. @param id the event type. @param x the x coordinate. @param y the y coordinate. @param key the key pressed in a keyboard event. @param modifiers the state of the modifier keys.

Class Event, constructor Event(Object, long, int, int, int, int, int, Object)

NOTE: The Event class is obsolete and is available only for backwards compatilibility. It has been replaced by the AWTEvent class and its subclasses.

Creates an instance of Event with the specified target component time stamp event type x and y coordinates keyboard key state of the modifier keys and argument. @param target the target component. @param when the time stamp. @param id the event type. @param x the x coordinate. @param y the y coordinate. @param key the key pressed in a keyboard event. @param modifiers the state of the modifier keys. @param arg the specified argument.

Class Event, boolean controlDown()

NOTE: The Event class is obsolete and is available only for backwards compatilibility. It has been replaced by the AWTEvent class and its subclasses.

Checks if the Control key is down. @return true if the key is down; false otherwise. @see java.awt.Event#modifiers @see java.awt.Event#shiftDown @see java.awt.Event#metaDown

Class Event, boolean metaDown()

NOTE: The Event class is obsolete and is available only for backwards compatilibility. It has been replaced by the AWTEvent class and its subclasses.

Checks if the Meta key is down. @return true if the key is down; false otherwise. @see java.awt.Event#modifiers @see java.awt.Event#shiftDown @see java.awt.Event#controlDown

Class Event, String paramString()

ReturnsNOTE: The Event class is obsolete and is available only for backwards compatilibility. It has been replaced by the parameterAWTEvent class and its subclasses.

Returns a string representing the state of this eventEvent. This stringmethod is usefulintended to be used only for debugging purposes and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null. @return the parameter string of this event.

Class Event, boolean shiftDown()

NOTE: The Event class is obsolete and is available only for backwards compatilibility. It has been replaced by the AWTEvent class and its subclasses.

Checks if the Shift key is down. @return true if the key is down; false otherwise. @see java.awt.Event#modifiers @see java.awt.Event#controlDown @see java.awt.Event#metaDown

Class Event, String toString()

NOTE: The Event class is obsolete and is available only for backwards compatilibility. It has been replaced by the AWTEvent class and its subclasses.

Returns a representation of this event's values as a string. @return a string that represents the event and the values of its member fields. @see java.awt.Event#paramString @since JDK1.1

Class Event, void translate(int, int)

NOTE: The Event class is obsolete and is available only for backwards compatilibility. It has been replaced by the AWTEvent class and its subclasses.

Translates this event so that its x and y coordinates are increased by dx and dy respectively.

This method translates an event relative to the given component. This involves at a minimum translating the coordinates into the local coordinate system of the given component. It may also involve translating a region in the case of an expose event. @param dx the distance to translate the x coordinate. @param dy the distance to translate the y coordinate.

Class Event, Object arg

An arbitrary argument of the event. The value of this field depends on the type of event. arg has been replaced bby event specific property. @serial

Class EventQueue

EventQueue is a platform-independent class that queues events both from the underlying peer classes and from trusted application classes.

It encapsulates asynchronous event dispatch machinery which extracts events from the queue and dispatches them by calling dispatchEvent(AWTEvent) method on this EventQueue with the event to be dispatched as an argument. The particular behavior of this machinery is implementation-dependent. The only requirements are that events which were actually enqueued to this queue (note that events being posted to the EventQueue can be coalesced) are dispatched:

Sequentially.
That is it is not permitted that several events from this queue are dispatched simultaneously.
In the same order as they are enqueued.
That is if AWTEvent A is enqueued to the EventQueue before AWTEvent B then event B will not be dispatched before event A.

Some browsers partition applets in different code bases into separate contexts and establish walls between these contexts. In such a scenario there will be one EventQueue per context. Other browsers place all applets into the same context implying that there will be only a single global EventQueue for all applets. This behavior is implementation-dependent. Consult your browser's documentation for more information. @author Thomas Ball @author Fred Ecks @author David Mendenhall @version 1.71 0282 12/0903/01 @since 1.1

Class EventQueue, void dispatchEvent(AWTEvent)

DispatchDispatches an event. The manner in which the event is dispatched depends upon the type of the event and the type of the event's source object:

Event Type Source Type Dispatched To
ActiveEvent Any event.dispatch()
Other Component source.dispatchEvent(AWTEvent)
Other MenuComponent source.dispatchEvent(AWTEvent)
Other Other No action (ignored)

@param theEvent an instance of java.awt.AWTEvent or a subclass of it.
Class EventQueue, AWTEvent getNextEvent()

RemoveRemoves an event from the EventQueue and returnreturns it. This method will block until an event has been posted by another thread. @return the next AWTEvent @exception InterruptedException if another thread has interrupted this thread.
Class EventQueue, void invokeAndWait(Runnable)

Causes runnable to have its run() method called in the dispatch thread of the EventQueue. This will happen after all pending events are processed. The call blocks until this has happened. This method will throw an Error if called from the event dispatcher thread. @param runnable the Runnable whose run() method should be executed synchronously on the EventQueue @exception InterruptedException if another thread has interrupted this thread @exception InvocationTargetException if an exception is thrown when running runnable @see #invokeLater @since 1.2
Class EventQueue, void invokeLater(Runnable)

Causes runnable to have its run() method called in the dispatch thread of the EventQueue. This will happen after all pending events are processed. @param runnable the Runnable whose run() method should be executed synchronously on the EventQueue @see #invokeAndWait @since 1.2
Class EventQueue, boolean isDispatchThread()

Returns true if the calling thread is the current AWT EventQueue's dispatch thread. Use this call the ensure that a given task is being executed (or not being) on the current AWT EventDispatchThread. @return true if running on the current AWT EventQueue's dispatch thread.
Class EventQueue, AWTEvent peekEvent()

ReturnReturns the first event on the EventQueue without removing it. @return the first event
Class EventQueue, AWTEvent peekEvent(int)

ReturnReturns the first event with the specified id if any. @param id the id of the type of event desired. @return the first event of the specified id or null if there is no such event
Class EventQueue, void pop()

StopStops dispatching events using this EventQueue instance. Any pending events are transferred to the previous EventQueue for processing.

Warning: To avoid deadlock do not bydeclare itthis method synchronized in a subclass. @exception EmptyStackException if no previous push was made on this EventQueue. @see java.awt.EventQueue#push

Class EventQueue, void postEvent(AWTEvent)

PostPosts a 1.1-style event to the EventQueue. If there is an existing event on the queue with the same ID and event source the source Component's coalesceEvents method will be called. @param theEvent an instance of java.awt.AWTEvent or a subclass of it.
Class EventQueue, void push(EventQueue)

ReplaceReplaces the existing EventQueue with the specified one. Any pending events are transferred to the new EventQueue for processing by it. @param newEventQueue an EventQueue (or subclass thereof) instance to be used.use @see java.awt.EventQueue#pop

Class FileDialog

The FileDialog class displays a dialog window from which the user can select a file.

Since it is a modal dialog when the application calls its show method to display the dialog it blocks the rest of the application until the user has chosen a file. @see Window#show @version 1.43 0249 12/0203/0001 @author Sami Shaio @author Arthur van Hoff @since JDK1.0

Class FileDialog, constructor FileDialog(Frame)

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). @param parent the owner of the dialog @since JDK1.1
Class FileDialog, constructor FileDialog(Frame, String)

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). @param parent the owner of the dialog. @param title the title of the dialog.
Class FileDialog, constructor FileDialog(Frame, String, int)

Creates a file dialog window with the specified title for loading or saving a file.

If the value of mode is LOAD then the file dialog is finding a file to read and the files shown are those in the current directory. If the value of mode is SAVE the file dialog is finding a place to write a file. @param parent the owner of the dialog. @param title the title of the dialog. @param mode the mode of the dialog; either FileDialog.LOAD or FileDialog.SAVE @exception IllegalArgumentException if an illegal file dialog mode is supplied @see java.awt.FileDialog#LOAD @see java.awt.FileDialog#SAVE

Class FileDialog, String getDirectory()

Gets the directory of this file dialog. @return the (potentially null or invalid) directory of this FileDialog. @see java.awt.FileDialog#setDirectory
Class FileDialog, String getFile()

Gets the selected file of this file dialog. If the user selected CANCEL the returned file is null. @return the currently selected file of this file dialog window or null if none is selected. @see java.awt.FileDialog#setFile
Class FileDialog, 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 Windows 95 98 or NT 4.0. @return this file dialog's filename filter. @see java.io.FilenameFilter @see java.awt.FileDialog#setFilenameFilter
Class FileDialog, int getMode()

Indicates whether this file dialog box is for loading from a file or for saving to a file. @return the mode of this file dialog window either FileDialog.LOAD or FileDialog.SAVE. @see java.awt.FileDialog#LOAD @see java.awt.FileDialog#SAVE @see java.awt.FileDialog#setMode
Class FileDialog, String paramString()

Returns the parametera string representing the state of this file dialogFileDialog window. This stringmethod is usefulintended to be used only for debugging purposes and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null. @return the parameter string of this file dialog window.
Class FileDialog, void setDirectory(String)

Sets the directory of this file dialog window to be the specified directory. Specifying a null or 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 null as the directory. @param dir the specificspecified directory. @see java.awt.FileDialog#getDirectory

Class FileDialog, void setFile(String)

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 null as the file. @param file the file being set. @see java.awt.FileDialog#getFile

Class FileDialog, void setFilenameFilter(FilenameFilter)

Sets the filename filter for this file dialog window to the specified filter. Filename filters do not function in Sun's reference implementation for Windows 95 98 or NT 4.0. @param filter the specified filter. @see java.io.FilenameFilter @see java.awt.FileDialog#getFilenameFilter
Class FileDialog, void setMode(int)

Sets the mode of the file dialog. If mode is not a legal value an exception will be thrown and mode will not be set. @param mode the mode for this file dialog either FileDialog.LOAD or FileDialog.SAVE. @see java.awt.FileDialog#LOAD @see java.awt.FileDialog#SAVE @see java.awt.FileDialog#getMode @exception IllegalArgumentException if an illegal file dialog mode is used.supplied @since JDK1.1

Class FlowLayout

A flow layout arranges components in a left-to-right flow much like lines of text in a paragraph. Flow layouts are typically used to arrange buttons in a panel. It will arrange buttons left to right until no more buttons fit on the same line. Each line is centered.

For example the following picture shows an applet using the flow layout manager (its default layout manager) to position three buttons:

Graphic of Layout for Three Buttons

Here is the code for this applet:


 import java.awt.*; import java.applet.Applet; public class myButtons extends Applet { Button button1 button2 button3; public void init() { button1 = new Button("Ok"); button2 = new Button("Open"); button3 = new Button("Close"); add(button1); add(button2); add(button3); } } 

A flow layout lets each component assume its natural (preferred) size. @version 1.39 0243 12/0203/0001 @author Arthur van Hoff @author Sami Shaio @since JDK1.0

Class FlowLayout, constructor FlowLayout()

Constructs a new FlowFlowLayout Layout with a centered alignment and a default 5-unit horizontal and vertical gap.
Class FlowLayout, constructor FlowLayout(int)

Constructs a new Flow LayoutFlowLayout with the specified alignment and a default 5-unit horizontal and vertical gap. The value of the alignment argument must be one of FlowLayout.LEFT FlowLayout.RIGHT or FlowLayout.CENTER. @param align the alignment value
Class FlowLayout, constructor FlowLayout(int, int, int)

Creates a new flow layout manager with the indicated alignment and the indicated horizontal and vertical gaps.

The value of the alignment argument must be one of FlowLayout.LEFT FlowLayout.RIGHT or FlowLayout.CENTER. @param align the alignment value. @param hgap the horizontal gap between components. @param vgap the vertical gap between components.

Class FlowLayout, int getAlignment()

Gets the alignment for this layout. Possible values are FlowLayout.LEFT FlowLayout.RIGHT FlowLayout.CENTER FlowLayout.LEADING or FlowLayout.CENTERTRAILING. @return the alignment value for this layout. @see java.awt.FlowLayout#setAlignment @since JDK1.1
Class FlowLayout, int getHgap()

Gets the horizontal gap between components. @return the horizontal gap between components. @see java.awt.FlowLayout#setHgap @since JDK1.1
Class FlowLayout, int getVgap()

Gets the vertical gap between components. @return the vertical gap between components. @see java.awt.FlowLayout#setVgap @since JDK1.1
Class FlowLayout, void layoutContainer(Container)

Lays out the container. This method lets each component take its preferred size by reshaping the components in the target container in order to satisfy the constraints of this FlowLayout object. @param target the specified component being laid out. @see Container @see java.awt.Container#doLayout
Class FlowLayout, Dimension minimumLayoutSize(Container)

Returns the minimum dimensions needed to layout the visible components contained in the specified target container. @param target the component which needs to be laid out @return the minimum dimensions to lay out the subcomponents of the specified container. @see #preferredLayoutSize @see java.awt.Container @see java.awt.Container#doLayout
Class FlowLayout, Dimension preferredLayoutSize(Container)

Returns the preferred dimensions for this layout given the visible components in the specified target container. @param target the component which needs to be laid out @return the preferred dimensions to lay out the subcomponents of the specified container. @see Container @see #minimumLayoutSize @see java.awt.Container#getPreferredSize
Class FlowLayout, void setAlignment(int)

Sets the alignment for this layout. Possible values are @param align one of the alignment value.values shown above @see #getAlignment() @since JDK1.1
Class FlowLayout, String toString()

Returns a string representation of this FlowLayout object and its values. @return a string representation of this layout.
Class FlowLayout, int LEADING

This value indicates that each row of components should be justified to the leading edge of the container's orientation e.g.for example to the left in left-to-right orientations. @see java.awt.Component#getComponentOrientation @see java.awt.ComponentOrientation @since 1.2 Package-private pending API change approval
Class FlowLayout, int TRAILING

This value indicates that each row of components should be justified to the leadingtrailing edge of the container's orientation e.g.for example to the right in left-to-right orientations. @see java.awt.Component#getComponentOrientation @see java.awt.ComponentOrientation @since 1.2 Package-private pending API change approval

Class Font

The Font class represents fonts. The capabilities of this class have been extended over thewhich are used to render text in a visible java.awtway.Font class inA JDK(tm)font 1.1provides and earlier releasesthe information needed to provide formap developers thesequences of abilitycharacters to utilize more sophisticated typographicsequences features.of glyphs It is important to present the conceptsand to render sequences of glyphs on behindGraphics usingand theComponent wordsobjects. character

Characters and glyph separately.Glyphs

A character is a symbol that represents items like letters and numbers inan item such as a letter a particulardigit writingor systempunctuation in an abstract way. For example lowercase-'g' LATIN SMALL LETTER G is a character. When

A glyph is a particularshape characterused to hasrender beena character renderedor a shapesequence of characters. In simple writing systems such as Latin nowtypically one glyph represents thisone character. ThisIn shape is called ageneral however characters and glyphglyphs do not have one-to-one correspondence. For example Chararcterthe character encoding'á' isLATIN SMALL LETTER A WITH ACUTE can be represented by two glyphs: one for 'a' conversion table thatand one for maps'´'. On the other hand the two-character codesstring to"fi" can be represented by a single glyph codesan in"fi" ligature. In complex writing systems such as Arabic or the South and South-East Asian writing systems the relationship between characters and glyphs can be more complicated and involve context-dependent selection of glyphs as well as glyph reordering. A font encapsulates the collection of glyphs needed to render a selected set of characters as well as the tables needed to map sequences of characters to corresponding sequences of glyphs.

Physical and Logical Fonts

The Java 2 platform distinguishes between two kinds of fonts: physical fonts and logical fonts.

Physical fonts are the actual font libraries containing glyph data and tables to map from character encoding usedsequences to inglyph sequences using a font technology such as TrueType or PostScript Type 1. All implementations of the Java 2D(tm)2 APIplatform must support TrueType fonts; support for other font technologies is Unicodeimplementation dependent. For more information on Unicode you can visit the sitePhysical fonts may use names such as Helvetica Palatino HonMincho http://wwwor any number of other font names.unicode Typically each physical font supports only a limited set of writing systems for example only Latin characters or only Japanese and Basic Latin.org The set of available physical fonts varies between configurations. Applications Charactersthat require specific fonts can bundle them and glyphs do not haveinstantiate them using the one-to-onecreateFont correspondencemethod. For

exampleLogical lowercase-afonts acuteare canthe five font families defined by the Java platform which must be representedsupported by twoany glyphsJava runtime environment: lowercase-aSerif SansSerif Monospaced Dialog and acuteDialogInput. Another example is ligatures such asThese logical fonts are not actual ligaturefont -filibraries. whichInstead the logical font names are mapped to physical fonts by the Java runtime environment. The mapping is a single glyph representing twoimplementation and usually locale dependent charactersso the flook and ithe metrics provided by them vary. Typically each logical font name maps to several physical fonts in order to cover a large range of characters.

APeered FontAWT iscomponents such as Label and TextField can only use logical fonts.

For a collectiondiscussion of glyphsthe relative advantages and disadvantages of using physical or logical fonts see the Internationalization FAQ document.

Font Faces and Names

A Font can have many faces such as heavy medium oblique gothic and regular. All of these faces have similar typographic design.

There are three different names that you can get from a Font object. The logical font name is the same assimply the name that used by java.awt.Font inwas JDKused 1.1to and earlier releasesconstruct the font. The font face name or just font name for short is the name of a particular font face like Helvetica Bold. The family name is the name of the font family that determines the typographic design across several faces like Helvetica. The font face name is the one that should be used to specify fonts. This name signifies actual fonts in the host system and does not identify font names with the shape of font characters as the logical font name does.

The Font class represents an instance of a font face from a collection of font faces that are present in the system resources of the host system. As examples Arial Bold and Courier Bold Italic are font faces. There can be several Font objects associated with a font face each differing in size style transform and font features. The getAllFonts method of the GraphicsEnvironment class returns an array of all font faces available in the system. These font faces are returned as Font objects with a size of 1 identity transform and default font features. These base fonts can then be used to derive new Font objects with varying sizes styles transforms and font features via the deriveFont methods in this class. @see GraphicsEnvironment#getAllFonts @version 1.143 02171 12/1303/01

Class Font, constructor Font(String, int, int)

Creates a new Font from the specified name style and point size. @param name the font name. This can be a logical font name or a font face name. A logical name must be either: Dialog DialogInput Monospaced Serif SansSerif or SymbolSansSerif. If name is null the name of the new Font is set to the name "Default". @param style the style constant for the Font The style argument is an integer bitmask that may be PLAIN or a bitwise union of BOLD and/or ITALIC (for example ITALIC or BOLD|ITALIC). Any other bits set in the style parameter are ignored. If the style argument does not conform to one of the expected integer bitmasks then the style is set to PLAIN. @param size the point size of the Font @see GraphicsEnvironment#getAllFonts @see GraphicsEnvironment#getAvailableFontFamilyNames @since JDK1.0
Class Font, int canDisplayUpTo(CharacterIterator, int, int)

Indicates whether or not this Font can display the specified String. For strings with Unicode encoding it is important to know if a particular font can display the string. This method returns an offset into the String str which is the first character this Font cannot display without using the missing glyph code . If this Font can display all characters -1 is returned. @param textiter a CharacterIterator object @param start the specified starting offset into the specified array of characters @param limit the specified ending offset into the specified array of characters @return an offset into the String object that can be displayed by this Font. @since 1.2
Class Font, int canDisplayUpTo(char[], int, int)

Indicates whether or not this Font can display the characters in the specified text starting at start and ending at limit. This method is a convenience overload. @param text the specified array of characters @param start the specified starting offset into the specified array of characters @param limit the specified ending offset into the specified array of characters @return an offset into text that points to the first character in text that this Font cannot display; or -1 if this Font can display all characters in text. @since 1.2
Class Font, Font createFont(int, InputStream)

Returns a new Font with the specified font type and input data. The new Font is created with a point size of 1 and style PLAIN This base font can then be used with the deriveFont methods in this class to derive new Font objects with varying sizes styles transforms and font features. This method does not close the InputStream @param fontTypefontFormat the type of the Font which is TRUETYPE_FONT if a TrueType is desired. Other types might be provided in the future. @param fontStream an InputStream object representing the input data for the font. @return a new Font created with the specified font type. @throws IllegalArgumentException if fontType is not TRUETYPE_FONT @throws FontFormatException if the fontStream data does not contain the required Truetype font tables. @throws IOException if the fontStream cannot be completely read. @since 1.3
Class Font, GlyphVector createGlyphVector(FontRenderContext, CharacterIterator)

ReturnsCreates a new GlyphVector object by created withmapping the specified CharacterIteratorcharacters andto glyphs one-to-one based on the specifiedUnicode cmap in this FontRenderContextFont. This method does no other processing besides the mapping of glyphs to characters. This means that this method is not useful for some scripts such as Arabic Hebrew Thai and Indic that require reordering shaping or ligature substitution. @param frc the specified FontRenderContext @param ci the specified CharacterIterator @return a new GlyphVector created with the specified CharacterIterator and the specified FontRenderContext.
Class Font, GlyphVector createGlyphVector(FontRenderContext, String)

ReturnsCreates a new GlyphVector object createdby mapping withcharacters to glyphs one-to-one based on the specifiedUnicode cmap in this StringFont. andThis method does no other processing besides the specifiedmapping FontRenderContextof glyphs to characters. This means that this method is not useful for some scripts such as Arabic Hebrew Thai and Indic that require reordering shaping or ligature substitution. @param frc the specified FontRenderContext @param str the specified String @return a new GlyphVector created with the specified String and the specified FontRenderContext.
Class Font, GlyphVector createGlyphVector(FontRenderContext, char[])

ReturnsCreates a newGlyphVector by mapping characters to glyphs one-to-one based on the Unicode cmap in this GlyphVectorFont. object created with the specifiedThis method does no other arrayprocessing besides the mapping of glyphs to characters. This means that this method is not useful for some scripts such as Arabic Hebrew Thai and the specifiedIndic that FontRenderContextrequire reordering shaping or ligature substitution. @param frc the specified FontRenderContext @param chars the specified array of characters @return a new GlyphVector created with the specified array of characters and the specified FontRenderContext.
Class Font, GlyphVector createGlyphVector(FontRenderContext, int[])

ReturnsCreates a newGlyphVector by mapping characters to glyphs one-to-one based on the Unicode cmap in this GlyphVectorFont. object createdThis method withdoes no other processing besides the specified integermapping of arrayglyphs to characters. This means that this method is not useful for some scripts such as Arabic Hebrew Thai and the specifiedIndic that FontRenderContextrequire reordering shaping or ligature substitution. @param frc the specified FontRenderContext @param glyphcodesglyphCodes the specified integer array @return a new GlyphVector created with the specified integer array and the specified FontRenderContext.
Class Font, Font decode(String)

Returns the Font that the str argument describes. To ensure that this method returns the desired Font format the str parameter in one of two ways:

"fontfamilyname-style-pointsize" or
"fontfamilyname style pointsize"

in which style is one of the three case-insensitive strings: "BOLD" "BOLDITALIC" or "ITALIC" and pointsize is a decimal representation of the point size. For example if you want a font that is Arial bold and a point size of 18 you would call this method with: "Arial-BOLD-18".

The default size is 12 and the default style is PLAIN. If you don't specify a valid size the returned Font has a size of 12. If you don't specify a valid style the returned Font has a style of PLAIN. If you do not provide a valid font family name in the str argument this method still returns a valid font with a family name of "dialog". To determine what font family names are available on your system use the GraphicsEnvironment#getAvailableFontFamilyNames() method. If str is null a new Font is returned with the family name "dialog" a size of 12 and a PLAIN style. If str is null a new Font is returned with the name "dialog" a size of 12 and a PLAIN style. @param str the name of the font or null @return the Font object that str describes or a new default Font if str is null. @see #getFamily @since JDK1.1

Class Font, String getFamily()

Returns the family name of this Font. For

The examplefamily Helveticaname of coulda befont is font specific. Two returnedfonts such as aHelvetica Italic and Helvetica Bold have the same family name forHelvetica whereas thetheir font face namenames ofare Helvetica Bold and Helvetica Italic. The list of available family names may be obtained by using the GraphicsEnvironment#getAvailableFontFamilyNames() method.

Use getName to get the logical name of the font. Use getFontName to get the font face name of the font. @return a String that is the family name of this Font. @see #getName @see #getFontName @since JDK1.1

Class Font, String getFamily(Locale)

Returns the family name of this Font localized for the specified locale. For

The examplefamily Helveticaname of coulda befont is font specific. Two fonts returnedsuch as aHelvetica Italic and Helvetica Bold have the same family name forHelvetica thewhereas their font face name ofnames are Helvetica Bold and Helvetica Italic. The list of available family names may be obtained by using the GraphicsEnvironment#getAvailableFontFamilyNames() method.

Use getFontName to get the font face name of the font. @param l locale for which to get the family name @return a String representing the family name of the font localized for the specified locale. @see #getFontName @see java.util.Locale @since 1.2

Class Font, Font getFont(Map)

Returns a Font appropriate to this attribute set. @param attributes the attributes to assign to the new Font @return a new Font created with the specified attributes. @since 1.2 @see java.awt.font.TextAttribute
Class Font, Rectangle2D getStringBounds(CharacterIterator, int, int, FontRenderContext)

Returns the logical bounds of the characters indexed in the specified CharacterIterator in the specified FontRenderContext. The logical bounds iscontains the origin ascent advance and height which includes the leading. The logical bounds does not always enclose all the text. For example in some languages and in some fonts accent marks can be positioned above the ascent or below the descent. used toTo obtain layouta visual bounding box which encloses all the text use the getBounds method of StringTextLayout. @param ci the specified CharacterIterator @param beginIndex the initial offset in ci @param limit the end offset in ci @param frc the specified FontRenderContext @return a Rectangle2D that is the bounding box of the characters indexed in the specified CharacterIterator in the specified FontRenderContext. @see FontRenderContext @see Font#createGlyphVector @since 1.2 @throws IndexOutOfBoundsException if beginIndex is less than the start index of ci or limit is greater than the end index of ci or beginIndex is greater than limit
Class Font, Rectangle2D getStringBounds(String, FontRenderContext)

Returns the logical bounds of the specified String in the specified FontRenderContext. The logical bounds iscontains the origin ascent advance and height which includes the leading. The logical bounds does not always enclose all the text. For example in some languages and in some fonts accent marks can be positioned above the ascent or below the descent. To usedobtain toa visual bounding box which encloses all layoutthe text use the getBounds method of StringTextLayout. @param str the specified String @param frc the specified FontRenderContext @return a Rectangle2D that is the bounding box of the specified String in the specified FontRenderContext. @see FontRenderContext @see Font#createGlyphVector @since 1.2
Class Font, Rectangle2D getStringBounds(String, int, int, FontRenderContext)

Returns the logical bounds of the specified String in the specified FontRenderContext. The logical bounds iscontains the origin ascent advance and height which includes the leading. The logical bounds does not always enclose all the text. For example in some languages and in some fonts accent marks can be positioned above the ascent or below the descent. used toTo obtain layouta visual bounding box which encloses all the text use the getBounds method of StringTextLayout. @param str the specified String @param beginIndex the initial offset of str @param limit the end offset of str @param frc the specified FontRenderContext @return a Rectangle2D that is the bounding box of the specified String in the specified FontRenderContext. @throws IndexOutOfBoundsException if beginIndex is less than zero or limit is greater than the length of str or beginIndex is greater than limit. @see FontRenderContext @see Font#createGlyphVector @since 1.2
Class Font, Rectangle2D getStringBounds(char[], int, int, FontRenderContext)

Returns the logical bounds of the specified array of characters in the specified FontRenderContext. The logical bounds iscontains the origin ascent advance and used to layoutheight which includes the Stringleading. The logical bounds does created withnot always enclose all the specifiedtext. array of charactersFor example in beginIndexsome languages and in some fonts accent marks can be positioned above the ascent or below the descent. To obtain a visual bounding box which encloses all the text use the getBounds method of limitTextLayout. @param chars an array of characters @param beginIndex the initial offset in the array of characters @param limit the end offset in the array of characters @param frc the specified FontRenderContext @return a Rectangle2D that is the bounding box of the specified array of characters in the specified FontRenderContext. @throws IndexOutOfBoundsException if beginIndex is less than zero or limit is greater than the length of chars or beginIndex is greater than limit. @see FontRenderContext @see Font#createGlyphVector @since 1.2
Class Font, AffineTransform getTransform()

Returns a copy of the transform associated with this Font. @paramreturn an AffineTransform object representing the transform attribute of this Font object.
Class Font, int CENTER_BASELINE

The baseline used in ideographic scripts like Chinese Japanese and Korean when laying out text.
Class Font, int HANGING_BASELINE

The baseline used in Devanigiri and similar scripts when laying out text.
Class Font, int ROMAN_BASELINE

The baseline used in most Roman scripts when laying out text.

Class FontFormatException

Thrown by method createFont in the Font class to indicate that the specified font is bad. @author Parry Kejriwal @version 1.4 026 12/0203/0001 @see java.awt.Font @since 1.3
Class FontFormatException, constructor FontFormatException(String)

Report a FontFormatException for the reason specified. @param reason a String message indicating why the font is not accepted.

Class FontMetrics

The FontMetrics class defines a font metrics object which encapsulates information about the rendering of a particular font on a particular screen.

Note to subclassers: Since many of these methods form closed mutually recursive loops you must take care that you implement at least one of the methods in each such loop to prevent infinite recursion when your subclass is used. In particular the following is the minimal suggested set of methods to override in order to ensure correctness and prevent infinite recursion (though other subsets are equally feasible):

Note that the implementations of these methods are inefficient so they are usually overridden with more efficient toolkit-specific implementations.

When an application asks AWT to place a character at the position (x  y) the character is placed so that its reference point (shown as the dot in the accompanying image) is put at that position. The reference point specifies a horizontal line called the baseline of the character. In normal printing the baselines of characters should align.

In addition every character in a font has an ascent a descent and an advance width. The ascent is the amount by which the character ascends above the baseline. The descent is the amount by which the character descends below the baseline. The advance width indicates the position at which AWT should place the next character.

An array of characters or a string can also have an ascent a descent and an advance width. The ascent of the array is the maximum ascent of any character in the array. The descent is the maximum descent of any character in the array. The advance width is the sum of the advance widths of each of the characters in the character array. The advance of a String is the distance along the baseline of the String. This distance is the width that should be used for centering or right-aligning the String. Note that the advance of a String is not necessarily the sum of the advances of its characters measured in isolation because the width of a character can vary depending on its context. For example in Arabic text the shape of a character can change in order to connect to other characters. Also in some scripts certain character sequences can be represented by a single shape called a ligature. Measuring characters individually does not account for these transformations. @version 1.21 0347 12/1803/9801 @author Jim Graham @see java.awt.Font @since JDK1.0

Class FontMetrics, int charWidth(char)

Returns the advance width of the specified character in this Font. The advance is the distance from the leftmost point to the rightmost point on the character's baseline. Note that the advance of a String is not necessarily the sum of the advances of its characters. @param ch the character to be measured @return the advance width of the specified char in the Font described by this FontMetrics object. @see #charsWidth(char[] int int) @see #stringWidth(String)
Class FontMetrics, int getHeight()

Gets the standard height of a line of text in this font. This is the distance between the baseline of adjacent lines of text. It is the sum of the leading + ascent + descent. Due to rounding this may not be the same as getAscent() + getDescent() + getLeading(). There is no guarantee that lines of text spaced at this distance are disjoint; such lines may overlap if some characters overshoot either the standard ascent or the standard descent metric. @return the standard height of the font. @see #getLeading() @see #getAscent() @see #getDescent()
Class FontMetrics, int getMaxDecent()

For backward compatibility only. @return the maximum descent of any character in the Font. @see #getMaxDescent() @deprecated As of JDK version 1.1.1 replaced by getMaxDescent().

Class Frame

A Frame is a top-level window with a title and a border.

The size of the frame includes any area designated for the border. The dimensions of the border area canmay be obtained using the getInsets method however since these dimensions are platform-dependent a valid insets value cannot be obtained until the frame is made displayable by either calling pack or show. Since the border area is included in the overall size of the frame the border effectively obscures a portion of the frame constraining the area available for rendering and/or displaying subcomponents to the rectangle which has an upper-left corner location of (insets.left insets.top) and has a size of width - (insets.left + insets.right) by height - (insets.top + insets.bottom).

The default layout for a frame is BorderLayout.

A frame may have its native decorations (i.e. Frame and Titlebar) turned off with setUndecorated. This can only be done while the frame is not displayable

In a multi-screen environment you can create a Frame on a different screen device by constructing the Frame with #Frame(GraphicsConfiguration) or titl GraphicsConfiguration)}. The GraphicsConfiguration object is one of the GraphicsConfiguration objects of the target screen device.

In a virtual device multi-screen environment in which the desktop area could span multiple physical screen devices the bounds of all configurations are relative to the virtual-coordinate system. The origin of the virtual-coordinate system is at the upper left-hand corner of the primary physical screen. Depending on the location of the primary screen in the virtual device negative coordinates are possible as shown in the following figure.

ALIGN=center HSPACE=10 VSPACE=7

In such an environment when calling setLocation you must pass a virtual coordinate to this method. Similarly calling getLocationOnScreen on a Frame returns virtual device coordinates. Call the getBounds method of a GraphicsConfiguration to find its origin in the virtual coordinate system.

The following code sets the location of the Frame at (10 10) relative to the origin of the physical screen of the corresponding GraphicsConfiguration. If the bounds of the GraphicsConfiguration is not taken into account the Frame location would be set at (10 10) relative to the virtual-coordinate system and would appear on the primary physical screen which might be different from the physical screen of the specified GraphicsConfiguration.

 Frame f = new Frame(GraphicsConfiguration gc); Rectangle bounds = gc.getBounds(); f.setLocation(10 + bounds.x 10 + bounds.y); 

Frames are capable of generating the following types of window eventsWindowEvents: WindowOpened

@version 1.108 04131 12/0603/0001 @author Sami Shaio @see WindowEvent @see Window#addWindowListener @since JDK1.0
Class Frame, constructor Frame()

Constructs a new instance of Frame that is initially invisible. The title of the Frame is empty. @exception HeadlessException when GraphicsEnvironment.isHeadless() returns true @see java.awt.GraphicsEnvironment#isHeadless() @see Component#setSize @see Component#setVisible(boolean)
Class Frame, constructor Frame(GraphicsConfiguration)

Create a Frame with the specified GraphicsConfiguration of a screen device. @param gc the GraphicsConfiguration of the target screen device. If gc is null the system default GraphicsConfiguration is assumed. @exception IllegalArgumentException if gc is not from a screen device. This exception is always thrown when GraphicsEnvironment.isHeadless() returns true @see java.awt.GraphicsEnvironment#isHeadless() @since 1.3
Class Frame, constructor Frame(String)

Constructs a new initially invisible Frame object with the specified title. @param title the title to be displayed in the frame's border. A null value is treated as an empty string "". @exception IllegalArgumentException ifHeadlessException when gc is notGraphicsEnvironment.isHeadless() from areturns true screen@see devicejava.awt.GraphicsEnvironment#isHeadless() @see java.awt.Component#setSize @see java.awt.Component#setVisible(boolean) @see java.awt.GraphicsConfiguration#getBounds
Class Frame, constructor Frame(String, GraphicsConfiguration)

Constructs a new initially invisible Frame object with the specified title and a GraphicsConfiguration. @param title the title to be displayed in the frame's border. A null value is treated as an empty string "". @param gc the GraphicsConfiguration of the target screen device. If gc is null the system default GraphicsConfiguration is assumed. @exception IllegalArgumentException if gc is not from a screen device. This exception is always thrown when GraphicsEnvironment.isHeadless() returns true @see java.awt.GraphicsEnvironment#isHeadless() @see java.awt.Component#setSize @see java.awt.Component#setVisible(boolean) @see java.awt.GraphicsConfiguration#getBounds
Class Frame, Image getIconImage()

Gets the image to be displayed in the minimized icon for this frame. @return the icon image for this frame or null if this frame doesn't have an icon image. @see java.awt.Frame#setIconImage(Icon)
Class Frame, MenuBar getMenuBar()

Gets the menu bar for this frame. @return the menu bar for this frame or null if this frame doesn't have a menu bar. @see java.awt.Frame#setMenuBar(MenuBar)
Class Frame, int getState()

Gets the state of this frame (obsolete). @return

Frame.In older versions of JDK a frame state could only be NORMAL or ICONIFIED. Since JDK 1.4 set of ifsupported frame instates iconicis expanded and frame state; is represented as a bitwise mask.

For compatibility with old programs this method still returns Frame.NORMAL ifand Frame.ICONIFIED but it only reports the iconic state of the frame isother aspects in normalof frame state are not reported by this method. @seereturn java.awtFrame.NORMAL or Frame.ICONIFIED. @see #setState(int) @see #getExtendedState

Class Frame, String getTitle()

Gets the title of the frame. The title is displayed in the frame's border. @return the title of this frame or an empty string ("") if this frame doesn't have a title. @see java.awt.Frame#setTitle(String)
Class Frame, boolean isResizable()

Indicates whether this frame is resizable by the user. By default all frames are initially resizable. @return true if the user can resize this frame; false otherwise. @see java.awt.Frame#setResizable(boolean)
Class Frame, String paramString()

Returns thea parameterstring representing the Stringstate of this Frame. This method is intended to be used only for debugging purposes and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null. @return the parameter string of this frame
Class Frame, void remove(MenuComponent)

Removes the specified menu bar from this frame. @param m the menu component to remove. If this parameterm is null then a NullPointerException is thrown and no action is taken.
Class Frame, void setIconImage(Image)

Sets the image to be displayed in the minimized icon for this frame. Not all platforms support the concept of minimizing a window. @param image the icon image to be displayed. If this parameter is null then the icon image is set to the default image which may vary with platform. @see java.awt.Frame#getIconImage
Class Frame, void setMenuBar(MenuBar)

Sets the menu bar for this frame to the specified menu bar. @param mb the menu bar being set. If this parameter is null then any existing menu bar on this frame is removed. @see java.awt.Frame#getMenuBar
Class Frame, void setState(int)

Sets the state of this frame (obsolete). @param

In older versions of JDK a frame state Frame.could only be NORMAL or ICONIFIED if. Since thisJDK 1.4 set of supported frame states is in iconicexpanded and frame state; is represented as a bitwise mask.

For compatibility with old programs this method still accepts Frame.NORMAL ifand thisFrame.ICONIFIED but it only changes the iconic state of the frame isother aspects in normalof frame state are not affected by this method. @seeparam java.awtstate either Frame.NORMAL or Frame.ICONIFIED. @see #getState @see #setExtendedState(int)

Class Frame, void setTitle(String)

Sets the title for this frame to the specified string. @param title the title to be displayed in the frame's border @param title the title to be displayed in the frame's border. A null value is treated as an empty string "". @see java.awt.Frame#getTitle

Class GradientPaint, constructor GradientPaint(Point2D, Color, Point2D, Color)

Constructs a simple acyclic GradientPaint object. @param pt1 the first specified Point in user space @param color1 Color at the first specified Point @param pt2 the second specified Point in user space @param color2 Color at the second specified Point @throws NullPointerException if either one of colors or points is null
Class GradientPaint, constructor GradientPaint(Point2D, Color, Point2D, Color, boolean)

Constructs either a cyclic or acyclic GradientPaint object depending on the boolean parameter. @param pt1 the first specified Point in user space @param color1 Color at the first specified Point @param pt2 the second specified Point in user space @param color2 Color at the second specified Point @param cyclic true if the gradient pattern should cycle repeatedly between the two colors; false otherwise @throws NullPointerException if either one of colors or points is null
Class GradientPaint, constructor GradientPaint(float, float, Color, float, float, Color)

Constructs a simple acyclic GradientPaint object. @param x1  y1 coordinates of the first specified Point in user space @param color1 Color at the first specified Point @param x2  y2 coordinates of the second specified Point in user space @param color2 Color at the second specified Point @throws NullPointerException if either one of colors is null

Class Graphics

The Graphics class is the abstract base class for all graphics contexts that allow an application to draw onto components that are realized on various devices as well as onto off-screen images.

A Graphics object encapsulates state information needed for the basic rendering operations that Java supports. This state information includes the following properties:

Class Graphics, boolean drawImage(Image, int, int, Color, ImageObserver)

Draws as much of the specified image as is currently available. The image is drawn with its top-left corner at (x  y) in this graphics context's coordinate space. Transparent pixels are drawn in the specified background color.

This operation is equivalent to filling a rectangle of the width and height of the specified image with the given color and then drawing the image on top of it but possibly more efficient.

This method returns immediately in all cases even if the complete image has not yet been loaded and it has not been dithered and converted for the current output device.

If the image has not yet been completely loaded then drawImage returns false. As more of the image becomes available the process that draws the image notifies the specified image observer. @param img the specified image to be drawn. @param x the x coordinate. @param y the y coordinate. @param bgcolor the background color to paint under the non-opaque portions of the image. @param observer object to be notified as more of the image is converted. @return true if the image is completely loaded; false otherwise. @see java.awt.Image @see java.awt.image.ImageObserver @see java.awt.image.ImageObserver#imageUpdate(java.awt.Image int int int int int)

Class Graphics, boolean drawImage(Image, int, int, ImageObserver)

Draws as much of the specified image as is currently available. The image is drawn with its top-left corner at (x  y) in this graphics context's coordinate space. Transparent pixels in the image do not affect whatever pixels are already there.

This method returns immediately in all cases even if the complete image has not yet been loaded and it has not been dithered and converted for the current output device.

If the image has not yet been completely loaded then drawImage returns false. As more of the image becomes available the process that draws the image notifies the specified image observer. @param img the specified image to be drawn. @param x the x coordinate. @param y the y coordinate. @param observer object to be notified as more of the image is converted. @return true if the image is completely loaded; false otherwise. @see java.awt.Image @see java.awt.image.ImageObserver @see java.awt.image.ImageObserver#imageUpdate(java.awt.Image int int int int int)

Class Graphics, boolean drawImage(Image, int, int, int, int, Color, ImageObserver)

Draws as much of the specified image as has already been scaled to fit inside the specified rectangle.

The image is drawn inside the specified rectangle of this graphics context's coordinate space and is scaled if necessary. Transparent pixels are drawn in the specified background color. This operation is equivalent to filling a rectangle of the width and height of the specified image with the given color and then drawing the image on top of it but possibly more efficient.

This method returns immediately in all cases even if the entire image has not yet been scaled dithered and converted for the current output device. If the current output representation is not yet complete then drawImage returns false. As more of the image becomes available the process that draws the image notifies the specified image observer.

A scaled version of an image will not necessarily be available immediately just because an unscaled version of the image has been constructed for this output device. Each size of the image may be cached separately and generated from the original data in a separate image production sequence. @param img the specified image to be drawn. @param x the x coordinate. @param y the y coordinate. @param width the width of the rectangle. @param height the height of the rectangle. @param bgcolor the background color to paint under the non-opaque portions of the image. @param observer object to be notified as more of the image is converted. @return true if the current output representation is complete; false otherwise. @see java.awt.Image @see java.awt.image.ImageObserver @see java.awt.image.ImageObserver#imageUpdate(java.awt.Image int int int int int)

Class Graphics, boolean drawImage(Image, int, int, int, int, ImageObserver)

Draws as much of the specified image as has already been scaled to fit inside the specified rectangle.

The image is drawn inside the specified rectangle of this graphics context's coordinate space and is scaled if necessary. Transparent pixels do not affect whatever pixels are already there.

This method returns immediately in all cases even if the entire image has not yet been scaled dithered and converted for the current output device. If the current output representation is not yet complete then drawImage returns false. As more of the image becomes available the process that draws the image notifies the image observer by calling its imageUpdate method.

A scaled version of an image will not necessarily be available immediately just because an unscaled version of the image has been constructed for this output device. Each size of the image may be cached separately and generated from the original data in a separate image production sequence. @param img the specified image to be drawn. @param x the x coordinate. @param y the y coordinate. @param width the width of the rectangle. @param height the height of the rectangle. @param observer object to be notified as more of the image is converted. @return true if the current output representation is complete; false otherwise. @see java.awt.Image @see java.awt.image.ImageObserver @see java.awt.image.ImageObserver#imageUpdate(java.awt.Image int int int int int)

Class Graphics, boolean drawImage(Image, int, int, int, int, int, int, int, int, Color, ImageObserver)

Draws as much of the specified area of the specified image as is currently available scaling it on the fly to fit inside the specified area of the destination drawable surface.

Transparent pixels are drawn in the specified background color. This operation is equivalent to filling a rectangle of the width and height of the specified image with the given color and then drawing the image on top of it but possibly more efficient.

This method returns immediately in all cases even if the image area to be drawn has not yet been scaled dithered and converted for the current output device. If the current output representation is not yet complete then drawImage returns false. As more of the image becomes available the process that draws the image notifies the specified image observer.

This method always uses the unscaled version of the image to render the scaled rectangle and performs the required scaling on the fly. It does not use a cached scaled version of the image for this operation. Scaling of the image from source to destination is performed such that the first coordinate of the source rectangle is mapped to the first coordinate of the destination rectangle and the second source coordinate is mapped to the second destination coordinate. The subimage is scaled and flipped as needed to preserve those mappings. @param img the specified image to be drawn @param dx1 the x coordinate of the first corner of the destination rectangle. @param dy1 the y coordinate of the first corner of the destination rectangle. @param dx2 the x coordinate of the second corner of the destination rectangle. @param dy2 the y coordinate of the second corner of the destination rectangle. @param sx1 the x coordinate of the first corner of the source rectangle. @param sy1 the y coordinate of the first corner of the source rectangle. @param sx2 the x coordinate of the second corner of the source rectangle. @param sy2 the y coordinate of the second corner of the source rectangle. @param bgcolor the background color to paint under the non-opaque portions of the image. @param observer object to be notified as more of the image is scaled and converted. @return true if the current output representation is complete; false otherwise. @see java.awt.Image @see java.awt.image.ImageObserver @see java.awt.image.ImageObserver#imageUpdate(java.awt.Image int int int int int) @since JDK1.1

Class Graphics, boolean drawImage(Image, int, int, int, int, int, int, int, int, ImageObserver)

Draws as much of the specified area of the specified image as is currently available scaling it on the fly to fit inside the specified area of the destination drawable surface. Transparent pixels do not affect whatever pixels are already there.

This method returns immediately in all cases even if the image area to be drawn has not yet been scaled dithered and converted for the current output device. If the current output representation is not yet complete then drawImage returns false. As more of the image becomes available the process that draws the image notifies the specified image observer.

This method always uses the unscaled version of the image to render the scaled rectangle and performs the required scaling on the fly. It does not use a cached scaled version of the image for this operation. Scaling of the image from source to destination is performed such that the first coordinate of the source rectangle is mapped to the first coordinate of the destination rectangle and the second source coordinate is mapped to the second destination coordinate. The subimage is scaled and flipped as needed to preserve those mappings. @param img the specified image to be drawn @param dx1 the x coordinate of the first corner of the destination rectangle. @param dy1 the y coordinate of the first corner of the destination rectangle. @param dx2 the x coordinate of the second corner of the destination rectangle. @param dy2 the y coordinate of the second corner of the destination rectangle. @param sx1 the x coordinate of the first corner of the source rectangle. @param sy1 the y coordinate of the first corner of the source rectangle. @param sx2 the x coordinate of the second corner of the source rectangle. @param sy2 the y coordinate of the second corner of the source rectangle. @param observer object to be notified as more of the image is scaled and converted. @return true if the current output representation is complete; false otherwise. @see java.awt.Image @see java.awt.image.ImageObserver @see java.awt.image.ImageObserver#imageUpdate(java.awt.Image int int int int int) @since JDK1.1

Class Graphics, Rectangle getClipRect()

Returns the bounding rectangle of the current clipping area. @return the bounding rectangle of the current clipping area or null if no clip is set. @deprecated As of JDK version 1.1 replaced by getClipBounds().
Class Graphics, Color getColor()

Gets this graphics context's current color. @return this graphics context's current color. @see java.awt.Color @see java.awt.Graphics#setColor(Color)
Class Graphics, Font getFont()

Gets the current font. @return this graphics context's current font. @see java.awt.Font @see java.awt.Graphics#setFont(Font)
Class Graphics, boolean hitClip(int, int, int, int)

Returns true if the specified rectangular area intersects the boundingmight rectangle ofintersect the current clipping area. The coordinates of the specified rectangular area are in the rectangleuser coordinate space and are relative to the coordinate system origin of this graphics context. This method may use an algorithm that calculates a result quickly but which sometimes might return true even if the specified rectangular area does not intersect the clipping area. The specific algorithm employed may thus trade off accuracy for speed but it will never return false unless it can guarantee that the specified rectangular area does not intersect the current clipping area. The clipping area used by this method can represent the intersection of the user clip as specified through the clip methods of this graphics context as well as the clipping associated with the device or image bounds and window visibility. @param x the x coordinate of the rectangle to test against the clip @param y the y coordinate of the rectangle to test against the clip @param width the width of the rectangle to test against the clip @param height the height of the rectangle to test against the clip @return true if the specified rectangle intersects the bounds of the current clip; false otherwise.
Class Graphics, void setClip(int, int, int, int)

Sets the current clip to the rectangle specified by the given coordinates. This method sets the user clip which is independent of the clipping associated with device bounds and window visibility. Rendering operations have no effect outside of the clipping area. @param x the x coordinate of the new clip rectangle. @param y the y coordinate of the new clip rectangle. @param width the width of the new clip rectangle. @param height the height of the new clip rectangle. @see java.awt.Graphics#clipRect @see java.awt.Graphics#setClip(Shape) @see java.awt.Graphics#getClip @since JDK1.1

Class Graphics2D

This Graphics2D class extends the Graphics class to provide more sophisticated control over geometry coordinate transformations color management and text layout. This is the fundamental class for rendering 2-dimensional shapes text and images on the Java(tm) platform.

Coordinate Spaces

All coordinates passed to a Graphics2D object are specified in a device-independent coordinate system called User Space which is used by applications. The Graphics2D object contains an AffineTransform object as part of its rendering state that defines how to convert coordinates from user space to device-dependent coordinates in Device Space.

Coordinates in device space usually refer to individual device pixels and are aligned on the infinitely thin gaps between these pixels. Some Graphics2D objects can be used to capture rendering operations for storage into a graphics metafile for playback on a concrete device of unknown physical resolution at a later time. Since the resolution might not be known when the rendering operations are captured the Graphics2D Transform is set up to transform user coordinates to a virtual device space that approximates the expected resolution of the target device. Further transformations might need to be applied at playback time if the estimate is incorrect.

Some of the operations performed by the rendering attribute objects occur in the device space but all Graphics2D methods take user space coordinates.

Every Graphics2D object is associated with a target that defines where rendering takes place. A GraphicsConfiguration object defines the characteristics of the rendering target such as pixel format and resolution. The same rendering target is used throughout the life of a Graphics2D object.

When creating a Graphics2D object the GraphicsConfiguration specifies the default transform for the target of the Graphics2D (a Component or Thi default transform maps the user space coordinate system to screen and printer device coordinates such that the origin maps to the upper left hand corner of the target region of the device with increasing X coordinates extending to the right and increasing Y coordinates extending downward. The scaling of the default transform is set to identity for those devices that are close to 72 dpi such as screen devices. The scaling of the default transform is set to approximately 72 user space coordinates per square inch for high resolution devices such as printers. For image buffers the default transform is the Identity transform.

Rendering Process

The Rendering Process can be broken down into four phases that are controlled by the Graphics2D rendering attributes. The renderer can optimize many of these steps either by caching the results for future calls by collapsing multiple virtual steps into a single operation or by recognizing various attributes as common simple cases that can be eliminated by modifying other parts of the operation.

The steps in the rendering process are:

  1. Determine what to render.
  2. Constrain the rendering operation to the current Clip. The Clip is specified by a Shape in user space and is controlled by the program using the various clip manipulation methods of Graphics and Graphics2D. This user clip is transformed into device space by the current Transform and combined with the device clip which is defined by the visibility of windows and device extents. The combination of the user clip and device clip defines the composite clip which determines the final clipping region. The user clip is not modified by the rendering system to reflect the resulting composite clip.
  3. Determine what colors to render.
  4. Apply the colors to the destination drawing surface using the current Composite attribute in the Graphics2D context.

The three types of rendering operations along with details of each of their particular rendering processes are:
  1. Shape operations
    1. If the operation is a draw(Shape) operation then the createStrokedShape method on the current Stroke attribute in the Graphics2D context is used to construct a new Shape object that contains the outline of the specified Shape.
    2. The Shape is transformed from user space to device space using the current Transform in the Graphics2D context.
    3. The outline of the Shape is extracted using the getPathIterator method of Shape which returns a PathIterator object that iterates along the boundary of the Shape.
    4. If the Graphics2D object cannot handle the curved segments that the PathIterator object returns then it can call the alternate double getPathIterator} method of Shape which flattens the Shape.
    5. The current Paint in the Graphics2D context is queried for a PaintContext which specifies the colors to render in device space.
  2. Text operations
    1. The following steps are used to determine the set of glyphs required to render the indicated String:
      1. If the argument is a String then the current Font in the Graphics2D context is asked to convert the Unicode characters in the String into a set of glyphs for presentation with whatever basic layout and shaping algorithms the font implements.
      2. If the argument is an AttributedCharacterIterator the iterator is asked to convert itself to a TextLayout using its embedded font attributes. The TextLayout implements more sophisticated glyph layout algorithms that perform Unicode bi-directional layout adjustments automatically for multiple fonts of differing writing directions.
      3. If the argument is a GlyphVector then the GlyphVector object already contains the appropriate font-specific glyph codes with explicit coordinates for the position of each glyph.
    2. The current Font is queried to obtain outlines for the indicated glyphs. These outlines are treated as shapes in user space relative to the position of each glyph that was determined in step 1.
    3. The character outlines are filled as indicated above under Shape operations.
    4. The current Paint is queried for a PaintContext which specifies the colors to render in device space.
  3. Image Operations
    1. The region of interest is defined by the bounding box of the source Image. This bounding box is specified in Image Space which is the Image object's local coordinate system.
    2. If an AffineTransform is passed to java.awt.geom.AffineTransfor java.awt.image.ImageObserver) drawImage(Image AffineTransform ImageObserver)} the AffineTransform is used to transform the bounding box from image space to user space. If no AffineTransform is supplied the bounding box is treated as if it is already in user space.
    3. The bounding box of the source Image is transformed from user space into device space using the current Transform. Note that the result of transforming the bounding box does not necessarily result in a rectangular region in device space.
    4. The Image object determines what colors to render sampled according to the source to destination coordinate mapping specified by the current Transform and the optional image transform.

Default Rendering Attributes

The default values for the Graphics2D rendering attributes are:
Paint
The color of the Component.
Font
The Font of the Component.
Stroke
A square pen with a linewidth of 1 no dashing miter segment joins and square end caps.
Transform
The getDefaultTransform for the GraphicsConfiguration of the Component.
Composite
The AlphaComposite#SRC_OVER rule.
Clip
No rendering Clip the output is clipped to the Component.

Rendering Compatibility Issues

The JDK(tm) 1.1 rendering model is based on a pixelization model that specifies that coordinates are infinitely thin lying between the pixels. Drawing operations are performed using a one-pixel wide pen that fills the pixel below and to the right of the anchor point on the path. The JDK 1.1 rendering model is consistent with the capabilities of most of the existing class of platform renderers that need to resolve integer coordinates to a discrete pen that must fall completely on a specified number of pixels.

The Java 2D(tm) (Java(tm) 2 platform) API supports antialiasing renderers. A pen with a width of one pixel does not need to fall completely on pixel N as opposed to pixel N+1. The pen can fall partially on both pixels. It is not necessary to choose a bias direction for a wide pen since the blending that occurs along the pen traversal edges makes the sub-pixel position of the pen visible to the user. On the other hand when antialiasing is turned off by setting the KEY_ANTIALIASING hint key to the VALUE_ANTIALIAS_OFF hint value the renderer might need to apply a bias to determine which pixel to modify when the pen is straddling a pixel boundary such as when it is drawn along an integer coordinate in device space. While the capabilities of an antialiasing renderer make it no longer necessary for the rendering model to specify a bias for the pen it is desirable for the antialiasing and non-antialiasing renderers to perform similarly for the common cases of drawing one-pixel wide horizontal and vertical lines on the screen. To ensure that turning on antialiasing by setting the KEY_ANTIALIASING hint key to VALUE_ANTIALIAS_ON does not cause such lines to suddenly become twice as wide and half as opaque it is desirable to have the model specify a path for such lines so that they completely cover a particular set of pixels to help increase their crispness.

Java 2D API maintains compatibility with JDK 1.1 rendering behavior such that legacy operations and existing renderer behavior is unchanged under Java 2D API. Legacy methods that map onto general draw and fill methods are defined which clearly indicates how Graphics2D extends Graphics based on settings of Stroke and Transform attributes and rendering hints. The definition performs identically under default attribute settings. For example the default Stroke is a BasicStroke with a width of 1 and no dashing and the default Transform for screen drawing is an Identity transform.

The following two rules provide predictable rendering behavior whether aliasing or antialiasing is being used.

The following definitions of general legacy methods perform identically to previously specified behavior under default attribute settings:

The Graphics class defines only the setColor method to control the color to be painted. Since the Java 2D API extends the Color object to implement the new Paint interface the existing setColor method is now a convenience method for setting the current Paint attribute to a Color object. setColor(c) is equivalent to setPaint(c).

The Graphics class defines two methods for controlling how colors are applied to the destination.

  1. The setPaintMode method is implemented as a convenience method to set the default Composite equivalent to setComposite(new AlphaComposite.SrcOver).
  2. The setXORMode(Color xorcolor) method is implemented as a convenience method to set a special Composite object that ignores the Alpha components of source colors and sets the destination color to the value:
     dstpixel = (PixelOf(srccolor) ^ PixelOf(xorcolor) ^ dstpixel); 
@version 1.70 0276 12/0203/0001 @author Jim Graham @see java.awt.RenderingHints
Class Graphics2D, void drawGlyphVector(GlyphVector, float, float)

Renders the text of the specified GlyphVector using the Graphics2D context's rendering attributes. The rendering attributes applied include the Clip Transform Paint and Composite attributes. The GlyphVector specifies individual glyphs from a Font The GlyphVector can also contain the glyph positions. This is the fastest way to render a set of characters to the screen. @param g the GlyphVector to be rendered @param x  y the position in User Space where the glyphs should be rendered @see java.awt.fontFont#createGlyphVector @see java.awt.font.GlyphVector @see #setPaint @see java.awt.Graphics#setColor @see #setTransform @see #setComposite @see #setClip
Class Graphics2D, void drawString(String, float, float)

Renders the text specified by the specified String using the current Font andtext Paintattribute attributesstate in the Graphics2D context. The baseline of the first character is at position (x  y) in the User Space. The rendering attributes applied include the Clip Transform Paint Font and Composite attributes. For characters in script systems such as Hebrew and Arabic the glyphs can be rendered from right to left in which case the coordinate supplied is the location of the leftmost character on the baseline. @param s the String to be rendered @param x  y the coordinates where the String should be rendered @throws NullPointerException if str is null @see #setPaint @see java.awt.Graphics#setColor @see java.awt.Graphics#setFont @see #setTransform @see #setComposite @see #setClip
Class Graphics2D, void drawString(String, int, int)

Renders the text of the specified String using the current Font andtext Paintattribute attributesstate in the Graphics2D context. The baseline of the first character is at position (x  y) in the User Space. The rendering attributes applied include the Clip Transform Paint Font and Composite attributes. For characters in script systems such as Hebrew and Arabic the glyphs can be rendered from right to left in which case the coordinate supplied is the location of the leftmost character on the baseline. @param str the string to be rendered @param x  y the coordinates where the String should be rendered @throws NullPointerException if str is null @see java.awt.Graphics#drawBytes @see java.awt.Graphics#drawChars @since JDK1.0
Class Graphics2D, GraphicsConfiguration getDeviceConfiguration()

Returns the device configuration associated with this Graphics2D. @return the device configuration of this Graphics2D.
Class Graphics2D, Object getRenderingHint(Key)

Returns the value of a single preference for the rendering algorithms. Hint categories include controls for rendering quality and overall time/quality trade-off in the rendering process. Refer to the RenderingHints class for definitions of some common keys and values. @param hintKey the key corresponding to the hint to get. @return an object representing the value for the specified hint key. Some of the keys and their associated values are defined in the RenderingHints class. @see RenderingHints @see #setRenderingHint(RenderingHints.Key Object)
Class Graphics2D, RenderingHints getRenderingHints()

Gets the preferences for the rendering algorithms. Hint categories include controls for rendering quality and overall time/quality trade-off in the rendering process. Returns all of the hint key/value pairs that were ever specified in one operation. Refer to the RenderingHints class for definitions of some common keys and values. @return a reference to an instance of RenderingHints that contains the current preferences. @see RenderingHints @see #setRenderingHints(Map)
Class Graphics2D, void setComposite(Composite)

Sets the Composite for the Graphics2D context. The Composite is used in all drawing methods such as drawImage drawString draw and fill. It specifies how new pixels are to be combined with the existing pixels on the graphics device during the rendering process.

If this Graphics2D context is drawing to a Component on the display screen and the Composite is a custom object rather than an instance of the AlphaComposite class and if there is a security manager its checkPermission method is called with an AWTPermission("readDisplayPixels") permission. @throws SecurityException if a custom Composite object is being used to render to the screen and a security manager is set and its checkPermission method does not allow the operation. @param comp the Composite object to be used for rendering @see java.awt.Graphics#setXORMode @see java.awt.Graphics#setPaintMode @see #getComposite @see AlphaComposite @see SecurityManager#checkPermission @see java.awt.AWTPermission

Class Graphics2D, void setPaint(Paint)

Sets the Paint attribute for the Graphics2D context. Calling this method with a null Paint object does not have any effect on the current Paint attribute of this Graphics2D. @param paint the Paint object to be used to generate color during the rendering process or null @see java.awt.Graphics#setColor @see #getPaint @see GradientPaint @see TexturePaint
Class Graphics2D, void setRenderingHint(Key, Object)

Sets the value of a single preference for the rendering algorithms. Hint categories include controls for rendering quality and overall time/quality trade-off in the rendering process. Refer to the RenderingHints class for definitions of some common keys and values. @param hintKey the key of the hint to be set. @param hintValue the value indicating preferences for the specified hint category. @see #getRenderingHint(RenderingHints.Key) @see RenderingHints
Class Graphics2D, void setRenderingHints(Map)

Replaces the values of all preferences for the rendering algorithms with the specified hints. The existing values for all rendering hints are discarded and the new set of known hints and values are initialized from the specified Map object. Hint categories include controls for rendering quality and overall time/quality trade-off in the rendering process. Refer to the RenderingHints class for definitions of some common keys and values. @param hints the rendering hints to be set @see #getRenderingHints @see RenderingHints
Class Graphics2D, void setStroke(Stroke)

Sets the Stroke for the Graphics2D context. @param s the Stroke object to be used to stroke a Shape during the rendering process @see BasicStroke @see #getStroke
Class Graphics2D, void setTransform(AffineTransform)

SetsOverwrites the Transform in the Graphics2D context. WARNING: This method should never be used to apply a new coordinate transform on top of an existing transform because the Graphics2D might already have a transform that is needed for other purposes such as rendering Swing components or applying a scaling transformation to adjust for the resolution of a printer.

To add a coordinate transform use the transform rotate scale or shear methods. The setTransform method is intended only for restoring the original Graphics2D transform after rendering as shown in this example:

// Get the current transform AffineTransform saveAT = g2.getTransform(); // Perform transformation g2d.transform(...); // Render g2d.draw(...); // Restore original transform g2d.setTransform(saveAT);
@param Tx the AffineTransform object tothat be used inwas retrieved from the renderinggetTransform processmethod @see #transform @see #getTransform @see AffineTransform

Class GraphicsConfigTemplate

The GraphicsConfigTemplate class is used to obtain a valid GraphicsConfiguration A user instantiates one of these objects and then sets all non-default attributes as desired. The GraphicsDevice#getBestConfiguration method found in the GraphicsDevice class is then called with this GraphicsConfigTemplate. A valid GraphicsConfiguration is returned that meets or exceeds what was requested in the GraphicsConfigTemplate. @see GraphicsDevice @see GraphicsConfiguration @version 1.13 0214 12/0203/0001 @since 1.2

Class GraphicsDevice

The GraphicsDevice class describes the graphics devices that might be available in a particular graphics environment. These include screen and printer devices. Note that there can be many screens and many printers in an instance of GraphicsEnvironment Each graphics device has one or more GraphicsConfiguration objects associated with it. These objects specify the different configurations in which the GraphicsDevice can be used.

In a multi-screen environment the GraphicsConfiguration objects can be used to render components on multiple screens. The following code sample demonstrates how to create a JFrame object for each GraphicsConfiguration on each screen device in the GraphicsEnvironment:

 GraphicsEnvironment ge = GraphicsEnvironment. getLocalGraphicsEnvironment(); GraphicsDevice[] gs = ge.getScreenDevices(); for (int j = 0; j  @see GraphicsEnvironment @see GraphicsConfiguration @version 1.21 0225 12/0903/01

Class GraphicsEnvironment

The GraphicsEnvironment class describes the collection of GraphicsDevice objects and java.awt.Font objects available to a Java(tm) application on a particular platform. The resources in this GraphicsEnvironment might be local or on a remote machine. GraphicsDevice objects can be screens printers or image buffers and are the destination of Graphics2D drawing methods. Each GraphicsDevice has a number of GraphicsConfiguration objects associated with it. These objects specify the different configurations in which the GraphicsDevice can be used. @see GraphicsDevice @see GraphicsConfiguration @version 1.42 0251 12/0203/0001
Class GraphicsEnvironment, String[] getAvailableFontFamilyNames()

Returns an array containing the names of all font families available in this GraphicsEnvironment. Typical usage would be to allow a user to select a particular family name and allow the application to choose related variants of the same family when the user specifies style attributes such as Bold or Italic.

This method provides for the application some control over which Font instance is used to render text but allows the Font object more flexibility in choosing its own best match among multiple fonts in the same font family. @return an array of String containing names of font families. @see #getAllFonts @see java.awt.Font @see java.awt.Font#getFamily @since 1.2

Class GraphicsEnvironment, String[] getAvailableFontFamilyNames(Locale)

Returns an array containing the localized names of all font families available in this GraphicsEnvironment. Typical usage would be to allow a user to select a particular family name and allow the application to choose related variants of the same family when the user specifies style attributes such as Bold or Italic.

This method provides for the application some control over which Font instance used to render text but allows the Font object more flexibility in choosing its own best match among multiple fonts in the same font family. If l is null this method returns an array containing all font family names available in this GraphicsEnvironment. @param l a Locale object that represents a particular geographical political or cultural region @return an array of String objects containing names of font families specific to the specified Locale. @see #getAllFonts @see java.awt.Font @see java.awt.Font#getFamily @since 1.2

Class GraphicsEnvironment, GraphicsDevice getDefaultScreenDevice()

Returns the default screen GraphicsDevice. @return the GraphicsDevice that represents the default screen device. @exception HeadlessException if isHeadless() returns true @see isHeadless
Class GraphicsEnvironment, GraphicsDevice[] getScreenDevices()

Returns an array of all of the screen GraphicsDevice objects. @return an array containing all the GraphicsDevice objects that represent screen devices. @exception HeadlessException if isHeadless() returns true @see isHeadless

Class GridBagConstraints

The GridBagConstraints class specifies constraints for components that are laid out using the GridBagLayout class. @version 1.26 0229 12/0203/0001 @author Doug Stein @see java.awt.GridBagLayout @since JDK1.0
Class GridBagConstraints, int RELATIVE

SpecifySpecifies that this component is the next-to-last component in its column or row (gridwidth gridheight) or that this component be placed next to the previously added component (gridx gridy). @see java.awt.GridBagConstraints#gridwidth @see java.awt.GridBagConstraints#gridheight @see java.awt.GridBagConstraints#gridx @see java.awt.GridBagConstraints#gridy
Class GridBagConstraints, int REMAINDER

SpecifySpecifies that this component is the last component in its column or row.
Class GridBagConstraints, int anchor

This field is used when the component is smaller than its display area. It determines where within the display area to place the component. Possible

There are two kinds of possible values: relative and absolute. Relative values are interpreted relative to the container's component orientation property while absolute values are not. The absolute values are: CENTER NORTH NORTHEAST EAST SOUTHEAST SOUTH SOUTHWEST WEST and NORTHWEST. The relative values are: PAGE_START PAGE_END LINE_START LINE_END FIRST_LINE_START FIRST_LINE_END LAST_LINE_START and LAST_LINE_END. The default value is CENTER. @serial @see #clone() @see java.awt.ComponentOrientation

Class GridBagConstraints, int gridheight

Specifies the number of cells in a column for the component's display area.

Use REMAINDER to specify that the component be the last one in its column. Use RELATIVE to specify that the component be the next-to-last one in its column.

gridheight should be a non-negative value and the default value is 1. @serial @see #clone() @see java.awt.GridBagConstraints#gridwidth

Class GridBagConstraints, int gridwidth

Specifies the number of cells in a row for the component's display area.

Use REMAINDER to specify that the component be the last one in its row. Use RELATIVE to specify that the component be the next-to-last one in its row.

gridwidth should be non-negative and the default value is 1. @serial @see #clone() @see java.awt.GridBagConstraints#gridheight

Class GridBagConstraints, int gridx

Specifies the cell atcontaining the leftleading edge of the component's display area where the leftmostfirst cell in a row has gridx=0. The leading edge of a component's display area is its left edge for a horizontal left-to-right container and its right edge for a horizontal right-to-left container. The value RELATIVE specifies that the component be placed just to the rightimmediately offollowing the component that was added to the container just before this component was added.

The default value is RELATIVE. gridx should be a non-negative value. @serial @see #clone() @see java.awt.GridBagConstraints#gridy @see java.awt.ComponentOrientation

Class GridBagConstraints, int gridy

Specifies the cell at the top of the component's display area where the topmost cell has gridy=0. The value RELATIVE specifies that the component be placed just below the component that was added to the container just before this component was added.

The default value is RELATIVE. gridy should be a non-negative value. @serial @see #clone() @see java.awt.GridBagConstraints#gridx

Class GridBagConstraints, double weightx

Specifies how to distribute extra horizontal space.

The grid bag layout manager calculates the weight of a column to be the maximum weightx of all the components in a column. If the resulting layout is smaller horizontally than the area it needs to fill the extra space is distributed to each column in proportion to its weight. A column that has a weight of zero receives no extra space.

If all the weights are zero all the extra space appears between the grids of the cell and the left and right edges.

The default value of this field is 0. weightx should be a non-negative value. @serial @see #clone() @see java.awt.GridBagConstraints#weighty

Class GridBagConstraints, double weighty

Specifies how to distribute extra vertical space.

The grid bag layout manager calculates the weight of a row to be the maximum weighty of all the components in a row. If the resulting layout is smaller vertically than the area it needs to fill the extra space is distributed to each row in proportion to its weight. A row that has a weight of zero receives no extra space.

If all the weights are zero all the extra space appears between the grids of the cell and the top and bottom edges.

The default value of this field is 0. weighty should be a non-negative value. @serial @see #clone() @see java.awt.GridBagConstraints#weightx


Class GridBagLayout

The GridBagLayout class is a flexible layout manager that aligns components vertically and horizontally without requiring that the components be of the same size. Each GridBagLayout object maintains a dynamic rectangular grid of cells with each component occupying one or more cells called its display area.

Each component managed by a grid bag layoutGridBagLayout is associated with an instance of GridBagConstraints thatThe constraints object specifies where a component's display area should be located on the grid and how the component is laid outshould be positioned within its display area. In Howaddition ato its constraints object the GridBagLayout objectalso considers each component's minimum and preferred sizes in order to placesdetermine a setcomponent's size.

The overall orientation of componentsthe grid depends on the GridBagConstraintscontainer's objectComponentOrientation associatedproperty. with eachFor horizontal componentleft-to-right and onorientations grid coordinate (0 0) is in the minimum sizeupper left corner of the container with x increasing to the right and y increasing downward. For horizontal right-to-left orientations grid coordinate (0 0) is in the preferredupper sizeright corner of the components'container with x increasing to the left and containersy increasing downward.

To use a grid bag layout effectively you must customize one or more of the GridBagConstraints objects that are associated with its components. You customize a GridBagConstraints object by setting one or more of its instance variables:

{@link GridBagConstraints#gridx} GridBagConstraints#gridy
Specifies the cell atcontaining the upperleading leftcorner of the component's display area where the upper-left-most cell at the origin of the grid has address gridx = 0 gridy = 0. For horizontal left-to-right layout a component's leading corner is its upper left. For horizontal right-to-left layout a component's leading corner is its upper right. Use GridBagConstraints.RELATIVE (the default value) to specify that the component be just placed justimmediately tofollowing (along the right ofx axis (for gridx) or just belowthe y (axis for gridy) the component that was added to the container just before this component was added.
{@link GridBagConstraints#gridwidth} GridBagConstraints#gridheight
Specifies the number of cells in a row (for gridwidth) or column (for gridheight) in the component's display area. The default value is 1. Use GridBagConstraints.REMAINDER to specify that the component be the last one in its row (for gridwidth) or column (for gridheight). Use GridBagConstraints.RELATIVE to specify that the component be the next to last one in its row (for gridwidth) or column (for gridheight).
{@link GridBagConstraints#fill}
Used when the component's display area is larger than the component's requested size to determine whether (and how) to resize the component. Possible values are GridBagConstraints.NONE (the default) GridBagConstraints.HORIZONTAL (make the component wide enough to fill its display area horizontally but don't change its height) GridBagConstraints.VERTICAL (make the component tall enough to fill its display area vertically but don't change its width) and GridBagConstraints.BOTH (make the component fill its display area entirely).
{@link GridBagConstraints#ipadx} GridBagConstraints#ipady
Specifies the component's internal padding within the layout how much to add to the minimum size of the component. The width of the component will be at least its minimum width plus (ipadx * 2) pixels (since the padding applies to both sides of the component). Similarly the height of the component will be at least the minimum height plus (ipady * 2) pixels.
{@link GridBagConstraints#insets}
Specifies the component's external padding the minimum amount of space between the component and the edges of its display area.
{@link GridBagConstraints#anchor}
Used when the component is smaller than its display area to determine where (within the display area) to place the component. There are two kinds of possible values: relative and absolute. Relative values are interpreted relative to the container's ComponentOrientation property while absolute values are not. Valid values are:

Absolute Values Relative Values
  • GridBagConstraints.NORTH
  • GridBagConstraints.SOUTH
  • GridBagConstraints.WEST
  • GridBagConstraints.EAST
  • GridBagConstraints.NORTHWEST
  • GridBagConstraints.NORTHEAST
  • GridBagConstraints.SOUTHWEST
  • GridBagConstraints.SOUTHEAST
  • GridBagConstraints.CENTER (the default)
  • GridBagConstraints.NORTHPAGE_START
  • GridBagConstraints.NORTHEASTPAGE_END
  • GridBagConstraints.EASTLINE_START
  • GridBagConstraints.SOUTHEASTLINE_END
  • GridBagConstraints.SOUTHFIRST_LINE_START
  • GridBagConstraints.SOUTHWESTFIRST_LINE_END
  • GridBagConstraints.WESTLAST_LINE_START
  • and
  • GridBagConstraints.NORTHWESTLAST_LINE_END.
  • {@link GridBagConstraints#weightx} GridBagConstraints#weighty
    Used to determine how to distribute space which is important for specifying resizing behavior. Unless you specify a weight for at least one component in a row (weightx) and column (weighty) all the components clump together in the center of their container. This is because when the weight is zero (the default) the GridBagLayout object puts any extra space between its grid of cells and the edges of the container.

    The following figure showsfigures show ten components (all buttons) managed by a grid bag layout:. Figure 1 shows the layout for a horizontal left-to-right container and Figure 2 shows the layout for a horizontal right-to-left container.

    Figure 1: Horizontal Left-to-Right Figure 2: Horizontal Right-to-Left

    Each of the ten components has the fill field of its associated GridBagConstraints object set to GridBagConstraints.BOTH. In addition the components have the following non-default constraints:

    Here is the code that implements the example shown above:


     import java.awt.*; import java.util.*; import java.applet.Applet; public class GridBagEx1 extends Applet { protected void makebutton(String name GridBagLayout gridbag GridBagConstraints c) { Button button = new Button(name); gridbag.setConstraints(button c); add(button); } public void init() { GridBagLayout gridbag = new GridBagLayout(); GridBagConstraints c = new GridBagConstraints(); setFont(new Font("Helvetica" Font.PLAIN 14)); setLayout(gridbag); c.fill = GridBagConstraints.BOTH; c.weightx = 1.0; makebutton("Button1" gridbag c); makebutton("Button2" gridbag c); makebutton("Button3" gridbag c); c.gridwidth = GridBagConstraints.REMAINDER; //end row makebutton("Button4" gridbag c); c.weightx = 0.0; //reset to the default makebutton("Button5" gridbag c); //another row c.gridwidth = GridBagConstraints.RELATIVE; //next-to-last in row makebutton("Button6" gridbag c); c.gridwidth = GridBagConstraints.REMAINDER; //end row makebutton("Button7" gridbag c); c.gridwidth = 1; //reset to the default c.gridheight = 2; c.weighty = 1.0; makebutton("Button8" gridbag c); c.weighty = 0.0; //reset to the default c.gridwidth = GridBagConstraints.REMAINDER; //end row c.gridheight = 1; //reset to the default makebutton("Button9" gridbag c); makebutton("Button10" gridbag c); setSize(300 100); } public static void main(String args[]) { Frame f = new Frame("GridBag Layout Example"); GridBagEx1 ex1 = new GridBagEx1(); ex1.init(); f.add("Center" ex1); f.pack(); f.setSize(f.getPreferredSize()); f.show(); } } 

    @version 1.5 16 Nov 1995 @author Doug Stein @see java.awt.GridBagConstraints @see java.awt.ComponentOrientation @since JDK1.0

    Class GridBagLayout, GridBagLayoutInfo GetLayoutInfo(Container, int)

    Print the layoutThis method is constraints. Usefulsupplied for debuggingbackwards compatability only; new code should call getLayoutInfo() instead. @see getLayoutInfo
    Class GridBagLayout, void addLayoutComponent(Component, Object)

    Adds the specified component to the layout using the specified constraintconstraints object. Note that constraints are mutable and are therefore cloned when cached. @param comp the component to be added. @param constraints an object that determines how the component is added to the layout. @exception IllegalArgumentException if constraints is not a GridBagConstraint
    Class GridBagLayout, void addLayoutComponent(String, Component)

    Adds the specified component with the specified name to the layout. @param name the name of the component. @param comp the component to be added.
    Class GridBagLayout, GridBagConstraints getConstraints(Component)

    Gets the constraints for the specified component. A copy of the actual GridBagConstraints object is returned. @param comp the component to be queried. @return the constraint for the specified component in this grid bag layout; a copy of the actual constraint object is returned.
    Class GridBagLayout, int[][] getLayoutDimensions()

    Determines column widths and row heights for the layout grid.

    Most applications do not call this method directly. @return an array of two arrays containing the widths of the layout columns and the heights of the layout rows. @since JDK1.1

    Class GridBagLayout, Point getLayoutOrigin()

    Determines the origin of the layout area in the graphics coordinate space of the target container. This value represents the pixel coordinates of the top-left corner of the layout area regardless of the ComponentOrientation value of the container. This is distinct from the grid origin given by the cell coordinates (0 0). Most applications do not call this method directly. @return the graphics origin of the cell in the top-left corner of the layout grid @see java.awt.ComponentOrientation @since JDK1.1
    Class GridBagLayout, double[][] getLayoutWeights()

    Determines the weights of the layout grid's columns and rows. Weights are used to calculate how much a given column or row stretches beyond its preferred size if the layout has extra room to fill.

    Most applications do not call this method directly. @return an array of two arrays representing the horizontal weights of the layout columns and the vertical weights of the layout rows. @since JDK1.1

    Class GridBagLayout, Point location(int, int)

    Determines which cell in the layout grid contains the point specified by (x  y). Each cell is identified by its column index (ranging from 0 to the number of columns minus 1) and its row index (ranging from 0 to the number of rows minus 1).

    If the (x  y) point lies outside the grid the following rules are used. The column index is returned as zero if x lies to the left of the layout andfor a left-to-right container or to the right of the layout for a right-to-left container. The column index is returned as the number of columns if x lies to the right of the layout in a left-to-right container or to the left in a right-to-left container. The row index is returned as zero if y lies above the layout and as the number of rows if y lies below the layout. The orientation of a container is determined by its ComponentOrientation property. @param x the x coordinate of a point. @param y the y coordinate of a point. @return an ordered pair of indexes that indicate which cell in the layout grid contains the point (x  y). @see java.awt.ComponentOrientation @since JDK1.1

    Class GridBagLayout, GridBagConstraints lookupConstraints(Component)

    Retrieves the constraints for the specified component. The return value is not a copy but is the actual GridBagConstraints object used by the layout mechanism. @param comp the component to be queried @return the contraints for the specified componentcomponen.
    Class GridBagLayout, void setConstraints(Component, GridBagConstraints)

    Sets the constraints for the specified component in this layout. @param comp the component to be modified. @param constraints the constraints to be applied.
    Class GridBagLayout, double[] columnWeights

    This field holds the overrides to the column weights. If this field is non-null the values are applied to the gridbag after all of the columns weights have been calculated. If columnWeights[i] > weight for column i then column i is assigned the weight in columnWeights[i]. If columnWeights has more elements than the number of columns the excess elements are ignored - they do not cause more columns to be created. @serial
    Class GridBagLayout, int[] columnWidths

    This field holds the overrides to the column minimum width. If this field is non-null the values are applied to the gridbag after all of the minimum columns widths have been calculated. If columnWidths has more elements than the number of columns columns are added to the gridbag to match the number of elements in columnWidth. @serial @see #getLayoutDimensions()
    Class GridBagLayout, Hashtable comptable

    This hashtable maintains the association between a component and its gridbag constraints. The Keys in comptable are the components and the values are the instances of GridBagConstraints. @serial @see java.awt.GridBagConstraints
    Class GridBagLayout, GridBagLayoutInfo layoutInfo

    This field holds thathe layout information for the gridbag. The information in this field is based on the most recent validation of the gridbag. If layoutInfo is null this indicates that there are no components in the gridbag or if there are components they have not yet been validated. @serial @see #GetLayoutInfogetLayoutInfo(Container int)
    Class GridBagLayout, int[] rowHeights

    This field holds the overrides to the row minimum heights. If this field is non-null the values are applied to the gridbag after all of the minimum row heights have been calculated. If rowHeights has more elements than the number of rows rowa are added to the gridbag to match the number of elements in rowHeights. @serial @see #getLayoutDimensions()
    Class GridBagLayout, double[] rowWeights

    This field holds the overrides to the row weights. If this field is non-null the values are applied to the gridbag after all of the rows weights have been calculated. If rowWeights[i] > weight for row i then row i is assigned the weight in rowWeights[i]. If rowWeights has more elements than the number of rows the excess elements are ignored - they do not cause more rows to be created. @serial

    Class GridLayout

    The GridLayout class is a layout manager that lays out a container's components in a rectangular grid. The container is divided into equal-sized rectangles and one component is placed in each rectangle. For example the following is an applet that lays out six buttons into three rows and two columns:


     import java.awt.*; import java.applet.Applet; public class ButtonGrid extends Applet { public void init() { setLayout(new GridLayout(3 2)); add(new Button("1")); add(new Button("2")); add(new Button("3")); add(new Button("4")); add(new Button("5")); add(new Button("6")); } } 

    ItIf the container's ComponentOrientation property is horizontal and left-to-right the above example produces the followingoutput shown in Figure 1. If the container's ComponentOrientation property is horizontal and right-to-left the example produces the output: shown in Figure 2.

    Figure 1: Horizontal Left-to-Right Figure 2: Horizontal Right-to-Left

    When both the number of rows and the number of columns have been set to non-zero values either by a constructor or by the setRows and setColumns methods the number of columns specified is ignored. Instead the number of columns is determined from the specified number or rows and the total number of components in the layout. So for example if three rows and two columns have been specified and nine components are added to the layout then they will be displayed as three rows of three columns. Specifying the number of columns affects the layout only when the number of rows is set to zero. @version 1.28 0231 12/0203/0001 @author Arthur van Hoff @since JDK1.0

    Class GridLayout, constructor GridLayout(int, int, int, int)

    Creates a grid layout with the specified number of rows and columns. All components in the layout are given equal size.

    In addition the horizontal and vertical gaps are set to the specified values. Horizontal gaps are placed at the left and right edges and between each of the columns. Vertical gaps are placed at the top and bottom edges and between each of the rows.

    One but not both of rows and cols can be zero which means that any number of objects can be placed in a row or in a column.

    All GridLayout constructors defer to this one. @param rows the rows with the value zero meaning any number of rows. @param cols the columns with the value zero meaning any number of columns. @param hgap the horizontal gap. @param vgap the vertical gap. @exception IllegalArgumentException if the value of both rows orand cols is invalid.set to zero

    Class GridLayout, void addLayoutComponent(String, Component)

    Adds the specified component with the specified name to the layout. @param name the name of the component. @param comp the component to be added.
    Class GridLayout, int getColumns()

    Gets the number of columns in this layout. @return the number of columns in this layout. @since JDK1.1
    Class GridLayout, int getHgap()

    Gets the horizontal gap between components. @return the horizontal gap between components. @since JDK1.1
    Class GridLayout, int getRows()

    Gets the number of rows in this layout. @return the number of rows in this layout. @since JDK1.1
    Class GridLayout, int getVgap()

    Gets the vertical gap between components. @return the vertical gap between components. @since JDK1.1
    Class GridLayout, void layoutContainer(Container)

    Lays out the specified container using this layout.

    This method reshapes the components in the specified target container in order to satisfy the constraints of the GridLayout object.

    The grid layout manager determines the size of individual components by dividing the free space in the container into equal-sized portions according to the number of rows and columns in the layout. The container's free space equals the container's size minus any insets and any specified horizontal or vertical gap. All components in a grid layout are given the same size. @param target the container in which to do the layout. @see java.awt.Container @see java.awt.Container#doLayout

    Class GridLayout, Dimension minimumLayoutSize(Container)

    Determines the minimum size of the container argument using this grid layout.

    The minimum width of a grid layout is the largest minimum width of any of the widths in the container times the number of columns plus the horizontal padding times the number of columns plus one plus the left and right insets of the target container.

    The minimum height of a grid layout is the largest minimum height of any of the heights in the container times the number of rows plus the vertical padding times the number of rows plus one plus the top and bottom insets of the target container. @param target the container in which to do the layout. @return the minimum dimensions needed to lay out the subcomponents of the specified container. @see java.awt.GridLayout#preferredLayoutSize @see java.awt.Container#doLayout

    Class GridLayout, Dimension preferredLayoutSize(Container)

    Determines the preferred size of the container argument using this grid layout.

    The preferred width of a grid layout is the largest preferred width of any of the widths in the container times the number of columns plus the horizontal padding times the number of columns plus one plus the left and right insets of the target container.

    The preferred height of a grid layout is the largest preferred height of any of the heights in the container times the number of rows plus the vertical padding times the number of rows plus one plus the top and bottom insets of the target container. @param target the container in which to do the layout. @return the preferred dimensions to lay out the subcomponents of the specified container. @see java.awt.GridLayout#minimumLayoutSize @see java.awt.Container#getPreferredSize()

    Class GridLayout, void removeLayoutComponent(Component)

    Removes the specified component from the layout. @param comp the component to be removed.
    Class GridLayout, void setColumns(int)

    Sets the number of columns in this layout to the specified value. Setting the number of columns has no affect on the layout if the number of rows specified by a constructor or by the setRows method is non-zero. In that case the number of columns displayed in the layout is determined by the total number of components and the number of rows specified. @param cols the number of columns in this layout. @exception IllegalArgumentException if the value of both rows and cols is set to zero. @since JDK1.1
    Class GridLayout, void setHgap(int)

    Sets the horizontal gap between components to the specified value. @param hgap the horizontal gap between components. @since JDK1.1
    Class GridLayout, void setRows(int)

    Sets the number of rows in this layout to the specified value. @param rows the number of rows in this layout. @exception IllegalArgumentException if the value of both rows and cols is set to zero. @since JDK1.1
    Class GridLayout, void setVgap(int)

    Sets the vertical gap between components to the specified value. @param vgap the vertical gap between components. @since JDK1.1
    Class GridLayout, String toString()

    Returns the string representation of this grid layout's values. @return a string representation of this grid layout.

    Class IllegalComponentStateException

    Signals that an AWT component is not in an appropriate state for the requested operation. @version 1.9 0210 12/0203/0001 @author Jonni Kanerva

    Class Image

    The abstract class Image is the superclass of all classes that represent graphical images. The image must be obtained in a platform-specific manner. @version 1.31 0232 12/0203/0001 @author Sami Shaio @author Arthur van Hoff @since JDK1.0

    Class Insets

    An Insets object is a representation of the borders of a container. It specifies the space that a container must leave at each of its edges. The space can be a border a blank space or a title. @version 1.25 0227 12/0203/0001 @author Arthur van Hoff @author Sami Shaio @see java.awt.LayoutManager @see java.awt.Container @since JDK1.0

    Class ItemSelectable

    The interface for objects which contain a set of items for which zero or more can be selected. @version 1.11 0214 12/0203/0001 @author Amy Fowler
    Class ItemSelectable, void addItemListener(ItemListener)

    AddAdds a listener to recievereceive item events when the state of an item changesis changed by the user. Item events are not sent when an item's state is set programmatically. If l is null no exception is thrown and no action is performed. @param l the listener to recievereceive events @see ItemEvent
    Class ItemSelectable, Object[] getSelectedObjects()

    Returns the selected items or null if no items are selected.
    Class ItemSelectable, void removeItemListener(ItemListener)

    Removes an item listener. If l is null no exception is thrown and no action is performed. @param l the listener being removed @see ItemEvent

    Class JobAttributes

    A set of attributes which control a print job.

    Instances of this class control the number of copies default selection destination print dialog file and printer names page ranges multiple document handling (including collation) and multi-page imposition (such as duplex) of every print job which uses the instance. Attribute names are compliant with the Internet Printing Protocol (IPP) 1.1 where possible. Attribute values are partially compliant where possible.

    To use a method which takes an inner class type pass a reference to one of the constant fields of the inner class. Client code cannot create new instances of the inner class types because none of those classes has a public constructor. For example to set the print dialog type to the cross-platform pure Java print dialog use the following code:

     import java.awt.JobAttributes; public class PureJavaPrintDialogExample { public void setPureJavaPrintDialog(JobAttributes jobAttributes) { jobAttributes.setDialog(JobAttributes.DialogType.COMMON); } } 

    Every IPP attribute which supports an attributeName-default value has a corresponding setattributeNameToDefault method. Default value fields are not provided. @version 1.4 026 12/0203/0001 @author David Mendenhall


    Class JobAttributes.DefaultSelectionType, DefaultSelectionType ALL

    The DefaultSelectionType instance to use for specifying that all pages of the job should be printed.
    Class JobAttributes.DefaultSelectionType, DefaultSelectionType RANGE

    The DefaultSelectionType instance to use for specifying that a range of pages of the job should be printed.
    Class JobAttributes.DefaultSelectionType, DefaultSelectionType SELECTION

    The DefaultSelectionType instance to use for specifying that the current selection should be printed.

    Class JobAttributes.DestinationType, DestinationType FILE

    The DestinationType instance to use for specifying print to file.
    Class JobAttributes.DestinationType, DestinationType PRINTER

    The DestinationType instance to use for specifying print to printer.

    Class JobAttributes.DialogType, DialogType COMMON

    The DialogType instance to use for specifying the cross-platform pure Java print dialog.
    Class JobAttributes.DialogType, DialogType NATIVE

    The DialogType instance to use for specifying the platform's native print dialog.
    Class JobAttributes.DialogType, DialogType NONE

    The DialogType instance to use for specifying no print dialog.

    Class JobAttributes.MultipleDocumentHandlingType, MultipleDocumentHandlingType SEPARATE_DOCUMENTS_COLLATED_COPIES

    The MultipleDocumentHandlingType instance to use for specifying that the job should be divided into separate collated documents.
    Class JobAttributes.MultipleDocumentHandlingType, MultipleDocumentHandlingType SEPARATE_DOCUMENTS_UNCOLLATED_COPIES

    The MultipleDocumentHandlingType instance to use for specifying that the job should be divided into separate uncollated documents.

    Class JobAttributes.SidesType, SidesType ONE_SIDED

    The SidesType instance to use for specifying that consecutive job pages should be printed upon the same side of consecutive media sheets.
    Class JobAttributes.SidesType, SidesType TWO_SIDED_LONG_EDGE

    The SidesType instance to use for specifying that consecutive job pages should be printed upon front and back sides of consecutive media sheets such that the orientation of each pair of pages on the medium would be correct for the reader as if for binding on the long edge.
    Class JobAttributes.SidesType, SidesType TWO_SIDED_SHORT_EDGE

    The SidesType instance to use for specifying that consecutive job pages should be printed upon front and back sides of consecutive media sheets such that the orientation of each pair of pages on the medium would be correct for the reader as if for binding on the short edge.

    Class JobAttributes, constructor JobAttributes()

    Constructs a JobAttributes instance with default values for every attribute. The dialog defaults to DialogType.NATIVE. Min page defaults to 1. Max page defaults to Integer.MAX_VALUE. Destination defaults to DestinationType.PRINTER. Selection defaults to DefaultSelectionType.ALL. Number of copies defaults to 1. Multiple document handling defaults to MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_UNCOLLATED_COPIES. Sides defaults to SidesType.ONE_SIDED. File name defaults to null.
    Class JobAttributes, constructor JobAttributes(JobAttributes)

    Constructs a JobAttributes instance which is a copy of the supplied JobAttributes. @param obj the JobAttributes to copy.
    Class JobAttributes, constructor JobAttributes(int, DefaultSelectionType, DestinationType, DialogType, String, int, int, MultipleDocumentHandlingType, int[][], String, SidesType)

    Constructs a JobAttributes instance with the specified values for every attribute. @param copies an integer greater than 0. @param defaultSelection DefaultSelectionType.ALL DefaultSelectionType.RANGE or DefaultSelectionType.SELECTION. @param destination DesintationType.FILE or DesintationType.PRINTER. @param dialog DialogType.COMMON DialogType.NATIVE or DialogType.NONE. @param fileName the possibly null file name. @param maxPage an integer greater than zero and greater than or equal to minPage. @param minPage an integer greater than zero and less than or equal to maxPage. @param multipleDocumentHandling MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_COLLATED_COPIES or MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_UNCOLLATED_COPIES. @param pageRanges an array of integer arrays of 2two elements. An; an array is interpreted as a range spanning all pages including and between the specified pages.; Rangesranges must be in ascending order and must not overlap.; Specifiedspecified page numbers cannot be less than minPage nor greater than maxPage.; Forfor example:
     (new int[][] { new int[] { 1 3 } new int[] { 5 5 } new int[] { 15 19 } }) 
    specifies pages 1 2 3 5 15 16 17 18 and 19. Note that (new int[][] { new int[] { 1 1 } new int[] { 1 2 } }) is an invalid set of page ranges because the two ranges overlap. @param printer the possibly null printer name. @param sides SidesType.ONE_SIDED SidesType.TWO_SIDED_LONG_EDGE or SidesType.TWO_SIDED_SHORT_EDGE. @throws IllegalArgumentException if one or more of the above conditions is violated.
    Class JobAttributes, Object clone()

    Creates and returns a copy of this JobAttributes. @return the newly created copy. It; it is safe to cast this Object into a JobAttributes.
    Class JobAttributes, DefaultSelectionType getDefaultSelection()

    Specifies whether for jobs using these attributes the application should print all pages the range specified by the return value of getPageRanges or the current selection. This attribute is updated to the value chosen by the user. @return DefaultSelectionType.ALL DefaultSelectionType.RANGE or DefaultSelectionType.SELECTION.
    Class JobAttributes, DestinationType getDestination()

    Specifies whether output will be to a printer or a file for jobs using these attributes. This attribute is updated to the value chosen by the user. @return DesintationType.FILE or DesintationType.PRINTER.
    Class JobAttributes, DialogType getDialog()

    Returns whether for jobs using these attributes the user should see a print dialog in which to modify the print settings and which type of print dialog should be displayed. DialogType.COMMON denotes a cross- platform pure Java print dialog. DialogType.NATIVE denotes the platform's native print dialog. If a platform does not support a native print dialog the pure Java print dialog is displayed instead. DialogType.NONE specifies no print dialog (i.e. background printing). This attribute cannot be modified by and is not subject to any limitations of the implementation or the target printer. @return DialogType.COMMON DialogType.NATIVE or DialogType.NONE.
    Class JobAttributes, String getFileName()

    Specifies the file name for the output file for jobs using these attributes. This attribute is updated to the value chosen by the user. @return the possibly null file name.
    Class JobAttributes, void set(JobAttributes)

    Sets all of the attributes of this JobAttributes to the same values as the attributes of obj. @param obj the JobAttributes to copy.
    Class JobAttributes, void setCopies(int)

    Specifies the number of copies the application should render for jobs using these attributes. Not specifying this attribute is equivalent to specifying 1. @param copies an integer greater than 0. @throws IllegalArgumentException if copies is less than or equal to 0.
    Class JobAttributes, void setDefaultSelection(DefaultSelectionType)

    Specifies whether for jobs using these attributes the application should print all pages the range specified by the return value of getPageRanges or the current selection. Not specifying this attribute is equivalent to specifying DefaultSelectionType.ALL. @param defaultSelection DefaultSelectionType.ALL DefaultSelectionType.RANGE or DefaultSelectionType.SELECTION. @throws IllegalArgumentException if defaultSelection is null.
    Class JobAttributes, void setMaxPage(int)

    Specifies the maximum value the user can specify as the last page to be printed for jobs using these attributes. Not specifying this attribute is equivalent to specifying Integer.MAX_VALUE. @param maxPage an integer greater than zero and greater than or equal to minPage. @throws IllegalArgumentException if one or more of the above conditions is violated.

    Class Label

    A Label object is a component for placing text in a container. A label displays a single line of read-only text. The text can be changed by the application but a user cannot edit it directly.

    For example the code . . .


     setLayout(new FlowLayout(FlowLayout.CENTER 10 10)); add(new Label("Hi There ")); add(new Label("Another Label")); 

    produces the following label:

    @version 1.47 0452 12/0603/0001 @author Sami Shaio @since JDK1.0

    Class Label, constructor Label()

    Constructs an empty label. The text of the label is the empty string "". @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true. @see java.awt.GraphicsEnvironment#isHeadless
    Class Label, constructor Label(String)

    Constructs a new label with the specified string of text left justified. @param text the string that the label presents. A null value will be accepted without causing a NullPointerException to be thrown. @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true. @see java.awt.GraphicsEnvironment#isHeadless
    Class Label, constructor Label(String, int)

    Constructs a new label that presents the specified string of text with the specified alignment. Possible values for alignment are Label.LEFT Label.RIGHT and Label.CENTER. @param text the string that the label presents. A null value will be accepted without causing a NullPointerException to be thrown. @param alignment the alignment value. @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true. @see java.awt.GraphicsEnvironment#isHeadless
    Class Label, String paramString()

    Returns the parametera string representing the state of this labelLabel. This stringmethod is usefulintended to be used only for debugging purposes and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null. @return the parameter string of this label.

    Class LayoutManager

    Defines the interface for classes that know how to layoutlay Containersout Containers. @see Container @version 1.21 0223 12/0203/0001 @author Sami Shaio @author Arthur van Hoff
    Class LayoutManager, void addLayoutComponent(String, Component)

    AddsIf the specifiedlayout manager uses a per-component withstring adds the specifiedcomponent namecomp to the layout associating it with the string specified by name. @param name the componentstring nameto be associated with the component @param comp the component to be added
    Class LayoutManager, void layoutContainer(Container)

    Lays out the container in the specified panelcontainer. @param parent the component which needscontainer to be laid out
    Class LayoutManager, Dimension minimumLayoutSize(Container)

    Calculates the minimum size dimensions for the specified panelcontainer given the components in the specified parentit containercontains. @param parent the component to be laid out @see #preferredLayoutSize
    Class LayoutManager, Dimension preferredLayoutSize(Container)

    Calculates the preferred size dimensions for the specified panelcontainer given the components in the specified parentit containercontains. @param parent the componentcontainer to be laid out @see #minimumLayoutSize

    Class LayoutManager2

    Defines an interface for classes that know how to layout Containers based on a layout constraints object. This interface extends the LayoutManager interface to deal with layouts explicitly in terms of constraint objects that specify how and where components should be added to the layout.

    This minimal extension to LayoutManager is intended for tool providers who wish to the creation of constraint-based layouts. It does not yet provide full general support for custom constraint-based layout managers. @see LayoutManager @see Container @version 1.10 0212 12/0203/0001 @author Jonni Kanerva

    Class LayoutManager2, Dimension maximumLayoutSize(Container)

    ReturnsCalculates the maximum size ofdimensions thisfor component.the @seespecified java.awtcontainer given the components it contains.Component#getMinimumSize() @see java.awt.Component#getPreferredSize()getMaximumSize @see LayoutManager

    Class List

    The List component presents the user with a scrolling list of text items. The list can be set up so that the user can choose either one item or multiple items.

    For example the code . . .


     List lst = new List(4 false); lst.add("Mercury"); lst.add("Venus"); lst.add("Earth"); lst.add("JavaSoft"); lst.add("Mars"); lst.add("Jupiter"); lst.add("Saturn"); lst.add("Uranus"); lst.add("Neptune"); lst.add("Pluto"); cnt.add(lst); 

    where cnt is a container produces the following scrolling list:

    Clicking on an item that isn't selected selects it. Clicking on an item that is already selected deselects it. In the preceding example only one item from the scrolling list can be selected at a time since the second argument when creating the new scrolling list is false. Selecting an item causes any other selected item to be automatically deselected.

    Note that the list in the example shown was created with four visible rows. Once the list has been created the number of visible rows cannot be changed. A default List is created with four rows so that lst = new List() is equivalent to list = new List(4 false).

    Beginning with Java 1.1 the Abstract Window Toolkit sends the List object all mouse keyboard and focus events that occur over it. (The old AWT event model is being maintained only for backwards compatibility and its use is discouraged.)

    When an item is selected or deselected by the user AWT sends an instance of ItemEvent to the list. When the user double-clicks on an item in a scrolling list AWT sends an instance of ActionEvent to the list following the item event. AWT also generates an action event when the user presses the return key while an item in the list is selected.

    If an application wants to perform some action based on an item in this list being selected or activated by the user it should implement ItemListener or ActionListener as appropriate and register the new listener to receive events from this list.

    For multiple-selection scrolling lists it is considered a better user interface to use an external gesture (such as clicking on a button) to trigger the action. @version 1.78 0491 12/0603/0001 @author Sami Shaio @see java.awt.event.ItemEvent @see java.awt.event.ItemListener @see java.awt.event.ActionEvent @see java.awt.event.ActionListener @since JDK1.0


    Class List.AccessibleAWTList.AccessibleAWTListChild, Accessible getAccessibleAt(Point)

    Returns the Accessible child if one exists contained at the local coordinate Point. @param p Thethe point relative to the coordinate system of this object. @return the Accessible if it exists at the specified location; otherwise null
    Class List.AccessibleAWTList.AccessibleAWTListChild, boolean isFocusTraversable()

    Returns whether this object can accept focus or not. Objects that can accept focus will also have the AccessibleState.FOCUSABLE state set in their AccessibleStateSet. @return true if object can accept focus; otherwise false @see AccessibleContext#getAccessibleStateSet @see AccessibleState#FOCUSABLE @see AccessibleState#FOCUSED @see AccessibleStateSet

    Class List, constructor List()

    Creates a new scrolling list. By default there are four visible lines and multiple selections are not allowed. Note that this is a convenience method for List(0 false). Also note that the number of visible lines in the list cannot be changed after it has been created. @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true. @see java.awt.GraphicsEnvironment#isHeadless
    Class List, constructor List(int)

    Creates a new scrolling list initialized with the specified number of visible lines. By default multiple selections are not allowed. Note that this is a convenience method for List(rows false). Also note that the number of visible rows in the list cannot be changed after it has been created. @param rows the number of items to show. @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true. @see java.awt.GraphicsEnvironment#isHeadless @since JDK1.1
    Class List, constructor List(int, boolean)

    Creates a new scrolling list initialized to display the specified number of rows. Note that if zero rows are specified then the list will be created with a default of four rows. Also note that the number of visible rows in the list cannot be changed after it has been created. If the value of multipleMode is true then the user can select multiple items from the list. If it is false only one item at a time can be selected. @param rows the number of items to show. @param multipleMode if true then multiple selections are allowed; otherwise only one item can be selected at a time. @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true. @see java.awt.GraphicsEnvironment#isHeadless
    Class List, void add(String)

    Adds the specified item to the end of scrolling list. @param item the item to be added. @since JDK1.1
    Class List, void add(String, int)

    Adds the specified item to the the scrolling list at the position indicated by the index. The index is zero-based. If the value of the index is less than zero or if the value of the index is greater than or equal to the number of items in the list then the item is added to the end of the list. @param item the item to be added. If; if this parameter is null then the item is treated as an empty string "". @param index the position at which to add the item. @since JDK1.1
    Class List, void addActionListener(ActionListener)

    Adds the specified action listener to receive action events from this list. Action events occur when a user double-clicks on a list item. If listener l is null no exception is thrown and no action is performed. @param l the action listener. @see java.awt.event.ActionEvent#removeActionListener @see #getActionListeners @see java.awt.event.ActionListenerActionEvent @see java.awt.List#removeActionListenerevent.ActionListener @since JDK1.1
    Class List, void addItemListener(ItemListener)

    Adds the specified item listener to receive item events from this list. Item events are sent in response to user input but not in response to calls to select or deselect. If listener l is null no exception is thrown and no action is performed. @param l the item listener. @see java.awt.event.ItemEvent#removeItemListener @see #getItemListeners @see #select @see #deselect @see java.awt.event.ItemListenerItemEvent @see java.awt.List#removeItemListenerevent.ItemListener @since JDK1.1
    Class List, void deselect(int)

    Deselects the item at the specified index.

    If the item at the specified index is not selected or if the index is out of range then the operation is ignored. @param index the position of the item to deselect. @see java.awt.List#select @see java.awt.List#getSelectedItem @see java.awt.List#isIndexSelected

    Class List, AccessibleContext getAccessibleContext()

    Gets the AccessibleContext associated with this List. For lists the AccessibleContext takes the form of an AccessibleAWTList. A new AccessibleAWTList instance is created if necessary. @return an AccessibleAWTList that serves as the AccessibleContext of this List
    Class List, String getItem(int)

    Gets the item associated with the specified index. @return an item that is associated with the specified index. @param index the position of the item. @see java.awt.List#getItemCount
    Class List, int getItemCount()

    Gets the number of items in the list. @return the number of items in the list. @see java.awt.List#getItem @since JDK1.1
    Class List, String[] getItems()

    Gets the items in the list. @return a string array containing items of the list. @see java.awt.List#select @see java.awt.List#deselect @see java.awt.List#isIndexSelected @since JDK1.1
    Class List, EventListener[] getListeners(Class)

    ReturnReturns an array of all the listenersobjects that were addedcurrently registered as toFooListeners the Listupon this withList. addXXXListener()FooListeners where XXX isare registered using the nameaddFooListener ofmethod.

    You can specify the listenerType argument. For example to get all ofwith a class literal such as theFooListener.class. ItemListener(s)For forexample theyou can givenquery a List l onefor its item wouldlisteners with the writefollowing code:

     ItemListener[] ils = (ItemListener[])(l.getListeners(ItemListener.class)) ;
    If no such listenerlisteners exist list exists thenthis method returns an empty array is returned. @param listenerType Typethe type of listeners requested; this parameter should specify an interface that descends from java.util.EventListener @return allan array of theall objects registered as FooListeners on this list or an empty array if no such listeners of the specifiedhave been added type@exception supported byClassCastException if thislistenerType
    listdoesn't specify a class or interface that implements java.util.EventListener @see #getItemListeners @since 1.3
    Class List, Dimension getMinimumSize()

    Determines the minimum size of this scrolling list. @return the minimum dimensions needed to display this scrolling list. @see java.awt.Component#getMinimumSize() @since JDK1.1
    Class List, Dimension getMinimumSize(int)

    Gets the minumum dimensions for a list with the specified number of rows. @param rows number of rows in the list. @return the minimum dimensions for displaying this scrolling list given that the specified number of rows must be visible. @see java.awt.Component#getMinimumSize @since JDK1.1
    Class List, Dimension getPreferredSize()

    Gets the preferred size of this scrolling list. @return the preferred dimensions for displaying this scrolling list. @see java.awt.Component#getPreferredSize @since JDK1.1
    Class List, Dimension getPreferredSize(int)

    Gets the preferred dimensions for a list with the specified number of rows. @param rows number of rows in the list. @return the preferred dimensions for displaying this scrolling list given that the specified number of rows must be visible. @see java.awt.Component#getPreferredSize @since JDK1.1
    Class List, int getRows()

    GetGets the number of visible lines in this list. Note that once the List has been created this number will never change. @return the number of visible lines in this scrolling list.
    Class List, int getSelectedIndex()

    Gets the index of the selected item on the list @return the index of the selected item or -1 if no item is selected or if more that one item is selected. @see java.awt.List#select @see java.awt.List#deselect @see java.awt.List#isIndexSelected
    Class List, int[] getSelectedIndexes()

    Gets the selected indexes on the list. @return an array of the selected indexes of this scrolling list. If; if no items are selected a zero-length array is returned. @see java.awt.List#select @see java.awt.List#deselect @see java.awt.List#isIndexSelected
    Class List, String getSelectedItem()

    GetGets the selected item on this scrolling list. @return the selected item on the list or null if no item is selected. @see java.awt.List#select @see java.awt.List#deselect @see java.awt.List#isIndexSelected
    Class List, String[] getSelectedItems()

    GetGets the selected items on this scrolling list. @return an array of the selected items on this scrolling list. @see java.awt.List#select @see java.awt.List#deselect @see java.awt.List#isIndexSelected
    Class List, Object[] getSelectedObjects()

    Returns the selected items on the list in an array of Objectsobjects. @see ItemSelectable
    Class List, int getVisibleIndex()

    Gets the index of the item that was last made visible by the method makeVisible. @return the index of the item that was last made visible. @see java.awt.List#makeVisible
    Class List, boolean isIndexSelected(int)

    Determines if the specified item in this scrolling list is selected. @param index the item to be checked. @return true if the specified item has been selected; false otherwise. @see java.awt.List#select @see java.awt.List#deselect @since JDK1.1
    Class List, boolean isMultipleMode()

    Determines whether this list allows multiple selections. @return true if this list allows multiple selections; otherwise false. @see java.awt.List#setMultipleMode @since JDK1.1
    Class List, void makeVisible(int)

    Makes the item at the specified index visible. @param index the position of the item. @see java.awt.List#getVisibleIndex
    Class List, String paramString()

    Returns the parameter string representing the state of this scrolling list. This string is useful for debugging. @return the parameter string of this scrolling list.
    Class List, void processActionEvent(ActionEvent)

    Processes action events occurring on this component by dispatching them to any registered ActionListener objects.

    This method is not called unless action events are enabled for this component. Action events are enabled when one of the following occurs:

    Note that if the event parameter is null the behavior is unspecified and may result in an exception. @param e the action event. @see java.awt.event.ActionEvent @see java.awt.event.ActionListener @see java.awt.List#addActionListener @see java.awt.Component#enableEvents @since JDK1.1

    Class List, void processEvent(AWTEvent)

    Processes events on this scrolling list. If an event is an instance of ItemEvent it invokes the processItemEvent method. Else if the event is an instance of ActionEvent it invokes processActionEvent. If the event is not an item event or an action event it invokes processEvent on the superclass.

    Note that if the event parameter is null the behavior is unspecified and may result in an exception. @param e the event. @see java.awt.event.ActionEvent @see java.awt.event.ItemEvent @see java.awt.List#processActionEvent @see java.awt.List#processItemEvent @since JDK1.1

    Class List, void processItemEvent(ItemEvent)

    Processes item events occurring on this list by dispatching them to any registered ItemListener objects.

    This method is not called unless item events are enabled for this component. Item events are enabled when one of the following occurs:

    Note that if the event parameter is null the behavior is unspecified and may result in an exception. @param e the item event. @see java.awt.event.ItemEvent @see java.awt.event.ItemListener @see java.awt.List#addItemListener @see java.awt.Component#enableEvents @since JDK1.1

    Class List, void remove(String)

    Removes the first occurrence of an item from the list. @param item the item to remove from the list. @exception IllegalArgumentException if the item doesn't exist in the list. @since JDK1.1
    Class List, void remove(int)

    Remove the item at the specified position from this scrolling list. @param position the index of the item to delete. @see java.awt.List#add(String int) @since JDK1.1 @exception ArrayIndexOutOfBoundsException if the position is less than 0 or greater than getItemCount()-1
    Class List, void removeActionListener(ActionListener)

    Removes the specified action listener so that it no longer receives action events from this list. Action events occur when a user double-clicks on a list item. If listener l is null no exception is thrown and no action is performed. @param l the action listener. @see java.awt.event.ActionEvent#addActionListener @see #getActionListeners @see java.awt.event.ActionListenerActionEvent @see java.awt.List#addActionListenerevent.ActionListener @since JDK1.1
    Class List, void removeItemListener(ItemListener)

    Removes the specified item listener so that it no longer receives item events from this list. If listener l is null no exception is thrown and no action is performed. @param l the item listener. @see java.awt.event.ItemEvent#addItemListener @see #getItemListeners @see java.awt.event.ItemListenerItemEvent @see java.awt.List#addItemListenerevent.ItemListener @since JDK1.1
    Class List, void replaceItem(String, int)

    Replaces the item at the specified index in the scrolling list with the new string. @param newValue a new string to replace an existing item. @param index the position of the item to replace. @exception ArrayIndexOutOfBoundsException if index is out of range
    Class List, void select(int)

    Selects the item at the specified index in the scrolling list.

    Note that this method should be primarily used to initially select an item in this component. Programmatically calling this method will not trigger an ItemEvent. The only way to trigger an ItemEvent is by user interaction. @param index the position of the item to select. @see java.awt.List#getSelectedItem @see java.awt.List#deselect @see java.awt.List#isIndexSelected

    Class List, void setMultipleMode(boolean)

    Sets the flag that determines whether this list allows multiple selections. @param b if true then multiple selections are allowed; otherwise only one item from the list can be selected at once. @see java.awt.List#isMultipleMode @since JDK1.1

    Class MediaTracker

    The MediaTracker class is a utility class to track the status of a number of media objects. Media objects could include audio clips as well as images though currently only images are supported.

    To use a media tracker create an instance of MediaTracker and call its addImage method for each image to be tracked. In addition each image can be assigned a unique identifier. This identifier controls the priority order in which the images are fetched. It can also be used to identify unique subsets of the images that can be waited on independently. Images with a lower ID are loaded in preference to those with a higher ID number.

    Here is an example:


     import java.applet.Applet; import java.awt.Color; import java.awt.Image; import java.awt.Graphics; import java.awt.MediaTracker; public class ImageBlaster extends Applet implements Runnable { MediaTracker tracker; Image bg; Image anim[] = new Image[5]; int index; Thread animator; // Get the images for the background (id == 0) // and the animation frames (id == 1) // and add them to the MediaTracker public void init() { tracker = new MediaTracker(this); bg = getImage(getDocumentBase() "images/background.gif"); tracker.addImage(bg 0); for (int i = 0; i <5; i++) { anim[i] = getImage(getDocumentBase() "images/anim"+i+".gif"); tracker.addImage(anim[i] 1); } } // Start the animation thread. public void start() { animator = new Thread(this); animator.start(); } // Stop the animation thread. public void stop() { animator = null; } // Run the animation thread. // First wait for the background image to fully load // and paint. Then wait for all of the animation // frames to finish loading. Finally loop and // increment the animation frame index. public void run() { try { tracker.waitForID(0); tracker.waitForID(1); } catch (InterruptedException e) { return; } Thread me = Thread.currentThread(); while (animator == me) { try { Thread.sleep(100); } catch (InterruptedException e) { break; } synchronized (this) { index++; if (index >= anim.length) { index = 0; } } repaint(); } } // The background image fills the frame so we // don't need to clear the applet on repaints. // Just call the paint method. public void update(Graphics g) { paint(g); } // Paint a large red rectangle if there are any errors // loading the images. Otherwise always paint the // background so that it appears incrementally as it // is loading. Finally only paint the current animation // frame if all of the frames (id == 1) are done loading // so that we don't get partial animations. public void paint(Graphics g) { if ((tracker.statusAll(false) & MediaTracker.ERRORED) = 0) { g.setColor(Color.red); g.fillRect(0 0 size().width size().height); return; } g.drawImage(bg 0 0 this); if (tracker.statusID(1 false) == MediaTracker.COMPLETE) { g.drawImage(anim[index] 10 10 this); } } } 

    @version 1.34 0737 12/1403/0001 @author Jim Graham @since JDK1.0

    Class MediaTracker, constructor MediaTracker(Component)

    Creates a media tracker to track images for a given component. @param comp the component on which the images will eventually be drawn.
    Class MediaTracker, void addImage(Image, int)

    Adds an image to the list of images being tracked by this media tracker. The image will eventually be rendered at its default (unscaled) size. @param image the image to be tracked. @param id an identifier used to track this image.
    Class MediaTracker, void addImage(Image, int, int, int)

    Adds a scaled image to the list of images being tracked by this media tracker. The image will eventually be rendered at the indicated width and height. @param image the image to be tracked. @param id an identifier that can be used to track this image. @param w the width at which the image is rendered. @param h the height at which the image is rendered.
    Class MediaTracker, boolean checkAll()

    Checks to see if all images being tracked by this media tracker have finished loading.

    This method does not start loading the images if they are not already loading.

    If there is an error while loading or scaling an image then that image is considered to have finished loading. Use the isErrorAny or isErrorID methods to check for errors. @return true if all images have finished loading have been aborted or have encountered an error; false otherwise. @see java.awt.MediaTracker#checkAll(boolean) @see java.awt.MediaTracker#checkID @see java.awt.MediaTracker#isErrorAny @see java.awt.MediaTracker#isErrorID

    Class MediaTracker, boolean checkAll(boolean)

    Checks to see if all images being tracked by this media tracker have finished loading.

    If the value of the load flag is true then this method starts loading any images that are not yet being loaded.

    If there is an error while loading or scaling an image that image is considered to have finished loading. Use the isErrorAny and isErrorID methods to check for errors. @param load if true start loading any images that are not yet being loaded. @return true if all images have finished loading have been aborted or have encountered an error; false otherwise. @see java.awt.MediaTracker#checkID @see java.awt.MediaTracker#checkAll() @see java.awt.MediaTracker#isErrorAny() @see java.awt.MediaTracker#isErrorID(int)

    Class MediaTracker, boolean checkID(int)

    Checks to see if all images tracked by this media tracker that are tagged with the specified identifier have finished loading.

    This method does not start loading the images if they are not already loading.

    If there is an error while loading or scaling an image then that image is considered to have finished loading. Use the isErrorAny or isErrorID methods to check for errors. @param id the identifier of the images to check. @return true if all images have finished loading have been aborted or have encountered an error; false otherwise. @see java.awt.MediaTracker#checkID(int boolean) @see java.awt.MediaTracker#checkAll() @see java.awt.MediaTracker#isErrorAny() @see java.awt.MediaTracker#isErrorID(int)

    Class MediaTracker, boolean checkID(int, boolean)

    Checks to see if all images tracked by this media tracker that are tagged with the specified identifier have finished loading.

    If the value of the load flag is true then this method starts loading any images that are not yet being loaded.

    If there is an error while loading or scaling an image then that image is considered to have finished loading. Use the isErrorAny or isErrorID methods to check for errors. @param id the identifier of the images to check. @param load if true start loading any images that are not yet being loaded. @return true if all images have finished loading have been aborted or have encountered an error; false otherwise. @see java.awt.MediaTracker#checkID(int boolean) @see java.awt.MediaTracker#checkAll() @see java.awt.MediaTracker#isErrorAny() @see java.awt.MediaTracker#isErrorID(int)

    Class MediaTracker, Object[] getErrorsAny()

    Returns a list of all media that have encountered an error. @return an array of media objects tracked by this media tracker that have encountered an error or null if there are none with errors. @see java.awt.MediaTracker#isErrorAny @see java.awt.MediaTracker#getErrorsID
    Class MediaTracker, Object[] getErrorsID(int)

    Returns a list of media with the specified ID that have encountered an error. @param id the identifier of the images to check. @return an array of media objects tracked by this media tracker with the specified identifier that have encountered an error or null if there are none with errors. @see java.awt.MediaTracker#isErrorID @see java.awt.MediaTracker#isErrorAny @see java.awt.MediaTracker#getErrorsAny
    Class MediaTracker, boolean isErrorAny()

    Checks the error status of all of the images. @return true if any of the images tracked by this media tracker had an error during loading; false otherwise. @see java.awt.MediaTracker#isErrorID @see java.awt.MediaTracker#getErrorsAny
    Class MediaTracker, boolean isErrorID(int)

    Checks the error status of all of the images tracked by this media tracker with the specified identifier. @param id the identifier of the images to check. @return true if any of the images with the specified identifier had an error during loading; false otherwise. @see java.awt.MediaTracker#isErrorAny @see java.awt.MediaTracker#getErrorsID
    Class MediaTracker, void removeImage(Image)

    RemoveRemoves the specified image from this media tracker. All instances of the specified image are removed regardless of scale or ID. @param image the image to be removed @see java.awt.MediaTracker#removeImage(java.awt.Image int) @see java.awt.MediaTracker#removeImage(java.awt.Image int int int) @since JDK1.1
    Class MediaTracker, void removeImage(Image, int)

    RemoveRemoves the specified image from the specified tracking ID of this media tracker. All instances of Image being tracked under the specified ID are removed regardless of scale. @param image the image to be removed. @param id the tracking ID frrom which to remove the image. @see java.awt.MediaTracker#removeImage(java.awt.Image) @see java.awt.MediaTracker#removeImage(java.awt.Image int int int) @since JDK1.1
    Class MediaTracker, void removeImage(Image, int, int, int)

    RemoveRemoves the specified image with the specified width height and ID from this media tracker. Only the specified instance (with any duplicates) is removed. @param image the image to be removed @param id the tracking ID from which to remove the image. @param width the width to remove (-1 for unscaled). @param height the height to remove (-1 for unscaled). @see java.awt.MediaTracker#removeImage(java.awt.Image) @see java.awt.MediaTracker#removeImage(java.awt.Image int) @since JDK1.1
    Class MediaTracker, int statusAll(boolean)

    Calculates and returns the bitwise inclusive OR of the status of all media that are tracked by this media tracker.

    Possible flags defined by the MediaTracker class are LOADING ABORTED ERRORED and COMPLETE. An image that hasn't started loading has zero as its status.

    If the value of load is true then this method starts loading any images that are not yet being loaded. @param load if true start loading any images that are not yet being loaded. @return the bitwise inclusive OR of the status of all of the media being tracked. @see java.awt.MediaTracker#statusID(int boolean) @see java.awt.MediaTracker#LOADING @see java.awt.MediaTracker#ABORTED @see java.awt.MediaTracker#ERRORED @see java.awt.MediaTracker#COMPLETE

    Class MediaTracker, int statusID(int, boolean)

    Calculates and returns the bitwise inclusive OR of the status of all media with the specified identifier that are tracked by this media tracker.

    Possible flags defined by the MediaTracker class are LOADING ABORTED ERRORED and COMPLETE. An image that hasn't started loading has zero as its status.

    If the value of load is true then this method starts loading any images that are not yet being loaded. @param id the identifier of the images to check. @param load if true start loading any images that are not yet being loaded. @return the bitwise inclusive OR of the status of all of the media with the specified identifier that are being tracked. @see java.awt.MediaTracker#statusAll(boolean) @see java.awt.MediaTracker#LOADING @see java.awt.MediaTracker#ABORTED @see java.awt.MediaTracker#ERRORED @see java.awt.MediaTracker#COMPLETE

    Class MediaTracker, void waitForAll()

    Starts loading all images tracked by this media tracker. This method waits until all the images being tracked have finished loading.

    If there is an error while loading or scaling an image then that image is considered to have finished loading. Use the isErrorAny or isErrorID methods to check for errors. @see java.awt.MediaTracker#waitForID(int) @see java.awt.MediaTracker#waitForAll(long) @see java.awt.MediaTracker#isErrorAny @see java.awt.MediaTracker#isErrorID @exception InterruptedException if another thread has interrupted this thread.

    Class MediaTracker, boolean waitForAll(long)

    Starts loading all images tracked by this media tracker. This method waits until all the images being tracked have finished loading or until the length of time specified in milliseconds by the ms argument has passed.

    If there is an error while loading or scaling an image then that image is considered to have finished loading. Use the isErrorAny or isErrorID methods to check for errors. @param ms the number of milliseconds to wait for the loading to complete. @return true if all images were successfully loaded; false otherwise. @see java.awt.MediaTracker#waitForID(int) @see java.awt.MediaTracker#waitForAll(long) @see java.awt.MediaTracker#isErrorAny @see java.awt.MediaTracker#isErrorID @exception InterruptedException if another thread has interrupted this thread.

    Class MediaTracker, void waitForID(int)

    Starts loading all images tracked by this media tracker with the specified identifier. This method waits until all the images with the specified identifier have finished loading.

    If there is an error while loading or scaling an image then that image is considered to have finished loading. Use the isErrorAny and isErrorID methods to check for errors. @param id the identifier of the images to check. @see java.awt.MediaTracker#waitForAll @see java.awt.MediaTracker#isErrorAny() @see java.awt.MediaTracker#isErrorID(int) @exception InterruptedException if another thread has interrupted this thread.

    Class MediaTracker, boolean waitForID(int, long)

    Starts loading all images tracked by this media tracker with the specified identifier. This method waits until all the images with the specified identifier have finished loading or until the length of time specified in milliseconds by the ms argument has passed.

    If there is an error while loading or scaling an image then that image is considered to have finished loading. Use the statusID isErrorID and isErrorAny methods to check for errors. @param id the identifier of the images to check. @param ms the length of time in milliseconds to wait for the loading to complete. @see java.awt.MediaTracker#waitForAll @see java.awt.MediaTracker#waitForID(int) @see java.awt.MediaTracker#statusID @see java.awt.MediaTracker#isErrorAny() @see java.awt.MediaTracker#isErrorID(int) @exception InterruptedException if another thread has interrupted this thread.

    Class MediaTracker, int ABORTED

    Flag indicating that the downloading of some media was aborted. @see java.awt.MediaTracker#statusAll @see java.awt.MediaTracker#statusID
    Class MediaTracker, int ERRORED

    Flag indicating that the downloading of some media encountered an error. @see java.awt.MediaTracker#statusAll @see java.awt.MediaTracker#statusID
    Class MediaTracker, int LOADING

    Flag indicating somethat media is currently being loaded. @see java.awt.MediaTracker#statusAll @see java.awt.MediaTracker#statusID

    Class Menu

    A Menu object is a pull-down menu component that is deployed from a menu bar.

    A menu can optionally be a tear-off menu. A tear-off menu can be opened and dragged away from its parent menu bar or menu. It remains on the screen after the mouse button has been released. The mechanism for tearing off a menu is platform dependent since the look and feel of the tear-off menu is determined by its peer. On platforms that do not support tear-off menus the tear-off property is ignored.

    Each item in a menu must belong to the MenuItem class. It can be an instance of MenuItem a submenu (an instance of Menu) or a check box (an instance of CheckboxMenuItem). @version 1.61 0468 12/0603/0001 @author Sami Shaio @see java.awt.MenuItem @see java.awt.CheckboxMenuItem @since JDK1.0

    Class Menu, constructor Menu()

    Constructs a new menu with an empty label. This menu is not a tear-off menu. @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true. @see java.awt.GraphicsEnvironment#isHeadless @since JDK1.1
    Class Menu, constructor Menu(String)

    Constructs a new menu with the specified label. This menu is not a tear-off menu. @param label the menu's label in the menu bar or in another menu of which this menu is a submenu. @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true. @see java.awt.GraphicsEnvironment#isHeadless
    Class Menu, constructor Menu(String, boolean)

    Constructs a new menu with the specified label indicating whether the menu can be torn off.

    Tear-off functionality may not be supported by all implementations of AWT. If a particular implementation doesn't support tear-off menus this value is silently ignored. @param label the menu's label in the menu bar or in another menu of which this menu is a submenu. @param tearOff if true the menu is a tear-off menu. @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true. @see java.awt.GraphicsEnvironment#isHeadless @since JDK1.0.

    Class Menu, MenuItem add(MenuItem)

    Adds the specified menu item to this menu. If the menu item has been part of another menu removeremoves it from that menu. @param mi the menu item to be added. @return the menu item added. @see java.awt.Menu#insert(java.lang.String int) @see java.awt.Menu#insert(java.awt.MenuItem int)
    Class Menu, void add(String)

    Adds an item with the specified label to this menu. @param label the text on the item. @see java.awt.Menu#insert(java.lang.String int) @see java.awt.Menu#insert(java.awt.MenuItem int)
    Class Menu, void insert(MenuItem, int)

    Inserts a menu item into this menu at the specified position. @param menuitem the menu item to be inserted. @param index the position at which the menu item should be inserted. @see java.awt.Menu#add(java.lang.String) @see java.awt.Menu#add(java.awt.MenuItem) @exception IllegalArgumentException if the value of index is less than zero. @since JDK1.1
    Class Menu, void insert(String, int)

    Inserts a menu item with the specified label into this menu at the specified position. This is a convenience method for insert(menuItem index). @param label the text on the item. @param index the position at which the menu item should be inserted. @see java.awt.Menu#add(java.lang.String) @see java.awt.Menu#add(java.awt.MenuItem) @exception IllegalArgumentException if the value of index is less than zero @since JDK1.1
    Class Menu, String paramString()

    GetsReturns the parametera string representing the state of this menuMenu. This stringmethod is usefulintended to be used only for debugging. @sincepurposes and the content and format of the returned string may vary between JDK1implementations.0nu The returned string may be empty but may not be null. @return the parameter string of this menu

    Class MenuBar

    The MenuBar class encapsulates the platform's concept of a menu bar bound to a frame. In order to associate the menu bar with a Frame object call the frame's setMenuBar method.

    <-- target for cross references --> This is what a menu bar might look like:

    A menu bar handles keyboard shortcuts for menu items passing them along to its child menus. (Keyboard shortcuts which are optional provide the user with an alternative to the mouse for invoking a menu item and the action that is associated with it.) Each menu item can maintain an instance of MenuShortcut. The MenuBar class defines several methods MenuBar#shortcuts and MenuBar#getShortcutMenuItem that retrieve information about the shortcuts a given menu bar is managing. @version 1.54 0460 12/0603/0001 @author Sami Shaio @see java.awt.Frame @see java.awt.Frame#setMenuBar(java.awt.MenuBar) @see java.awt.Menu @see java.awt.MenuItem @see java.awt.MenuShortcut @since JDK1.0

    Class MenuBar, constructor MenuBar()

    Creates a new menu bar. @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true. @see java.awt.GraphicsEnvironment#isHeadless

    Class MenuComponent

    The abstract class MenuComponent is the superclass of all menu-related components. In this respect the class MenuComponent is analogous to the abstract superclass Component for AWT components.

    Menu components receive and process AWT events just as components do through the method processEvent. @version 1.56 0465 12/0603/0001 @author Arthur van Hoff @since JDK1.0


    Class MenuComponent.AccessibleAWTMenuComponent

    Inner class of MenuComponent 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 menu component developers.

    The class used to obtain the accessible role for this object.

    Class MenuComponent.AccessibleAWTMenuComponent, void addAccessibleSelection(int)

    Adds the specified Accessible child of the object to the object's selection. If the object supports multiple selections the specified child is added to any existing selection otherwise it replaces any existing selection in the object. If the specified child is already selected this method has no effect. @param i the zero-based index of the child @see AccessibleContext#getAccessibleChild
    Class MenuComponent.AccessibleAWTMenuComponent, boolean contains(Point)

    Checks whether the specified point is within this object's bounds where the point's x and y coordinates are defined to be relative to the coordinate system of the object. @param p the Point relative to the coordinate system of the object @return true if object contains Point; otherwise false
    Class MenuComponent.AccessibleAWTMenuComponent, Accessible getAccessibleAt(Point)

    Returns the Accessible child if one exists contained at the local coordinate Point. If there is no Accessible child null is returned. @param p Thethe point defining the top-left corner of the Accessible given in the coordinate space of the object's parent. @return the Accessible if it exists at the specified location; else null
    Class MenuComponent.AccessibleAWTMenuComponent, Accessible getAccessibleChild(int)

    ReturnReturns the nth Accessible child of the object. @param i zero-based index of child @return the nth Accessible child of the object
    Class MenuComponent.AccessibleAWTMenuComponent, int getAccessibleChildrenCount()

    Returns the number of accessible children in the object. If all of the children of this object implement Accessible thanthen this method should return the number of children of this object. @return the number of accessible children in the object.
    Class MenuComponent.AccessibleAWTMenuComponent, AccessibleComponent getAccessibleComponent()

    GetGets the AccessibleComponent associated with this object if one exists. Otherwise return null. @return the component
    Class MenuComponent.AccessibleAWTMenuComponent, String getAccessibleDescription()

    GetGets the accessible description of this object. This should be a concise localized description of what this object is - what is its meaning to the user. If the object has a tooltip the tooltip text may be an appropriate string to return assuming it contains a concise description of the object (instead of just the name of the object - e.g. a "Save" icon on a toolbar that had "save" as the tooltip text shouldn't return the tooltip text as the description but something like "Saves the current text document" instead). @return the localized description of the object -- can be null if this object does not have a description @see AccessibleContext#setAccessibleDescription
    Class MenuComponent.AccessibleAWTMenuComponent, int getAccessibleIndexInParent()

    GetGets the index of this object in its accessible parent. @return the index of this object in its parent; -1 if this object does not have an accessible parent. @see #getAccessibleParent
    Class MenuComponent.AccessibleAWTMenuComponent, String getAccessibleName()

    GetGets the accessible name of this object. This should almost never return java.awt.MenuComponent.getName() as that generally isn't a localized name and doesn't have meaning for the user. If the object is fundamentally a text object (e.g. a menu item) the accessible name should be the text of the object (e.g. "save"). If the object has a tooltip the tooltip text may also be an appropriate String to return. @return the localized name of the object -- can be null if this object does not have a name @see AccessibleContext#setAccessibleName
    Class MenuComponent.AccessibleAWTMenuComponent, Accessible getAccessibleParent()

    GetGets the Accessible parent of this object. If the parent of this object implements Accessible this method should simply return getParent(). @return the Accessible parent of this object -- can be null if this object does not have an Accessible parent
    Class MenuComponent.AccessibleAWTMenuComponent, AccessibleRole getAccessibleRole()

    GetGets the role of this object. @return an instance of AccessibleRole describing the role of the object @see AccessibleRole
    Class MenuComponent.AccessibleAWTMenuComponent, AccessibleSelection getAccessibleSelection()

    GetGets the AccessibleSelection associated with this object which allows its Accessible children to be selected. @return AccessibleSelection if supported by object; else return null @see AccessibleSelection
    Class MenuComponent.AccessibleAWTMenuComponent, Accessible getAccessibleSelection(int)

    Returns an Accessible representing the specified selected child in the object. If there isn't a selection or there are fewer children selected than the integer passed in the return value will be null.

    Note that the index represents the i-th selected child which is different from the i-th child. @param i the zero-based index of selected children @return the i-th selected child @see #getAccessibleSelectionCount

    Class MenuComponent.AccessibleAWTMenuComponent, int getAccessibleSelectionCount()

    Returns the number of Accessible children currently selected. If no children are selected the return value will be 0. @return the number of items currently selected.
    Class MenuComponent.AccessibleAWTMenuComponent, AccessibleStateSet getAccessibleStateSet()

    GetGets the state of this object. @return an instance of AccessibleStateSet containing the current state set of the object @see AccessibleState
    Class MenuComponent.AccessibleAWTMenuComponent, Color getBackground()

    GetGets the background color of this object. @return the background color if supported of the object; otherwise null
    Class MenuComponent.AccessibleAWTMenuComponent, Rectangle getBounds()

    Gets the bounds of this object in the form of a Rectangle object. The bounds specify this object's width height and location relative to its parent. @return Aa rectangle indicating this component's bounds; null if this object is not on the screen.
    Class MenuComponent.AccessibleAWTMenuComponent, Cursor getCursor()

    GetGets the Cursor of this object. @return the CursorCurso if supported of the object; otherwise null
    Class MenuComponent.AccessibleAWTMenuComponent, Font getFont()

    GetGets the Font of this object. @return the Font if supported for the object; otherwise null
    Class MenuComponent.AccessibleAWTMenuComponent, FontMetrics getFontMetrics(Font)

    GetGets the FontMetrics of this object. @param f the Font @return the FontMetrics if supported the object; otherwise null @see #getFont
    Class MenuComponent.AccessibleAWTMenuComponent, Color getForeground()

    GetGets the foreground color of this object. @return the foreground color if supported of the object; otherwise null
    Class MenuComponent.AccessibleAWTMenuComponent, Locale getLocale()

    ReturnReturns the locale of this object. @return the locale of this object
    Class MenuComponent.AccessibleAWTMenuComponent, Point getLocation()

    Gets the location of the object relative to the parent in the form of a point specifying the object's top-left corner in the screen's coordinate space. @return Anan instance of Point representing the top-left corner of the object's bounds in the coordinate space of the screen; null if this object or its parent are not on the screen
    Class MenuComponent.AccessibleAWTMenuComponent, Point getLocationOnScreen()

    Returns the location of the object on the screen. @return location of object on screen -- can be null if this object is not on the screen
    Class MenuComponent.AccessibleAWTMenuComponent, Dimension getSize()

    Returns the size of this object in the form of a Dimension object. The height field of the Dimension object contains this object's height and the width field of the Dimension object contains this object's width. @return Aa Dimension object that indicates the size of this component; null if this object is not on the screen
    Class MenuComponent.AccessibleAWTMenuComponent, boolean isAccessibleChildSelected(int)

    Determines if the current child of this object is selected. @return true if the current child of this object is selected; else false. @param i the zero-based index of the child in this Accessible object. @see AccessibleContext#getAccessibleChild
    Class MenuComponent.AccessibleAWTMenuComponent, boolean isEnabled()

    DetermineDetermines if the object is enabled. @return true if object is enabled; otherwise false
    Class MenuComponent.AccessibleAWTMenuComponent, boolean isShowing()

    DetermineDetermines if the object is showing. This is determined by checking the visibility of the object and ancestors of the object. Note: this will return true even if the object is obscured by another (for example it happens to be underneath a menu that was pulled down). @return true if object is showing; otherwise false
    Class MenuComponent.AccessibleAWTMenuComponent, boolean isVisible()

    DetermineDetermines if the object is visible. Note: this means that the object intends to be visible; however it may not in fact be showing on the screen because one of the objects that this object is contained by is not visible. To determine if an object is showing on the screen use isShowing(). @return true if object is visible; otherwise false
    Class MenuComponent.AccessibleAWTMenuComponent, void setBackground(Color)

    SetSets the background color of this object. (For transparency see isOpaque.) @param c the new Color for the background @see Component#isOpaque
    Class MenuComponent.AccessibleAWTMenuComponent, void setBounds(Rectangle)

    Sets the bounds of this object in the form of a Rectangle object. The bounds specify this object's width height and location relative to its parent. @param Aa rectangle indicating this component's bounds
    Class MenuComponent.AccessibleAWTMenuComponent, void setCursor(Cursor)

    SetSets the Cursor of this object. @param c the new Cursor for the object
    Class MenuComponent.AccessibleAWTMenuComponent, void setEnabled(boolean)

    SetSets the enabled state of the object. @param b if true enables this object; otherwise disables it
    Class MenuComponent.AccessibleAWTMenuComponent, void setFont(Font)

    SetSets the Font of this object. @param f the new Font for the object
    Class MenuComponent.AccessibleAWTMenuComponent, void setForeground(Color)

    SetSets the foreground color of this object. @param c the new Color for the foreground
    Class MenuComponent.AccessibleAWTMenuComponent, void setSize(Dimension)

    Resizes this object.. @param d - Thethe dimensionDimension specifying the new size of the object.
    Class MenuComponent.AccessibleAWTMenuComponent, void setVisible(boolean)

    SetSets the visible state of the object. @param b if true shows this object; otherwise hides it

    Class MenuComponent, constructor MenuComponent()

    Constructor forCreates a MenuComponent. @exception HeadlessException if GraphicsEnvironment.isHeadless returns true @see java.awt.GraphicsEnvironment#isHeadless
    Class MenuComponent, AccessibleContext getAccessibleContext()

    GetGets the AccessibleContext associated with this MenuComponent. The method implemented by this base class returns null. Classes that extend MenuComponent should implement this method to return the AccessibleContext associated with the subclass. @return the AccessibleContext of this MenuComponent
    Class MenuComponent, Font getFont()

    Gets the font used for this menu component. @return the font used in this menu component if there is one; null otherwise. @see java.awt.MenuComponent#setFont
    Class MenuComponent, String getName()

    Gets the name of the menu component. @return the name of the menu component. @see java.awt.MenuComponent#setName(java.lang.String) @since JDK1.1
    Class MenuComponent, MenuContainer getParent()

    Returns the parent container for this menu component. @return the menu component containing this menu component or null if this menu component is the outermost component the menu bar itself.
    Class MenuComponent, Object getTreeLock()

    Gets this component's locking object (the object that owns the thread sychronization monitor) for AWT component-tree and layout operations. @return Thisthis component's locking object.
    Class MenuComponent, String paramString()

    Returns the parametera string representing the state of this menu componentMenuComponent. This stringmethod is usefulintended to be used only for debugging purposes and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null. @return the parameter string of this menu component.
    Class MenuComponent, void processEvent(AWTEvent)

    Processes events occurring on this menu component.

    Note that if the event parameter is null the behavior is unspecified and may result in an exception. @param e the event @since JDK1.1

    Class MenuComponent, void setFont(Font)

    Sets the font to be used for this menu component to the specified font. This font is also used by all subcomponents of this menu component unless those subcomponents specify a different font.

    Some look and feels may not support setting the font of a menu component; in this case calling setFont will have no effect. @param f the font to be set. @see java.awt.MenuComponent#getFont

    Class MenuComponent, void setName(String)

    Sets the name of the component to the specified string. @param name the name of the menu component. @see java.awt.MenuComponent#getName @since JDK1.1
    Class MenuComponent, String toString()

    Returns a representation of this menu component as a string. @return a string representation of this menu component.

    Class MenuContainer

    The super class of all menu related containers. @version 1.12 0213 12/0203/0001 @author Arthur van Hoff

    Class MenuItem

    All items in a menu must belong to the class MenuItem or one of its subclasses.

    The default MenuItem object embodies a simple labeled menu item.

    This picture of a menu bar shows five menu items:
    The first two items are simple menu items labeled "Basic" and "Simple". Following these two items is a separator which is itself a menu item created with the label "-". Next is an instance of CheckboxMenuItem labeled "Check". The final menu item is a submenu labeled "More Examples" and this submenu is an instance of Menu.

    When a menu item is selected AWT sends an action event to the menu item. Since the event is an instance of ActionEvent the processEvent method examines the event and passes it along to processActionEvent. The latter method redirects the event to any ActionListener objects that have registered an interest in action events generated by this menu item.

    Note that the subclass Menu overrides this behavior and does not send any event to the frame until one of its subitems is selected. @version 1.68 0479 12/0603/0001 @author Sami Shaio

    Class MenuItem, constructor MenuItem()

    Constructs a new MenuItem with an empty label and no keyboard shortcut. @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true. @see java.awt.GraphicsEnvironment#isHeadless @since JDK1.1
    Class MenuItem, constructor MenuItem(String)

    Constructs a new MenuItem with the specified label and no keyboard shortcut. Note that use of "-" in a label is reserved to indicate a separator between menu items. By default all menu items except for separators are enabled. @param label the label for this menu item. @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true. @see java.awt.GraphicsEnvironment#isHeadless @since JDK1.0
    Class MenuItem, constructor MenuItem(String, MenuShortcut)

    Create a menu item with an associated keyboard shortcut. Note that use of "-" in a label is reserved to indicate a separator between menu items. By default all menu items except for separators are enabled. @param label the label for this menu item. @param s the instance of MenuShortcut associated with this menu item. @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true. @see java.awt.GraphicsEnvironment#isHeadless @since JDK1.1
    Class MenuItem, void addActionListener(ActionListener)

    Adds the specified action listener to receive action events from this menu item. If l is null no exception is thrown and no action is performed. @param l the action listener. @see java.awt.event.ActionEvent#removeActionListener @see #getActionListeners @see java.awt.event.ActionListenerActionEvent @see java.awt.MenuItem#removeActionListenerevent.ActionListener @since JDK1.1
    Class MenuItem, void disableEvents(long)

    Disables event delivery to this menu item for events defined by the specified event mask parameter. @param eventsToDisable the event mask defining the event types. @see java.awt.MenuItem#processEvent @see java.awt.MenuItem#enableEvents @see java.awt.Component#disableEvents @since JDK1.1
    Class MenuItem, void enableEvents(long)

    Enables event delivery to this menu item for events to be defined by the specified event mask parameter

    Since event types are automatically enabled when a listener for that type is added to the menu item this method only needs to be invoked by subclasses of MenuItem which desire to have the specified event types delivered to processEvent regardless of whether a listener is registered. @param eventsToEnable the event mask defining the event types. @see java.awt.MenuItem#processEvent @see java.awt.MenuItem#disableEvents @see java.awt.Component#enableEvents @since JDK1.1

    Class MenuItem, EventListener[] getListeners(Class)

    ReturnReturns an array of all the listenersobjects that were addedcurrently registered as toFooListeners the MenuItemupon this withMenuItem. addXXXListener()FooListeners where XXX isare registered using the nameaddFooListener ofmethod.

    You can specify the listenerType argument. For example to get all ofwith a class literal such as theFooListener.class. ActionListener(s)For forexample theyou can givenquery a MenuItem m onefor its action wouldlisteners with the writefollowing code:

     ActionListener[] als = (ActionListener[])(m.getListeners(ActionListener.class)) ;
    If no such listenerlisteners exist list exists thenthis method returns an empty array is returned. @param listenerType Typethe type of listeners requested; @returnthis all of theparameter should specify listenersan interface that descends from java.util.EventListener @return an array of the specified typeall objects registered supportedas FooListeners byon this menu item or an empty array if no such listeners have been added @exception ClassCastException if listenerType doesn't specify a class or interface that implements java.util.EventListener @see #getActionListeners @since 1.3
    Class MenuItem, String paramString()

    Returns the parametera string representing the state of this menu itemMenuItem. This stringmethod is usefulintended to be used only for debugging purposes and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null. @return the parameter string of this menu item. @since JDK1.0
    Class MenuItem, void processActionEvent(ActionEvent)

    Processes action events occurring on this menu item by dispatching them to any registered ActionListener objects. This method is not called unless action events are enabled for this component. Action events are enabled when one of the following occurs:

    Note that if the event parameter is null the behavior is unspecified and may result in an exception. @param e the action event. @see java.awt.event.ActionEvent @see java.awt.event.ActionListener @see java.awt.MenuItem#enableEvents @since JDK1.1

    Class MenuItem, void processEvent(AWTEvent)

    Processes events on this menu item. If the event is an instance of ActionEvent it invokes processActionEvent another method defined by MenuItem.

    Currently menu items only support action events.

    Note that if the event parameter is null the behavior is unspecified and may result in an exception. @param e the event. @see java.awt.MenuItem#processActionEvent @since JDK1.1

    Class MenuItem, void removeActionListener(ActionListener)

    Removes the specified action listener so it no longer receives action events from this menu item. If l is null no exception is thrown and no action is performed. @param l the action listener. @see java.awt.event.ActionEvent#addActionListener @see #getActionListeners @see java.awt.event.ActionListenerActionEvent @see java.awt.MenuItem#addActionListenerevent.ActionListener @since JDK1.1

    Class MenuShortcut

    AThe MenuShortcutclass which represents a keyboard accelerator for a MenuItem.

    Menu shortcuts are created using virtual keycodes not characters. For example a menu shortcut for Ctrl-a would be created with code like the following:

    MenuShortcut ms = new MenuShortcut(KeyEvent.VK_A false);

    @author Thomas Ball @version 1.18 0221 12/0203/0001 @author Thomassince BallJDK1.1

    Class MenuShortcut, constructor MenuShortcut(int)

    Constructs a new MenuShortcut for the specified keyvirtual keycode. @param key the raw keycode for this MenuShortcut as would be returned in the keyCode field of a KeyEvent if this key were pressed. @see java.awt.event.KeyEvent
    Class MenuShortcut, constructor MenuShortcut(int, boolean)

    Constructs a new MenuShortcut for the specified keyvirtual keycode. @param key the raw keycode for this MenuShortcut as would be returned in the keyCode field of a KeyEvent if this key were pressed. @param useShiftModifier indicates whether this MenuShortcut is invoked with the SHIFT key down. @see java.awt.event.KeyEvent
    Class MenuShortcut, boolean equals(MenuShortcut)

    Returns whether this MenuShortcut is the same as another: equality is defined to mean that both MenuShortcuts use the same key and both either use or don't use the SHIFT key. @param s the MenuShortcut to compare with this. @return true if this MenuShortcut is the same as another false otherwise. @since JDK1.1
    Class MenuShortcut, boolean equals(Object)

    Returns whether this MenuShortcut is the same as another: equality is defined to mean that both MenuShortcuts use the same key and both either use or don't use the SHIFT key. @param obj the Object to compare with this. @return true if this MenuShortcut is the same as another false otherwise. @since 1.2
    Class MenuShortcut, int getKey()

    ReturnReturns the raw keycode of this MenuShortcut. @return the raw keycode of this MenuShortcut. @see java.awt.event.KeyEvent @since JDK1.1
    Class MenuShortcut, int hashCode()

    Returns the hashcode for this MenuShortcut. @return the hashcode for this MenuShortcut. @since 1.2
    Class MenuShortcut, String toString()

    Returns an internationalized description of the MenuShortcut. @return a string representation of this MenuShortcut. @since JDK1.1
    Class MenuShortcut, boolean usesShiftModifier()

    ReturnReturns whether this MenuShortcut must be invoked using the SHIFT key. @return true if this MenuShortcut must be invoked using the SHIFT key false otherwise. @since JDK1.1

    Class PageAttributes

    A set of attributes which control the output of a printed page.

    Instances of this class control the color state paper size (media type) orientation logical origin print quality and resolution of every page which uses the instance. Attribute names are compliant with the Internet Printing Protocol (IPP) 1.1 where possible. Attribute values are partially compliant where possible.

    To use a method which takes an inner class type pass a reference to one of the constant fields of the inner class. Client code cannot create new instances of the inner class types because none of those classes has a public constructor. For example to set the color state to monochrome use the following code:

     import java.awt.PageAttributes; public class MonochromeExample { public void setMonochrome(PageAttributes pageAttributes) { pageAttributes.setColor(PageAttributes.ColorType.MONOCHROME); } } 

    Every IPP attribute which supports an attributeName-default value has a corresponding setattributeNameToDefault method. Default value fields are not provided. @version 1.4 025 12/0203/0001 @author David Mendenhall


    Class Paint

    This Paint interface defines how color patterns can be generated for Graphics2D operations. A class implementing the Paint interface is added to the Graphics2D context in order to define the color pattern used by the draw and fill methods.

    Instances of classes implementing Paint must be read-only because the Graphics2D does not clone these objects when they are set as an attribute with the setPaint method or when the Graphics2D object is itself cloned. @see PaintContext @see Color @see GradientPaint @see TexturePaint @see Graphics2D#setPaint @version 1.23 0225 12/0203/0001

    Class Paint, PaintContext createContext(ColorModel, Rectangle, Rectangle2D, AffineTransform, RenderingHints)

    Creates and returns a PaintContext used to generate the color pattern. Since the ColorModel argument to createContext is only a hint implementations of Paint should accept a null argument for ColorModel. Note that if the application does not prefer a specific ColorModel the null ColorModel argument will give the Paint implementation full leeway in using the most efficient ColorModel it prefers for its raster processing.

    Since the API documentation was not specific about this in releases before 1.4 there may be implementations of Paint that do not accept a null ColorModel argument. If a developer is writing code which passes a null ColorModel argument to the createContext method of Paint objects from arbitrary sources it would be wise to code defensively by manufacturing a non-null ColorModel for those objects which throw a NullPointerException. @param cm the ColorModel that receives the Paint data. This is used only as a hint. @param deviceBounds the device space bounding box of the graphics primitive being rendered @param userBounds the user space bounding box of the graphics primitive being rendered @param xform the AffineTransform from user space into device space @param hints the hint that the context object uses to choose between rendering alternatives @return the PaintContext for generating color patterns @see PaintContext


    Class Panel

    Panel is the simplest container class. A panel provides space in which an application can attach any other component including other panels.

    The default layout manager for a panel is the FlowLayout layout manager. @version 1.30 0412/0603/0001 @author Sami Shaio @see java.awt.FlowLayout @since JDK1.0


    Class Point

    A point representing a location in (x y) coordinate space specified in integer precision. @version 1.28 0234 12/0903/01 @author Sami Shaio @since JDK1.0
    Class Point, constructor Point(Point)

    Constructs and initializes a point with the same location as the specified Point object. @param p a point. @since JDK1.1
    Class Point, constructor Point(int, int)

    Constructs and initializes a point at the specified (x  y) location in the coordinate space. @param x the x coordinate. @param y the y coordinate.
    Class Point, boolean equals(Object)

    Determines whether an instance of Point2D is equal to this point. Two instances of Point2D are equal if the values of their x and y member fields representing their position in the coordinate space are the same. @param obj an object to be compared with this point. @return true if the object to be compared is an instance of Point2DPoint and has the same values; false otherwise.
    Class Point, Point getLocation()

    Returns the location of this point. This method is included for completeness to parallel the getLocation method of Component. @return a copy of this point at the same location. @see java.awt.Component#getLocation @see java.awt.Point#setLocation(java.awt.Point) @see java.awt.Point#setLocation(int int) @since JDK1.1
    Class Point, double getX()

    Returns the X coordinate of the point in double precision. @return the X coordinate of the point in double precision
    Class Point, double getY()

    Returns the Y coordinate of the point in double precision. @return the Y coordinate of the point in double precision
    Class Point, void move(int, int)

    Moves this point to the specificedspecified location in the (x  y) coordinate plane. This method is identical with setLocation(int  int). @param x the x coordinate of the new location. @param y the y coordinate of the new location. @see java.awt.Component#setLocation(int int)
    Class Point, void setLocation(Point)

    Sets the location of the point to the specificedspecified location. This method is included for completeness to parallel the setLocation method of Component. @param p a point the new location for this point. @see java.awt.Component#setLocation(java.awt.Point) @see java.awt.Point#getLocation @since JDK1.1
    Class Point, void setLocation(double, double)

    Sets the location of this point to the specified float coordinates. The float values will be rounded to integer values. Any number smaller than Integer.MIN_VALUE will be reset to MIN_VALUE and any number larger than Integer.MAX_VALUE will be reset to MAX_VALUE. @param x the x coordinate of the new location @param y the y coordinate of the new location @see #getLocation
    Class Point, void setLocation(int, int)

    Changes the point to have the specificedspecified location.

    This method is included for completeness to parallel the setLocation method of Component. Its behavior is identical with move(int  int). @param x the x coordinate of the new location. @param y the y coordinate of the new location. @see java.awt.Component#setLocation(int int) @see java.awt.Point#getLocation @see java.awt.Point#move(int int) @since JDK1.1

    Class Point, String toString()

    Returns a string representation of this point and its location in the (x  y) coordinate space. This method is intended to be used only for debugging purposes and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null. @return a string representation of this point.
    Class Point, void translate(int, int)

    Translates this point at location (x  y) by dx along the x axis and dy along the y axis so that it now represents the point (x + dx y + dy). @param xdx the distance to move this point along the x axis. @param ydy the distance to move this point along the y axis.
    Class Point, int x

    The x coordinate. If no x coordinate is set it will default to '0'. @serial @see #getLocation() @see #move(int int)
    Class Point, int y

    The y coordinate. If no y coordinate is set it will default to '0'. @serial @see #getLocation() @see #move(int int)

    Class Polygon

    The Polygon class encapsulates a description of a closed two-dimensional region within a coordinate space. This region is bounded by an arbitrary number of line segments each of which is one side of the polygon. Internally a polygon comprises of a list of (x  y) coordinate pairs where each pair defines a vertex of the polygon and two successive pairs are the endpoints of a line that is a side of the polygon. The first and final pairs of (x  y) points are joined by a line segment that closes the polygon. This Polygon is defined with an even-odd winding rule. See WIND_EVEN_ODD for a definition of the even-odd winding rule. This class's hit-testing methods which include the contains intersects and inside methods use the insideness definition described in the Shape class comments. @version 1.26 07/24/98 @author Sami Shaio @see Shape @author Herb Jellinek @see Shape @since JDK1.0
    Class Polygon, boolean contains(double, double)

    Determines whetherif the specified coordinates are inside this Polygon. For the definition of insideness see the class comments of Shape @param x  y the specified coordinates @return true if thisthe Polygon contains the specified coordinates; false otherwise.
    Class Polygon, int npoints

    The total number of points. The value of npoints represents the number of valid points in this Polygon and might be less than the number of elements in xpoints or ypoints This value can be NULL. @serial @see #addPoint(int int)
    Class Polygon, int[] xpoints

    The array of x coordinates. The number of elements in this array might be more than the number of x coordinates in this Polygon. The extra elements allow new points to be added to this Polygon without re-creating this array. The value of npoints is equal to the number of valid points in this Polygon. @serial @see #addPoint(int int)
    Class Polygon, int[] ypoints

    The array of y coordinates. The number of elements in this array might be more than the number of y coordinates in this Polygon. The extra elements allow new points to be added to this Polygon without re-creating this array. The value of npoints is equal to the number of valid points in this Polygon. @serial @see #addPoint(int int)

    Class PopupMenu

    A class that implements a menu which can be dynamically popped up at a specified position within a component.

    As the inheritance hierarchy implies a PopupMenu can be used anywhere a Menu can be used. However if you use a PopupMenu like a Menu (e.g. you add it to a MenuBar) then you cannot call show on that PopupMenu. @version 1.24 0426 12/0603/0001 @author Amy Fowler


    Class PopupMenu.AccessibleAWTPopupMenu

    Inner class of PopupMenu 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 menu component developers.

    This class implements accessibility support for the PopupMenuThe class. It provides anused implementation ofto obtain the Java Accessibilityaccessible APIrole appropriate to popup menufor user-interfacethis elementsobject.


    Class PopupMenu, constructor PopupMenu()

    Creates a new popup menu with an empty name. @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true. @see java.awt.GraphicsEnvironment#isHeadless
    Class PopupMenu, constructor PopupMenu(String)

    Creates a new popup menu with the specified name. @param label a non-null string specifying the popup menu's label @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true. @see java.awt.GraphicsEnvironment#isHeadless
    Class PopupMenu, AccessibleContext getAccessibleContext()

    Gets the AccessibleContext associated with this PopupMenu. For popup menus the AccessibleContext takes the form of an AccessibleAWTPopupMenu. A new AccessibleAWTPopupMenu instance is created if necessary. @return an AccessibleAWTPopupMenu that serves as the AccessibleContext of this PopupMenu
    Class PopupMenu, void show(Component, int, int)

    Shows the popup menu at the x y position relative to an origin component. The origin component must be contained within the component hierarchy of the popup menu's parent. Both the origin and the parent must be showing on the screen for this method to be valid.

    If this PopupMenu is being used as a Menu (i.e. it has a non-Component parent) then you cannot call this method on the PopupMenu. @param origin the component which defines the coordinate space @param x the x coordinate position to popup the menu @param y the y coordinate position to popup the menu @exception NullPointerException if the parent is null @exception IllegalArgumentException if this PopupMenu has a non- Component parent @exception IllegalArgumentException if the origin is not in the parent's heirarchy @exception RuntimeException if the parent is not showing on screen


    Class PrintGraphics

    An abstract class which provides a print graphics context for a page. @version 1.9 0210 12/0203/0001 @author Amy Fowler

    Class PrintJob

    An abstract class which initiates and executes a print job. It provides access to a print graphics object which renders to an appropriate print device. @see Toolkit#getPrintJob @version 1.10 0211 12/0203/0001 @author Amy Fowler

    Class Rectangle

    A Rectangle specifies an area in a coordinate space that is enclosed by the Rectangle object's top-left point (x  y) in the coordinate space its width and its height.

    A Rectangle object's width and height are public fields. The constructors that create a Rectangle and the methods that can modify one do not prevent setting a negative value for width or height.

    A Rectangle whose width or height is negative is considered empty. If the Rectangle is empty then the isEmpty method returns true. No point can be contained by or inside an empty Rectangle. The values of width and height however are still valid. An empty Rectangle still has a location in the coordinate space and methods that change its size or location remain valid. The behavior of methods that operate on more than one Rectangle is undefined if any of the participating Rectangle objects has a negative width or height. These methods include intersects intersection and union. @version 1.53 0563 12/2903/01 @author Sami Shaio @since JDK1.0

    Class Rectangle, constructor Rectangle(Rectangle)

    Constructs a new Rectangle initialized to match the values of the specificedspecified Rectangle. @param r the Rectangle from which to copy initial values to a newly constructed Rectangle @since JDK1.1
    Class Rectangle, boolean contains(int, int, int, int)

    Checks whether this Rectangle entirely contains the Rectangle at the specified location (X  Y) with the specified dimensions (W  H). @param xX  yY the specified coordinates @param W the width of the Rectangle @param H the height of the Rectangle @return true if the Rectangle specified by (X  Y  W  H) is entirely enclosed inside this Rectangle; false otherwise. @since JDK1.1
    Class Rectangle, Rectangle getBounds()

    Gets the bounding Rectangle of this Rectangle.

    This method is included for completeness to parallel the getBounds method of Component @return a new Rectangle equal to the bounding Rectangle for this Rectangle. @see java.awt.Component#getBounds @see #setBounds(Rectangle) @see #setBounds(int int int int) @since JDK1.1

    Class Rectangle, Point getLocation()

    Returns the location of this Rectangle.

    This method is included for completeness to parallel the getLocation method of Component. @return the Point that is the top-left corner of this Rectangle. @see java.awt.Component#getLocation @see #setLocation(Point) @see #setLocation(int int) @since JDK1.1

    Class Rectangle, Dimension getSize()

    Gets the size of this Rectangle represented by the returned Dimension.

    This method is included for completeness to parallel the getSize method of Component. @return a Dimension representing the size of this Rectangle. @see java.awt.Component#getSize @see #setSize(Dimension) @see #setSize(int int) @since JDK1.1

    Class Rectangle, boolean inside(int, int)

    Checks whether or not this Rectangle contains the point at the specified location (X  Y). @param X  Y the specified coordinates @return true if the point (X  Y) is inside this Rectangle; false otherwise. @deprecated As of JDK version 1.1 replaced by contains(int int).
    Class Rectangle, Rectangle intersection(Rectangle)

    Computes the intersection of this Rectangle with the specified Rectangle. Returns a new Rectangle that represents the intersection of the two rectangles. If the two rectangles do not intersect the result will be an empty rectangle. @param r the specified Rectangle @return the largest Rectangle contained in both the specified Rectangle and in this Rectangle; or if the rectangles do not intersect an empty rectangle.
    Class Rectangle, boolean intersects(Rectangle)

    Determines whether or not this Rectangle and the specified Rectangle intersect. Two rectangles intersect if their intersection is nonempty. @param r the specified Rectangle @return true if the specified Rectangle and this Rectangle insersectintersect; false otherwise.
    Class Rectangle, void move(int, int)

    Moves this Rectangle to the specified location.

    @param x  y the coordinates of the new location @deprecated As of JDK version 1.1 replaced by setLocation(int int).

    Class Rectangle, void reshape(int, int, int, int)

    Sets the bounding Rectangle of this Rectangle to the specified x y width and height.

    @param x  y the new coordinates for the top-left corner of this Rectangle @param width the new width for this Rectangle @param height the new height for this Rectangle @deprecated As of JDK version 1.1 replaced by setBounds(int int int int).

    Class Rectangle, void resize(int, int)

    Sets the size of this Rectangle to the specified width and height.

    @param width the new width for this Rectangle @param height the new height for this Rectangle @deprecated As of JDK version 1.1 replaced by setSize(int int).

    Class Rectangle, void setBounds(Rectangle)

    Sets the bounding Rectangle of this Rectangle to match the specified Rectangle.

    This method is included for completeness to parallel the setBounds method of Component. @param r the specified Rectangle @see #getBounds @see java.awt.Component#setBounds(java.awt.Rectangle) @since JDK1.1

    Class Rectangle, void setBounds(int, int, int, int)

    Sets the bounding Rectangle of this Rectangle to the specified x y width and height.

    This method is included for completeness to parallel the setBounds method of Component. @param x  y the new coordinates for the top-left corner of this Rectangle @param width the new width for this Rectangle @param height the new height for this Rectangle @see #getBounds @see java.awt.Component#setBounds(int int int int) @since JDK1.1

    Class Rectangle, void setLocation(Point)

    Moves this Rectangle to the specified location.

    This method is included for completeness to parallel the setLocation method of Component. @param p the Point specifying the new location for this Rectangle @see java.awt.Component#setLocation(java.awt.Point) @see #getLocation @since JDK1.1

    Class Rectangle, void setLocation(int, int)

    Moves this Rectangle to the specified location.

    This method is included for completeness to parallel the setLocation method of Component. @param x  y the coordinates of the new location @see #getLocation @see java.awt.Component#setLocation(int int) @since JDK1.1

    Class Rectangle, void setRect(double, double, double, double)

    Sets the bounds of this Rectangle to the specified x y width and height. This method is included for completeness to parallel the setBounds method of Component. @param x  y the coordinates of the upper-left corner of the specified rectangle @param width the new width for the Dimension object @param height the new height for the Dimension object
    Class Rectangle, void setSize(Dimension)

    Sets the size of this Rectangle to match the specified Dimension.

    This method is included for completeness to parallel the setSize method of Component. @param d the new size for the Dimension object @see java.awt.Component#setSize(java.awt.Dimension) @see #getSize @since JDK1.1

    Class Rectangle, void setSize(int, int)

    Sets the size of this Rectangle to the specified width and height.

    This method is included for completeness to parallel the setSize method of Component. @param width the new width for this Rectangle @param height the new height for this Rectangle @see java.awt.Component#setSize(int int) @see #getSize @since JDK1.1

    Class Rectangle, void translate(int, int)

    Translates this Rectangle the indicated distance to the right along the x coordinate axis and downward along the y coordinate axis. @param dxx the distance to move this Rectangle along the x axis @param dyy the distance to move this Rectangle along the y axis @see java.awt.Rectangle#setLocation(int int) @see java.awt.Rectangle#setLocation(java.awt.Point)

    Class RenderingHints.Key, constructor RenderingHints.Key(int)

    Construct a key using the indicated private key. Each subclass of Key maintains its own unique domain of integer keys. No two objects with the same integer key and of the same specific subclass can be constructed. An exception will be thrown if an attempt is made to construct another object of a given class with the same integer key as a pre-existing instance of that subclass of Key. @param privatekey the specified key
    Class RenderingHints.Key, int intKey()

    Returns the private integer key that the subclass instantiated this Key with. @return the private integer key that the subclass instantiated this Key with.
    Class RenderingHints.Key, boolean isCompatibleValue(Object)

    Returns true if the specified object is a valid value for this Key. @param val the Object to test for validity @return true if val is valid; false otherwise.

    Class RenderingHints, void putAll(Map)

    Copies all of the mappings from the specified Map to this RenderingHints. These mappings replace any mappings that this RenderingHints had for any of the keys currently in the specified Map. @param tm mappings to be stored inthe thisspecified RenderingHintsMap. @exception ClassCastException class of a key or value in the specified Map prevents it from being stored in this RenderingHints. @exception IllegalArgumentException some aspect of a key or value in the specified Map prevents it from being stored in this RenderingHints.
    Class RenderingHints, Key KEY_ALPHA_INTERPOLATION

    Alpha interpolation hint key.
    Class RenderingHints, Key KEY_ANTIALIASING

    Antialiasing hint key.
    Class RenderingHints, Key KEY_COLOR_RENDERING

    Color rendering hint key.
    Class RenderingHints, Key KEY_DITHERING

    Dithering hint key.
    Class RenderingHints, Key KEY_FRACTIONALMETRICS

    Font fractional metrics hint key.
    Class RenderingHints, Key KEY_INTERPOLATION

    Interpolation hint key.
    Class RenderingHints, Key KEY_RENDERING

    Rendering hint key.
    Class RenderingHints, Key KEY_STROKE_CONTROL

    Stroke normalization control hint key.
    Class RenderingHints, Key KEY_TEXT_ANTIALIASING

    Text antialiasing hint key.
    Class RenderingHints, Object VALUE_ALPHA_INTERPOLATION_DEFAULT

    Alpha interpolation hint value -- ALPHA_INTERPOLATION_DEFAULT.
    Class RenderingHints, Object VALUE_ALPHA_INTERPOLATION_QUALITY

    Alpha interpolation hint value -- ALPHA_INTERPOLATION_QUALITY.
    Class RenderingHints, Object VALUE_ALPHA_INTERPOLATION_SPEED

    Alpha interpolation hint value -- ALPHA_INTERPOLATION_SPEED.
    Class RenderingHints, Object VALUE_ANTIALIAS_OFF

    Antialiasing hint values -- rendering is done without antialiasing.
    Class RenderingHints, Object VALUE_ANTIALIAS_ON

    Antialiasing hint values -- rendering is done with antialiasing.
    Class RenderingHints, Object VALUE_COLOR_RENDER_DEFAULT

    Color rendering hint value -- COLOR_RENDER_DEFAULT.
    Class RenderingHints, Object VALUE_COLOR_RENDER_QUALITY

    Color rendering hint value -- COLOR_RENDER_QUALITY.
    Class RenderingHints, Object VALUE_COLOR_RENDER_SPEED

    Color rendering hint value -- COLOR_RENDER_SPEED.
    Class RenderingHints, Object VALUE_DITHER_DEFAULT

    Dithering hint values -- use the platform default for dithering.
    Class RenderingHints, Object VALUE_DITHER_DISABLE

    Dithering hint values -- do not dither when rendering.
    Class RenderingHints, Object VALUE_DITHER_ENABLE

    Dithering hint values -- dither when rendering if needed.
    Class RenderingHints, Object VALUE_FRACTIONALMETRICS_DEFAULT

    Font fractional metrics hint values -- use the platform default for fractional metrics.
    Class RenderingHints, Object VALUE_FRACTIONALMETRICS_OFF

    Font fractional metrics hint values -- fractional metrics disabled.
    Class RenderingHints, Object VALUE_FRACTIONALMETRICS_ON

    Font fractional metrics hint values -- fractional metrics enabled.
    Class RenderingHints, Object VALUE_INTERPOLATION_BICUBIC

    Interpolation hint value -- INTERPOLATION_BICUBIC.
    Class RenderingHints, Object VALUE_INTERPOLATION_BILINEAR

    Interpolation hint value -- INTERPOLATION_BILINEAR.
    Class RenderingHints, Object VALUE_INTERPOLATION_NEAREST_NEIGHBOR

    Interpolation hint value -- INTERPOLATION_NEAREST_NEIGHBOR.
    Class RenderingHints, Object VALUE_STROKE_DEFAULT

    Stroke normalization control hint value -- STROKE_DEFAULT.
    Class RenderingHints, Object VALUE_STROKE_NORMALIZE

    Stroke normalization control hint value -- STROKE_NORMALIZE.
    Class RenderingHints, Object VALUE_STROKE_PURE

    Stroke normalization control hint value -- STROKE_PURE.
    Class RenderingHints, Object VALUE_TEXT_ANTIALIAS_OFF

    Text antialiasing hint value -- text rendering is done without antialiasing.
    Class RenderingHints, Object VALUE_TEXT_ANTIALIAS_ON

    Text antialiasing hint value -- text rendering is done with antialiasing.

    Class Robot

    This class is used to generate native system input events for the purposes of test automation self-running demos and other applications where control of the mouse and keyboard is needed. The primary purpose of Robot is to facilitate automated testing of Java platform implementations.

    Using the class to generate input events differs from posting events to the AWT event queue or AWT components in that the events are generated in the platform's native input queue. For example Robot.mouseMove will actually move the mouse cursor instead of just generating mouse move events.

    Note that some platforms require special privileges or extensions to access low-level input control. If the current platform configuration does not allow input control an AWTException will be thrown when trying to construct Robot objects. For example X-Window systems will throw the exception if the XTEST 2.2 standard extension is not supported (or not enabled) by the X server.

    Applications that use Robot for purposes other than self-testing should handle these error conditions gracefully. @version 1.13 0220 12/0203/0001 @author Robi Khan @since 1.3

    Class Robot, constructor Robot()

    Constructs a Robot object in the coordinate system of the primary screen.

    @throws AWTException if the platform configuration does not allow low-level input control. This exception is always thrown when GraphicsEnvironment.isHeadless() returns true @throws SecurityException if createRobot permission is not granted @see java.awt.GraphicsEnvironment#isHeadless @see SecurityManager#checkPermission @see AWTPermission

    Class Robot, constructor Robot(GraphicsDevice)

    Creates a Robot for the given screen device. Coordinates passed to Robot method calls like mouseMove and createScreenCapture will be interpreted as being in the same coordinate system as the specified screen. Note that depending on the platform configuration multiple screens may either: This constructor is meant for the latter case.

    If screen devices are reconfigured such that the coordinate system is affected the behavior of existing Robot objects is undefined. @param screen A screen GraphicsDevice indicating the coordinate system the Robot will operate in. @throws AWTException if the platform configuration does not allow low-level input control. This exception is always thrown when GraphicsEnvironment.isHeadless() returns true. @throws IllegalArgumentException if screen is not a screen GraphicsDevice. @throws SecurityException if createRobot permission is not granted @see java.awt.GraphicsEnvironment#isHeadless @see GraphicsDevice @see SecurityManager#checkPermission @see AWTPermission

    Class Robot, void delay(int)

    Sleeps for the specified time. To catch any InterruptedExceptions that occur Thread.sleep() may be used instead. @param ms Timetime to sleep in milliseconds @throws IllegalArgumentException Ifif ms is not between 0 and 60 000 milliseconds inclusive @see java.lang.Thread#sleep()
    Class Robot, void keyPress(int)

    Presses a given key.

    Key codes that have more than one physical key associated with them (e.g. KeyEvent.VK_SHIFT could mean either the left or right shift key) will map to the left key. @param keyCode Key to press (e.g. KeyEvent.VK_A) @throws IllegalArgumentException if keycode is not a valid key @see java.awt.event.KeyEvent

    Class Robot, void keyRelease(int)

    Releases a given key.

    Key codes that have more than one physical key associated with them (e.g. KeyEvent.VK_SHIFT could mean either the left or right shift key) will map to the left key. @param keyCode Key to release (e.g. KeyEvent.VK_A) @throws IllegalArgumentException if keycode is not a valid key @see java.awt.event.KeyEvent

    Class Robot, void mousePress(int)

    Presses one or more mouse buttons. @param buttons the Button mask; a (combination of one or more of these flags:
    • InputEvent.BUTTON1/2/3_MASK)
    • InputEvent.BUTTON2_MASK
    • InputEvent.BUTTON3_MASK
    @throws IllegalArgumentException if the button mask is not a valid combination
    Class Robot, void mouseRelease(int)

    Releases one or more mouse buttons. @param buttons the Button mask; a (combination of one or more of these flags:
    • InputEvent.BUTTON1/2/3_MASK)
    • InputEvent.BUTTON2_MASK
    • InputEvent.BUTTON3_MASK
    @throws IllegalArgumentException if the button mask is not a valid combination

    Class ScrollPane

    A container class which implements automatic horizontal and/or vertical scrolling for a single child component. The display policy for the scrollbars can be set to:
    1. as needed: scrollbars created and shown only when needed by scrollpane
    2. always: scrollbars created and always shown by the scrollpane
    3. never: scrollbars never created or shown by the scrollpane

    The state of the horizontal and vertical scrollbars is represented by two ScrollPaneAdjustable objects (one for each dimension) which implement the Adjustable interface. The API provides methods to access those objects such that the attributes on the Adjustable object (such as unitIncrement value etc.) can be manipulated.

    Certain adjustable properties (minimum maximum blockIncrement and visibleAmount) are set internally by the scrollpane in accordance with the geometry of the scrollpane and its child and these should not be set by programs using the scrollpane.

    If the scrollbar display policy is defined as "never" then the scrollpane can still be programmatically scrolled using the setScrollPosition() method and the scrollpane will move and clip the child's contents appropriately. This policy is useful if the program needs to create and manage its own adjustable controls.

    The placement of the scrollbars is controlled by platform-specific properties set by the user outside of the program.

    The initial size of this container is set to 100x100 but can be reset using setSize().

    Scrolling with the wheel on a wheel-equipped mouse is enabled by default. This can be disabled using setWheelScrollingEnabled(). Wheel scrolling can be customized by setting the block and unit increment of the horizontal and vertical Adjustables.

    Insets are used to define any space used by scrollbars and any borders created by the scroll pane. getInsets() can be used to get the current value for the insets. If the value of scrollbarsAlwaysVisible is false then the value of the insets will change dynamically depending on whether the scrollbars are currently visible or not. @version 1.75 0488 12/0603/0001 @author Tom Ball @author Amy Fowler @author Tim Prinzing

    Class ScrollPane, constructor ScrollPane()

    Create a new scrollpane container with a scrollbar display policy of "as needed". @throws HeadlessException if GraphicsEnvironment.isHeadless() returns true @see java.awt.GraphicsEnvironment#isHeadless
    Class ScrollPane, constructor ScrollPane(int)

    Create a new scrollpane container. @param scrollbarDisplayPolicy policy for when scrollbars should be shown @throws IllegalArgumentException if the specified scrollbar display policy is invalid @throws HeadlessException if GraphicsEnvironment.isHeadless() returns true @see java.awt.GraphicsEnvironment#isHeadless
    Class ScrollPane, Adjustable getHAdjustable()

    Returns the AdjustableScrollPaneAdjustable object which represents the state of the horizontal scrollbar. The declared return type of this method is Adjustable to maintain backward compatibility. @see java.awt.ScrollPaneAdjustable
    Class ScrollPane, Point getScrollPosition()

    Returns the current x y position within the child which is displayed at the 0 0 location of the scrolled panel's view port. This is a convenience method which interfaces with the adjustable objects which represent the state of the scrollbars. @return the coordinate position for the current scroll position @throws NullPointerException if the scrollpane does not contain a child
    Class ScrollPane, Adjustable getVAdjustable()

    Returns the AdjustableScrollPaneAdjustable object which represents the state of the vertical scrollbar. The declared return type of this method is Adjustable to maintain backward compatibility. @see java.awt.ScrollPaneAdjustable
    Class ScrollPane, void setScrollPosition(int, int)

    Scrolls to the specified position within the child component. A call to this method is only valid if the scroll pane contains a child. Specifying a position outside of the legal scrolling bounds of the child will scroll to the closest legal position. Legal bounds are defined to be the rectangle: x = 0 y = 0 width = (child width - view port width) height = (child height - view port height). This is a convenience method which interfaces with the Adjustable objects which represent the state of the scrollbars. @param x the x position to scroll to @param y the y position to scroll to @throws NullPointerException if the scrollpane does not contain a child

    Class Scrollbar

    The Scrollbar class embodies a scroll bar a familiar user-interface object. A scroll bar provides a convenient means for allowing a user to select from a range of values. The following three vertical scroll bars could be used as slider controls to pick the red green and blue components of a color:

    Each scroll bar in this example could be created with code similar to the following:


     redSlider=new Scrollbar(Scrollbar.VERTICAL 0 1 0 255); add(redSlider); 

    Alternatively a scroll bar can represent a range of values. For example if a scroll bar is used for scrolling through text the width of the "bubble" or "thumb" can represent the amount of text that is visible. Here is an example of a scroll bar that represents a range:

    The value range represented by the bubble is the visible range of the scroll bar. The horizontal scroll bar in this example could be created with code like the following:


     ranger = new Scrollbar(Scrollbar.HORIZONTAL 0 60 0 300); add(ranger); 

    Note that the actual maximum value of the scroll bar is the maximum minus the visible. In the previous example because the maximum is 300 and the visible is 60 the actual maximum value is 240. The range of the scrollbar track is 0 - 300. The left side of the bubble indicates the value of the scroll bar.

    Normally the user changes the value of the scroll bar by making a gesture with the mouse. For example the user can drag the scroll bar's bubble up and down or click in the scroll bar's unit increment or block increment areas. Keyboard gestures can also be mapped to the scroll bar. By convention the Page Up and Page Down keys are equivalent to clicking in the scroll bar's block increment and block decrement areas.

    When the user changes the value of the scroll bar the scroll bar receives an instance of AdjustmentEvent. The scroll bar processes this event passing it along to any registered listeners.

    Any object that wishes to be notified of changes to the scroll bar's value should implement AdjustmentListener an interface defined in the package java.awt.event. Listeners can be added and removed dynamically by calling the methods addAdjustmentListener and removeAdjustmentListener.

    The AdjustmentEvent class defines five types of adjustment event listed here:

    The JDK 1.0 event system is supported for backwards compatibility but its use with newer versions of the platform is discouraged. The fivesfive types of adjustment event introduced with JDK 1.1 correspond to the five event types that are associated with scroll bars in previous platform versions. The following list gives the adjustment event type and the corresponding JDK 1.0 event type it replaces.

    @version 1.7793 0412/0603/0001 @author Sami Shaio @see java.awt.event.AdjustmentEvent @see java.awt.event.AdjustmentListener @since JDK1.0


    Class Scrollbar.AccessibleAWTScrollBar, AccessibleRole getAccessibleRole()

    Get the role of this object. @return an instance of AccessibleRole describing the role of the object
    Class Scrollbar.AccessibleAWTScrollBar, AccessibleStateSet getAccessibleStateSet()

    Get the state set of this object. @return an instance of AccessibleState containing the current state of the object @see AccessibleState
    Class Scrollbar.AccessibleAWTScrollBar, AccessibleValue getAccessibleValue()

    Get the AccessibleValue associated with this object. In the implementation of the Java Accessibility API for this class return this object which is responsible for implementing the AccessibleValue interface on behalf of itself. @return this object

    Class Scrollbar, constructor Scrollbar()

    Constructs a new vertical scroll bar. The default properties of the scroll bar are listed in the following table:

    Property Description Default Value
    orientation indicates if the scroll bar is vertical or horizontal Scrollbar.VERTICAL
    value value which controls the location
    of the scroll bar bubble
    0
    minimum minimum value of the scroll bar 0
    maximum maximum value of the scroll bar 100
    unit increment amount the value changes when the
    Line Up or Line Down key is pressed
    or when the end arrows of the scrollbar
    are clicked
    1
    block increment amount the value changes when the
    Page Up or Page Down key is pressed
    or when the scrollbar track is clicked
    on either side of the bubble
    10
    @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true. @see java.awt.GraphicsEnvironment#isHeadless
    Class Scrollbar, constructor Scrollbar(int)

    Constructs a new scroll bar with the specified orientation.

    The orientation argument must take one of the two values Scrollbar.HORIZONTAL or Scrollbar.VERTICAL indicating a horizontal or vertical scroll bar respectively. @param orientation indicates the orientation of the scroll bar. @exception IllegalArgumentException when an illegal value for the orientation argument is supplied @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true. @see java.awt.GraphicsEnvironment#isHeadless

    Class Scrollbar, constructor Scrollbar(int, int, int, int, int)

    Constructs a new scroll bar with the specified orientation initial value page sizevisible amount and minimum and maximum values.

    The orientation argument must take one of the two values Scrollbar.HORIZONTAL or Scrollbar.VERTICAL indicating a horizontal or vertical scroll bar respectively.

    If the specified maximum value is less than the minimum value itThe is changedparameters supplied to be the same as the minimum value. If the initial value is lower than the minimum valuethis it is changedconstructor are subject to be the minimum value; if it is greater than the maximum value it is changedconstraints to bedescribed in thein maximumint valueint)}. @param orientation indicates the orientation of the scroll bar. @param value the initial value of the scroll bar. @param visible the size of the scroll bar's bubble representing the visible portion; the scroll bar uses this value when paging up or down by a page. @param minimum the minimum value of the scroll bar. @param maximum the maximum value of the scroll bar @exception IllegalArgumentException when an illegal value for the orientation argument is supplied @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true. @see #setValues @see java.awt.GraphicsEnvironment#isHeadless

    Class Scrollbar, void addAdjustmentListener(AdjustmentListener)

    Adds the specified adjustment listener to receive instances of AdjustmentEvent from this scroll bar. If l is null no exception is thrown and no action is performed. @param l the adjustment listener. @see java.awt.event.AdjustmentEvent#removeAdjustmentListener @see #getAdjustmentListeners @see java.awt.event.AdjustmentListenerAdjustmentEvent @see java.awt.Scrollbar#removeAdjustmentListenerevent.AdjustmentListener @since JDK1.1
    Class Scrollbar, void addNotify()

    Creates the Scrollbar's peer. The peer allows you to modify the appearance of the Scrollbar without changing any of its functionality.
    Class Scrollbar, AccessibleContext getAccessibleContext()

    Gets the AccessibleContext associated with this Scrollbar. For scrollbars the AccessibleContext takes the form of an AccessibleAWTScrollBar. A new AccessibleAWTScrollBar instance is created if necessary. @return an AccessibleAWTScrollBar that serves as the AccessibleContext of this ScrollBar
    Class Scrollbar, int getBlockIncrement()

    Gets the block increment of this scroll bar.

    The block increment is the value that is added (subtracted) when the user activates the block increment area of the scroll bar generally through a mouse or keyboard gesture that the scroll bar receives as an adjustment event. @return the block increment of this scroll bar. @see java.awt.Scrollbar#setBlockIncrement @since JDK1.1

    Class Scrollbar, EventListener[] getListeners(Class)

    ReturnReturns an array of all the listenersobjects that were addedcurrently registered as toFooListeners the Scrollbarupon this withScrollbar. addXXXListener()FooListeners where XXX isare registered using the nameaddFooListener ofmethod.

    You can specify the listenerType argument with a class literal such as FooListener.class. For example to get all ofyou can query a theScrollbar AdjustmentListener(s)c for the given Scrollbarits mouse listeners swith one would writethe following code:

     AdjustmentListenerMouseListener[] alsmls = (AdjustmentListenerMouseListener[])(sc.getListeners(AdjustmentListenerMouseListener.class)) ;
    If no such listenerlisteners exist list exists thenthis method returns an empty array is returned. @param listenerType Typethe type of listeners requested; this parameter should specify an interface that descends from java.util.EventListener @return allan array of theall objects registered as FooListeners on this component or an empty array if no such listeners of the specifiedhave been added type@exception supported byClassCastException if thislistenerType doesn't specify a class or
    scrollbarinterface that implements java.util.EventListener @since 1.3
    Class Scrollbar, int getMaximum()

    Gets the maximum value of this scroll bar. @return the maximum value of this scroll bar. @see java.awt.Scrollbar#getValue @see java.awt.Scrollbar#getMinimum
    Class Scrollbar, int getMinimum()

    Gets the minimum value of this scroll bar. @return the minimum value of this scroll bar. @see java.awt.Scrollbar#getValue @see java.awt.Scrollbar#getMaximum
    Class Scrollbar, int getOrientation()

    DeterminesReturns the orientation of this scroll bar. @return the orientation of this scroll bar either Scrollbar.HORIZONTAL or Scrollbar.VERTICAL. @see java.awt.Scrollbar#setOrientation
    Class Scrollbar, int getUnitIncrement()

    Gets the unit increment for this scrollbar.

    The unit increment is the value that is added (subtracted) when the user activates the unit increment area of the scroll bar generally through a mouse or keyboard gesture that the scroll bar receives as an adjustment event. @return the unit increment of this scroll bar. @see java.awt.Scrollbar#setUnitIncrement @since JDK1.1

    Class Scrollbar, int getValue()

    Gets the current value of this scroll bar. @return the current value of this scroll bar. @see java.awt.Scrollbar#getMinimum @see java.awt.Scrollbar#getMaximum
    Class Scrollbar, int getVisibleAmount()

    Gets the visible amount of this scroll bar.

    The visible amount of a scroll bar is the range of values represented by the width of the scroll bar's bubble. It is used to determine the scroll bar's block increment. @return the visible amount of this scroll bar. @see java.awt.Scrollbar#setVisibleAmount @since JDK1.1

    Class Scrollbar, String paramString()

    Returns the parametera string representing the state of this scroll barScrollbar. This stringmethod is usefulintended to be used only for debugging purposes and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null. @return the parameter string of this scroll bar.
    Class Scrollbar, void processAdjustmentEvent(AdjustmentEvent)

    Processes adjustment events occurring on this scrollbar by dispatching them to any registered AdjustmentListener objects.

    This method is not called unless adjustment events are enabled for this component. Adjustment events are enabled when one of the following occurs:

    Note that if the event parameter is null the behavior is unspecified and may result in an exception. @param e the adjustment event. @see java.awt.event.AdjustmentEvent @see java.awt.event.AdjustmentListener @see java.awt.Scrollbar#addAdjustmentListener @see java.awt.Component#enableEvents @since JDK1.1

    Class Scrollbar, void processEvent(AWTEvent)

    Processes events on this scroll bar. If the event is an instance of AdjustmentEvent it invokes the processAdjustmentEvent method. Otherwise it invokes its superclass's processEvent method.

    Note that if the event parameter is null the behavior is unspecified and may result in an exception. @param e the event. @see java.awt.event.AdjustmentEvent @see java.awt.Scrollbar#processAdjustmentEvent @since JDK1.1

    Class Scrollbar, void removeAdjustmentListener(AdjustmentListener)

    Removes the specified adjustment listener so that it no longer receives instances of AdjustmentEvent from this scroll bar. If l is null no exception is thrown and no action is performed. @param l the adjustment listener. @see java.awt.event.AdjustmentEvent#addAdjustmentListener @see #getAdjustmentListeners @see java.awt.event.AdjustmentListenerAdjustmentEvent @see java.awt.Scrollbar#addAdjustmentListenerevent.AdjustmentListener @since JDK1.1
    Class Scrollbar, void setBlockIncrement(int)

    Sets the block increment for this scroll bar.

    The block increment is the value that is added (subtracted) when the user activates the block increment area of the scroll bar generally through a mouse or keyboard gesture that the scroll bar receives as an adjustment event. @param v the amount by which to increment or decrement the scroll bar's value. @see java.awt.Scrollbar#getBlockIncrement @since JDK1.1

    Class Scrollbar, void setMaximum(int)

    Sets the maximum value of this scroll bar.

    When setMaximum is called the limiting argument takes precedence over the existing scrollbar value.

    Normally a program should change a scroll bar's maximum value only by calling setValues. The setValues method simultaneously and synchronously sets the minimum maximum visible amount and value properties of a scroll bar so that they are mutually consistent. @param newMaximum the new maximum value for this scroll bar. @see java.awt.Scrollbar#setValues @see java.awt.Scrollbar#setMinimum @since JDK1.1

    Class Scrollbar, void setMinimum(int)

    Sets the minimum value of this scroll bar.

    When setMinimum is called the limiting argument takes precedence over the existing scrollbar value.

    Normally a program should change a scroll bar's minimum value only by calling setValues. The setValues method simultaneously and synchronously sets the minimum maximum visible amount and value properties of a scroll bar so that they are mutually consistent. @param newMinimum the new minimum value for this scroll bar. @see java.awt.Scrollbar#setValues @see java.awt.Scrollbar#setMaximum @since JDK1.1

    Class Scrollbar, void setOrientation(int)

    Sets the orientation for this scroll bar. @param the orientation of this scroll bar either Scrollbar.HORIZONTAL or Scrollbar.VERTICAL. @see java.awt.Scrollbar#getOrientation @exception IllegalArgumentException if the value supplied for orientation is not a legal value. @since JDK1.1
    Class Scrollbar, void setUnitIncrement(int)

    Sets the unit increment for this scroll bar.

    The unit increment is the value that is added (subtracted) when the user activates the unit increment area of the scroll bar generally through a mouse or keyboard gesture that the scroll bar receives as an adjustment event. @param v the amount by which to increment or decrement the scroll bar's value. @see java.awt.Scrollbar#getUnitIncrement @since JDK1.1

    Class Scrollbar, void setValue(int)

    Sets the value of this scroll bar to the specified value.

    If the value supplied is less than the current minimum or greater than the current maximum - visibleAmount then one of those values is substituted as appropriate.

    Normally a program should change a scroll bar's value only by calling setValues. The setValues method simultaneously and synchronously sets the minimum maximum visible amount and value properties of a scroll bar so that they are mutually consistent. @param newValue the new value of the scroll bar. @see java.awt.Scrollbar#setValues @see java.awt.Scrollbar#getValue @see java.awt.Scrollbar#getMinimum @see java.awt.Scrollbar#getMaximum

    Class Scrollbar, void setValues(int, int, int, int)

    Sets the values of four properties for this scroll bar: value visibleAmount minimum and maximum. If the values supplied for these properties are inconsistent or incorrect they will be changed to ensure consistency.

    This method simultaneously and synchronously sets the values of four scroll bar properties assuring that the values of these properties are mutually consistent. It enforces the constraintsfollowing thatconstraints: maximum cannotmust be lessgreater than minimum andvisibleAmount thatmust be positive visibleAmount must not be greater than maximum - minimum value must cannotnot be less than the minimum orand value must not be greater than the maximum. - visibleAmount @param value is the position in the current window. @param visible is the amount visible per page. @param minimum is the minimum value of the scroll bar. @param maximum is the maximum value of the scroll bar. @see #setMinimum @see #setMaximum @see #setVisibleAmount @see #setValue

    Class Scrollbar, void setVisibleAmount(int)

    Sets the visible amount of this scroll bar.

    The visible amount of a scroll bar is the range of values represented by the width of the scroll bar's bubble. It is used to determine the scroll bar's block increment.

    Normally a program should change a scroll bar's value only by calling setValues. The setValues method simultaneously and synchronously sets the minimum maximum visible amount and value properties of a scroll bar so that they are mutually consistent. @param newAmount the amount visible per page. @see java.awt.Scrollbar#getVisibleAmount @see java.awt.Scrollbar#setValues @since JDK1.1


    Class Shape

    The Shape interface provides definitions for objects that represent some form of geometric shape. The Shape is described by a PathIterator object which can express the outline of the Shape as well as a rule for determining how the outline divides the 2D plane into interior and exterior points. Each Shape object provides callbacks to get the bounding box of the geometry determine whether points or rectangles lie partly or entirely within the interior of the Shape and retrieve a PathIterator object that describes the trajectory path of the Shape outline.

    Definition of insideness: A point is considered to lie inside a Shape if and only if:

    The contains and intersects methods consider the interior of a Shape to be the area it encloses as if it were filled. This means that these methods consider unclosed shapes to be implicitly closed for the purpose of determining if a shape contains or intersects a rectangle or if a shape contains a point. @see java.awt.geom.PathIterator @see java.awt.geom.AffineTransform @see java.awt.geom.FlatteningPathIterator @see java.awt.geom.GeneralPath @version 1.19 06/24/98 @author Jim Graham


    Class Stroke

    The Stroke interface allows a Graphics2D object to obtain a Shape that is the decorated outline or stylistic representation of the outline of the specified Shape. Stroking a Shape is like tracing its outline with a marking pen of the appropriate size and shape. The area where the pen would place ink is the area enclosed by the outline Shape.

    The methods of the Graphics2D interface that use the outline Shape returned by a Stroke object include draw and any other methods that are implemented in terms of that method such as drawLine drawRect drawRoundRect drawOval drawArc drawPolyline and drawPolygon.

    The objects of the classes implementing Stroke must be read-only because Graphics2D does not clone these objects either when they are set as an attribute with the setStroke method or when the Graphics2D object is itself cloned. If a Stroke object is modified after it is set in the Graphics2D context then the behavior of subsequent rendering would be undefined. @see BasicStroke @see Graphics2D#setStroke @version 1.19 0220 12/0203/0001


    Class SystemColor

    A class to encapsulate symbolic colors representing the color of native GUI objects on a system. For systems which support the dynamic update of the system colors (when the user changes the colors) the actual RGB values of these symbolic colors will also change dynamically. In order to compare the "current" RGB value of a SystemColor object with a non-symbolic Color object getRGB() should be used rather than equals().

    Note that the way in which these system colors are applied to GUI objects may vary slightly from platform to platform since GUI objects may be rendered differently on each platform.

    System color values may also be available through the getDesktopProperty method on java.awt.Toolkit. @see Toolkit#getDesktopProperty @version 1.18 0222 12/0203/0001 @author Carl Quinn @author Amy Fowler

    Class SystemColor, PaintContext createContext(ColorModel, Rectangle, Rectangle2D, AffineTransform, RenderingHints)

    CreateCreates and returnreturns a PaintContext used to generate a solid color pattern. This enables a Color object to be used as an argument to any method requiring an object implementing the Paint interface. @see Paint @see PaintContext @see Graphics2D#setPaint
    Class SystemColor, String toString()

    Returns the Stringa string representation of this Color's values. This method is intended to be used only for debugging purposes and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null. @return a string representation of this Color
    Class SystemColor, int ACTIVE_CAPTION

    The array index for the activeactiveCaption captionsystem background color. @see SystemColor#activeCaption
    Class SystemColor, int ACTIVE_CAPTION_BORDER

    The array index for the activeactiveCaptionBorder captionsystem border color. @see SystemColor#activeCaptionBorder
    Class SystemColor, int ACTIVE_CAPTION_TEXT

    The array index for the actionactiveCaptionText captionsystem text color. @see SystemColor#activeCaptionText
    Class SystemColor, int CONTROL

    The array index for the control backgroundsystem color. @see SystemColor#control
    Class SystemColor, int CONTROL_DK_SHADOW

    The array index for the controlcontrolDkShadow darksystem shadow color. @see SystemColor#controlDkShadow
    Class SystemColor, int CONTROL_HIGHLIGHT

    The array index for the controlcontrolHighlight highlightsystem color. @see SystemColor#controlHighlight
    Class SystemColor, int CONTROL_LT_HIGHLIGHT

    The array index for the controlcontrolLtHighlight lightsystem highlight color. @see SystemColor#controlLtHighlight
    Class SystemColor, int CONTROL_SHADOW

    The array index for the controlcontrolShadow shadowsystem color. @see SystemColor#controlShadow
    Class SystemColor, int CONTROL_TEXT

    The array index for the controlcontrolText textsystem color. @see SystemColor#controlText
    Class SystemColor, int DESKTOP

    The array index for the desktop backgroundsystem color. @see SystemColor#desktop
    Class SystemColor, int INACTIVE_CAPTION

    The array index for the inactiveinactiveCaption captionsystem background color. @see SystemColor#inactiveCaption
    Class SystemColor, int INACTIVE_CAPTION_BORDER

    The array index for the inactiveinactiveCaptionBorder captionsystem border color. @see SystemColor#inactiveCaptionBorder
    Class SystemColor, int INACTIVE_CAPTION_TEXT

    The array index for the inactiveinactiveCaptionText captionsystem text color. @see SystemColor#inactiveCaptionText
    Class SystemColor, int INFO

    The array index for the info backgroundsystem color. @see SystemColor#info
    Class SystemColor, int INFO_TEXT

    The array index for the infoinfoText textsystem color. @see SystemColor#infoText
    Class SystemColor, int MENU

    The array index for the menu backgroundsystem color. @see SystemColor#menu
    Class SystemColor, int MENU_TEXT

    The array index for the menumenuText textsystem color. @see SystemColor#menuText
    Class SystemColor, int SCROLLBAR

    The array index for the scrollbar backgroundsystem color. @see SystemColor#scrollbar
    Class SystemColor, int TEXT

    The array index for the text backgroundsystem color. @see SystemColor#text
    Class SystemColor, int TEXT_HIGHLIGHT

    The array index for the texttextHighlight highlightsystem color. @see SystemColor#textHighlight
    Class SystemColor, int TEXT_HIGHLIGHT_TEXT

    The array index for the texttextHighlightText highlightsystem text color. @see SystemColor#textHighlightText
    Class SystemColor, int TEXT_INACTIVE_TEXT

    The array index for the texttextInactiveText inactivesystem text color. @see SystemColor#textInactiveText
    Class SystemColor, int TEXT_TEXT

    The array index for the texttextText textsystem color. @see SystemColor#textText
    Class SystemColor, int WINDOW

    The array index for the window backgroundsystem color. @see SystemColor#window
    Class SystemColor, int WINDOW_BORDER

    The array index for the windowwindowBorder bordersystem color. @see SystemColor#windowBorder
    Class SystemColor, int WINDOW_TEXT

    The array index for the windowwindowText textsystem color. @see SystemColor#windowText
    Class SystemColor, SystemColor activeCaption

    The background color for captions inrendered for the window-title background bordersof the currently active window.
    Class SystemColor, SystemColor activeCaptionBorder

    The border color rendered for captions in windowthe border around bordersthe currently active window.
    Class SystemColor, SystemColor activeCaptionText

    The text color for captions inrendered for the window-title text bordersof the currently active window.
    Class SystemColor, SystemColor control

    The background color rendered for the background of control panels and control objects such as pushbuttons.
    Class SystemColor, SystemColor controlDkShadow

    The color rendered for dark shadow colorareas foron 3D control objects such as pushbuttons. This color is typically derived from the control background color to provide a 3D effect.
    Class SystemColor, SystemColor controlHighlight

    The regular highlight color rendered for light areas of 3D control objects such as pushbuttons. This color is typically derived from the control background color to provide a 3D effect.
    Class SystemColor, SystemColor controlLtHighlight

    The lightcolor rendered for highlight color forareas of 3D control objects such as pushbuttons. This color is typically derived from the control background color to provide a 3D effect.
    Class SystemColor, SystemColor controlShadow

    The regularcolor rendered for shadow color forareas of 3D control objects such as pushbuttons. This color is typically derived from the control background color to provide a 3D effect.
    Class SystemColor, SystemColor controlText

    The text color rendered for the text of control panels and control objects such as pushbuttons.
    Class SystemColor, SystemColor desktop

    The color rendered for the background of the desktop background.
    Class SystemColor, SystemColor inactiveCaption

    The background color rendered for inactivethe window-title captions in window bordersbackground of inactive windows.
    Class SystemColor, SystemColor inactiveCaptionBorder

    The border color rendered for inactive captios in window bordersthe border around inactive windows.
    Class SystemColor, SystemColor inactiveCaptionText

    The text color rendered for inactivethe window-title captions in window borderstext of inactive windows.
    Class SystemColor, SystemColor info

    The background color rendered for info(help)the background textof tooltips or spot help.
    Class SystemColor, SystemColor infoText

    The text color rendered for info(help)the text of tooltips or spot help.
    Class SystemColor, SystemColor menu

    The background color rendered for the background of menus.
    Class SystemColor, SystemColor menuText

    The text color rendered for the text of menus.
    Class SystemColor, SystemColor scrollbar

    The background color rendered for the background of scrollbars.
    Class SystemColor, SystemColor text

    The background color rendered for the background of text componentscontrol objects such as textfields and comboboxes.
    Class SystemColor, SystemColor textHighlight

    The background color rendered for highlightedthe background of selected items such as in menus comboboxes and text.
    Class SystemColor, SystemColor textHighlightText

    The text color rendered for highlightedthe text of selected items such as in menus comboboxes and text.
    Class SystemColor, SystemColor textInactiveText

    The text color rendered for inactivethe text of inactive items such as in menus.
    Class SystemColor, SystemColor textText

    The text color rendered for the text of text componentscontrol objects such as textfields and comboboxes.
    Class SystemColor, SystemColor window

    The background color rendered for the background of interior regions inside windows.
    Class SystemColor, SystemColor windowBorder

    The border color rendered for the border around interior regions inside windows.
    Class SystemColor, SystemColor windowText

    The text color rendered for text of interior regions inside windows.

    Class TextArea

    A TextArea object is a multi-line region that displays text. It can be set to allow editing or to be read-only.

    The following image shows the appearance of a text area:

    This text area could be created by the following line of code:


     new TextArea("Hello" 5 40); 

    @version 1.57 0470 12/0603/0001 @author Sami Shaio @since JDK1.0

    Class TextArea, constructor TextArea()

    Constructs a new text area with the empty string as text. This text area is created with scrollbar visibility equal to #SCROLLBARS_BOTH so both vertical and horizontal scrollbars will be visible for this text area. @exception HeadlessException if GraphicsEnvironment.isHeadless returns true @see java.awt.GraphicsEnvironment#isHeadless()
    Class TextArea, constructor TextArea(String)

    Constructs a new text area with the specified text. This text area is created with scrollbar visibility equal to #SCROLLBARS_BOTH so both vertical and horizontal scrollbars will be visible for this text area. @param text the text to be displayed; if text is null the empty string "" will be displayed @exception HeadlessException if GraphicsEnvironment.isHeadless returns true @see java.awt.GraphicsEnvironment#isHeadless()
    Class TextArea, constructor TextArea(String, int, int)

    Constructs a new text area with the specified text and with the specified number of rows and columns. A column is an approximate average character width that is platform-dependent. The text area is created with scrollbar visibility equal to #SCROLLBARS_BOTH so both vertical and horizontal scrollbars will be visible for this text area. @param text the text to be displayed.; if text is null the empty string "" will be displayed @param rows the number of rows. @param columns the number of columns @exception HeadlessException if GraphicsEnvironment.isHeadless returns true @see java.awt.GraphicsEnvironment#isHeadless()
    Class TextArea, constructor TextArea(String, int, int, int)

    Constructs a new text area with the specified text and with the rows columns and scroll bar visibility as specified. All TextArea constructors defer to this one.

    The TextArea class defines several constants that can be supplied as values for the scrollbars argument:

    Any other value for the scrollbars argument is invalid and will result in this text area being created with scrollbar visibility equal to the default value of #SCROLLBARS_BOTH @param text the text to be displayed. If; if text is null the empty string "" will be displayed. @param rows the number of rows. If; if rows is less than 0 rows is set to 0. @param columns the number of columns. If; if columns is less than 0 columns is set to 0. @param scrollbars a constant that determines what scrollbars are created to view the text area. @since JDK1.1 @exception HeadlessException if GraphicsEnvironment.isHeadless returns true @see java.awt.GraphicsEnvironment#isHeadless()
    Class TextArea, constructor TextArea(int, int)

    Constructs a new empty text area with the specified number of rows and columns and the empty string as text. A column is an approximate average character width that is platform-dependent. The text area is created with scrollbar visibility equal to #SCROLLBARS_BOTH so both vertical and horizontal scrollbars will be visible for this text area. @param rows the number of rows @param columns the number of columns @exception HeadlessException if GraphicsEnvironment.isHeadless returns true @see java.awt.GraphicsEnvironment#isHeadless()
    Class TextArea, void addNotify()

    Creates the TextArea's peer. The peer allows us to modify the appearance of the TextArea without changing any of its functionality.
    Class TextArea, void append(String)

    Appends the given text to the text area's current text.

    Note that passing null or inconsistent parameters is invalid and will result in unspecified behavior. @param str the non-null text to append. @see java.awt.TextArea#insert @since JDK1.1

    Class TextArea, AccessibleContext getAccessibleContext()

    GetsReturns the AccessibleContext associated with this TextArea. For text areas the AccessibleContext takes the form of an AccessibleAWTTextArea. A new AccessibleAWTTextArea instance is created if necessary. @return an AccessibleAWTTextArea that serves as the AccessibleContext of this TextArea
    Class TextArea, int getColumns()

    GetsReturns the number of columns in this text area. @return the number of columns in the text area. @see java.awt.TextArea#setColumns(int) @see java.awt.TextArea#getRows()
    Class TextArea, Dimension getMinimumSize()

    Determines the minimum size of this text area. @return the preferred dimensions needed for this text area. @see java.awt.Component#getPreferredSize @since JDK1.1
    Class TextArea, Dimension getMinimumSize(int, int)

    Determines the minimum size of a text area with the specified number of rows and columns. @param rows the number of rows. @param cols the number of columns. @return the minimum dimensions required to display the text area with the specified number of rows and columns. @see java.awt.Component#getMinimumSize @since JDK1.1
    Class TextArea, Dimension getPreferredSize()

    Determines the preferred size of this text area. @return the preferred dimensions needed for this text area. @see java.awt.Component#getPreferredSize @since JDK1.1
    Class TextArea, Dimension getPreferredSize(int, int)

    Determines the preferred size of a text area with the specified number of rows and columns. @param rows the number of rows. @param cols the number of columns. @return the preferred dimensions required to display the text area with the specified number of rows and columns. @see java.awt.Component#getPreferredSize @since JDK1.1
    Class TextArea, int getRows()

    GetsReturns the number of rows in the text area. @return the number of rows in the text area. @see java.awt.TextArea#setRows(int) @see java.awt.TextArea#getColumns() @since JDK1
    Class TextArea, int getScrollbarVisibility()

    GetsReturns an enumerated value that indicates which scroll bars the text area uses.

    The TextArea class defines four integer constants that are used to specify which scroll bars are available. TextArea has one constructor that gives the application discretion over scroll bars. @return an integer that indicates which scroll bars are used. @see java.awt.TextArea#SCROLLBARS_BOTH @see java.awt.TextArea#SCROLLBARS_VERTICAL_ONLY @see java.awt.TextArea#SCROLLBARS_HORIZONTAL_ONLY @see java.awt.TextArea#SCROLLBARS_NONE @see java.awt.TextArea#TextArea(java.lang.String int int int) @since JDK1.1

    Class TextArea, void insert(String, int)

    Inserts the specified text at the specified position in this text area.

    Note that passing null or inconsistent parameters is invalid and will result in unspecified behavior. @param str the non-null text to insert. @param pos the position at which to insert. @see java.awt.TextComponent#setText @see java.awt.TextArea#replaceRange @see java.awt.TextArea#append @since JDK1.1

    Class TextArea, String paramString()

    Returns the parametera string representing the state of this text areaTextArea. This stringmethod is usefulintended to be used only for debugging purposes and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null. @return the parameter string of this text area.
    Class TextArea, void replaceRange(String, int, int)

    Replaces text between the indicated start and end positions with the specified replacement text. The text at the end position will not be replaced. The text at the start position will be replaced (unless the start position is the same as the end position). The text position is zero-based. The inserted substring may be of a different length than the text it replaces.

    Note that passing null or inconsistent parameters is invalid and will result in unspecified behavior. @param str the non-null text to use as the replacement. @param start the start position. @param end the end position. @see java.awt.TextArea#insert @since JDK1.1

    Class TextArea, void setColumns(int)

    Sets the number of columns for this text area. @param columns the number of columns. @see java.awt.TextArea#getColumns() @see java.awt.TextArea#setRows(int) @exception IllegalArgumentException if the value supplied for columns is less than 0. @since JDK1.1
    Class TextArea, void setRows(int)

    Sets the number of rows for this text area. @param rows the number of rows. @see java.awt.TextArea#getRows() @see java.awt.TextArea#setColumns(int) @exception IllegalArgumentException if the value supplied for rows is less than 0. @since JDK1.1

    Class TextComponent

    The TextComponent class is the superclass of any component that allows the editing of some text.

    A text component embodies a string of text. The TextComponent class defines a set of methods that determine whether or not this text is editable. If the component is editable it defines another set of methods that supports a text insertion caret.

    In addition the class defines methods that are used to maintain a current selection from the text. The text selection a substring of the component's text is the target of editing operations. It is also referred to as the selected text. @version 1.65 0471 12/2103/01 @author Sami Shaio @author Arthur van Hoff @since JDK1.0

    Class TextComponent, void addTextListener(TextListener)

    Adds the specified text event listener to receive text events from this text component. If l is null no exception is thrown and no action is performed. @param l the text event listener @see #removeTextListener @see #getTextListeners @see java.awt.event.TextListener
    Class TextComponent, int getCaretPosition()

    Gets the position of the text insertion caret for this text component. @return the position of the text insertion caret. @since JDK1.1
    Class TextComponent, EventListener[] getListeners(Class)

    ReturnReturns an array of all the listenersobjects that were addedcurrently registered as toFooListeners the TextComponentupon this withTextComponent. addXXXListener()FooListeners where XXX isare registered using the nameaddFooListener method.

    ofYou can specify the listenerType argument. For example to get all ofwith a class literal such as theFooListener.class. TextListeners forFor example theyou can query givena TextComponent t onefor its text listeners with the would writefollowing code:

     TextListener[] tls = (TextListener[])(t.getListeners(TextListener.class)) ;
    If no such listenerlisteners exist list exists thenthis method returns an empty array is returned. @param listenerType Typethe type of listeners requested; @returnthis all of theparameter should specify listenersan interface that descends from java.util.EventListener @return an array of the specified type supportedall objects registered as byFooListeners on this text component or an empty array if no such listeners have been added @exception ClassCastException if listenerType doesn't specify a class or interface that implements java.util.EventListener @see #getTextListeners @since 1.3
    Class TextComponent, String getSelectedText()

    GetsReturns the selected text from the text that is presented by this text component. @return the selected text of this text component. @see java.awt.TextComponent#select
    Class TextComponent, int getSelectionEnd()

    Gets the end position of the selected text in this text component. @return the end position of the selected text. @see java.awt.TextComponent#setSelectionEnd @see java.awt.TextComponent#getSelectionStart
    Class TextComponent, int getSelectionStart()

    Gets the start position of the selected text in this text component. @return the start position of the selected text. @see java.awt.TextComponent#setSelectionStart @see java.awt.TextComponent#getSelectionEnd
    Class TextComponent, String getText()

    GetsReturns the text that is presented by this text component. @see java.awt.TextComponent#setText
    Class TextComponent, String paramString()

    Returns the parametera string representing the state of this text componentTextComponent. This stringmethod is usefulintended to be used only for debugging purposes and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null. @return the parameter string of this text component.
    Class TextComponent, void processEvent(AWTEvent)

    Processes events on this text component. If the event is a TextEvent it invokes the processTextEvent method else it invokes its superclass's processEvent.

    Note that if the event parameter is null the behavior is unspecified and may result in an exception. @param e the event

    Class TextComponent, void processTextEvent(TextEvent)

    Processes text events occurring on this text component by dispatching them to any registered TextListener objects.

    NOTE: This method will not be called unless text events are enabled for this component. This happens when one of the following occurs: a)

    Component#enableEvents

    Note that if the event parameter is null the behavior is unspecified and may result in an exception. @param e the text event @see Component#enableEvents

    Class TextComponent, void removeNotify()

    Removes the TextComponent's peer. The peer allows us to modify the appearance of the TextComponent without changing its functionality.
    Class TextComponent, void removeTextListener(TextListener)

    Removes the specified text event listener so that it no longer receives text events from this text component If l is null no exception is thrown and no action is performed. @param l the text listener. @see java.awt.event.TextListener#addTextListener @see #getTextListeners @see java.awt.TextComponent#addTextListenerevent.TextListener @since JDK1.1
    Class TextComponent, void select(int, int)

    Selects the text between the specified start and end positions.

    This method sets the start and end positions of the selected text enforcing the restriction that the start position must be greater than or equal to zero. The end position must be greater than or equal to the start position and less than or equal to the length of the text component's text. The character positions are indexed starting with zero. The length of the selection is endPosition - startPosition so the character at endPosition is not selected. If the start and end positions of the selected text are equal all text is deselected.

    If the caller supplies values that are inconsistent or out of bounds the method enforces these constraints silently and without failure. Specifically if the start position or end position is greater than the length of the text it is reset to equal the text length. If the start position is less than zero it is reset to zero and if the end position is less than the start position it is reset to the start position. @param selectionStart the zero-based index of the first character to be selected. @param selectionEnd the zero-based end position of the text to be selected. The; the character at selectionEnd is not selected. @see java.awt.TextComponent#setSelectionStart @see java.awt.TextComponent#setSelectionEnd @see java.awt.TextComponent#selectAll

    Class TextComponent, void setCaretPosition(int)

    Sets the position of the text insertion caret for this text component. The caret position is constrained to be at or before the current selection end. If the caller supplies a value for position that is greater than the end of the component's text the caret position is set to the end of the component's text. This happens silently and without failure. The caret position also cannot be set to less than zero the beginning of the component's text. If the caller supplies a value for position that is less than zero an IllegalArgumentException is thrown. @param position the position of the text insertion caret. @exception IllegalArgumentException if the value supplied for position is less than zero. @since JDK1.1
    Class TextComponent, void setSelectionEnd(int)

    Sets the selection end for this text component to the specified position. The new end point is constrained to be at or after the current selection start. It also cannot be set beyond the end of the component's text. If the caller supplies a value for selectionEnd that is out of bounds the method enforces these constraints silently and without failure. @param selectionEnd the end position of the selected text. @see java.awt.TextComponent#getSelectionEnd @see java.awt.TextComponent#setSelectionStart @since JDK1.1
    Class TextComponent, void setSelectionStart(int)

    Sets the selection start for this text component to the specified position. The new start point is constrained to be at or before the current selection end. It also cannot be set to less than zero the beginning of the component's text. If the caller supplies a value for selectionStart that is out of bounds the method enforces these constraints silently and without failure. @param selectionStart the start position of the selected text. @see java.awt.TextComponent#getSelectionStart @see java.awt.TextComponent#setSelectionEnd @since JDK1.1
    Class TextComponent, void setText(String)

    Sets the text that is presented by this text component to be the specified text. @param t the new text. If; if this parameter is null then the text is set to the empty string "". @see java.awt.TextComponent#getText

    Class TextField

    A TextField object is a text component that allows for the editing of a single line of text.

    For example the following image depicts a frame with four text fields of varying widths. Two of these text fields display the predefined text "Hello".

    Here is the code that produces these four text fields:


     TextField tf1 tf2 tf3 tf4; // a blank text field tf1 = new TextField(); // blank field of 20 columns tf2 = new TextField("" 20); // predefined text displayed tf3 = new TextField("Hello "); // predefined text in 30 columns tf4 = new TextField("Hello" 30); 

    Every time the user types a key in the text field one or more key events are sent to the text field. A KeyEvent may be one of three types: keyPressed keyReleased or keyTyped. The properties of a key event indicate which of these types it is as well as additional information about the event such as what modifiers are applied to the key event and the time at which the event occurred.

    The key event is passed to every KeyListener or KeyAdapter object which registered to receive such events using the component's addKeyListener method. (KeyAdapter objects implement the KeyListener interface.)

    It is also possible to fire an ActionEvent. If action events are enabled for the text field they may be fired by pressing the Return key.

    The TextField class's processEvent method examines the action event and passes it along to processActionEvent. The latter method redirects the event to any ActionListener objects that have registered to receive action events generated by this text field. @version 1.63 0471 12/0603/0001 @author Sami Shaio @see java.awt.event.KeyEvent @see java.awt.event.KeyAdapter @see java.awt.event.KeyListener @see java.awt.event.ActionEvent @see java.awt.Component#addKeyListener @see java.awt.TextField#processEvent @see java.awt.TextField#processActionEvent @see java.awt.TextField#addActionListener @since JDK1.0

    Class TextField, constructor TextField()

    Constructs a new text field. @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true. @see java.awt.GraphicsEnvironment#isHeadless
    Class TextField, constructor TextField(String)

    Constructs a new text field initialized with the specified text. @param text the text to be displayed. If text is null the empty string "" will be displayed. @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true. @see java.awt.GraphicsEnvironment#isHeadless
    Class TextField, constructor TextField(String, int)

    Constructs a new text field initialized with the specified text to be displayed and wide enough to hold the specified number of columns. A column is an approximate average character width that is platform-dependent. @param text the text to be displayed. If text is null the empty string "" will be displayed. @param columns the number of columns. If columns is less than 0 columns is set to 0. @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true. @see java.awt.GraphicsEnvironment#isHeadless
    Class TextField, constructor TextField(int)

    Constructs a new empty text field with the specified number of columns. A column is an approximate average character width that is platform-dependent. @param columns the number of columns. If columns is less than 0 columns is set to 0. @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true. @see java.awt.GraphicsEnvironment#isHeadless
    Class TextField, void addActionListener(ActionListener)

    Adds the specified action listener to receive action events from this text field. If l is null no exception is thrown and no action is performed. @param l the action listener. @see java.awt.event#ActionListenerremoveActionListener @see #getActionListeners @see java.awt.TextField#removeActionListenerevent.ActionListener @since JDK1.1
    Class TextField, EventListener[] getListeners(Class)

    ReturnReturns an array of all the listenersobjects that were addedcurrently registered as toFooListeners the TextFieldupon this withTextField. addXXXListener()FooListeners where XXX isare registered using the nameaddFooListener ofmethod.

    You can specify the listenerType argument. For example to get all ofwith a class literal such as theFooListener.class. ActionListener(s)For forexample theyou can givenquery a TextField t onefor its action listeners with the would writefollowing code:

     ActionListener[] als = (ActionListener[])(t.getListeners(ActionListener.class)) ;
    If no such listenerlisteners exist list exists thenthis method returns an empty array is returned. @param listenerType Typethe type of listeners requested; this parameter should specify an interface that descends from java.util.EventListener @return allan array of theall objects registered as FooListeners on this textfield or an empty array if no such listeners of the specifiedhave been added type@exception supported byClassCastException if thislistenerType doesn't specify a class or interface
    textthat implements java.util.EventListener @see field#getActionListeners @since 1.3
    Class TextField, String paramString()

    Returns the parametera string representing the state of this text fieldTextField. This stringmethod is usefulintended to be used only for debugging purposes and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null. @return the parameter string of this text field.
    Class TextField, void processActionEvent(ActionEvent)

    Processes action events occurring on this text field by dispatching them to any registered ActionListener objects.

    This method is not called unless action events are enabled for this component. Action events are enabled when one of the following occurs:

    Note that if the event parameter is null the behavior is unspecified and may result in an exception. @param e the action event. @see java.awt.event.ActionListener @see java.awt.TextField#addActionListener @see java.awt.Component#enableEvents @since JDK1.1

    Class TextField, void processEvent(AWTEvent)

    Processes events on this text field. If the event is an instance of ActionEvent it invokes the processActionEvent method. Otherwise it invokes processEvent on the superclass.

    Note that if the event parameter is null the behavior is unspecified and may result in an exception. @param e the event. @see java.awt.event.ActionEvent @see java.awt.TextField#processActionEvent @since JDK1.1

    Class TextField, void removeActionListener(ActionListener)

    Removes the specified action listener so that it no longer receives action events from this text field. If l is null no exception is thrown and no action is performed. @param l the action listener. @see java.awt.event#ActionListeneraddActionListener @see #getActionListeners @see java.awt.TextField#addActionListenerevent.ActionListener @since JDK1.1

    Class TexturePaint

    The TexturePaint class provides a way to fill a Shape with a texture that is specified as a BufferedImage The size of the BufferedImage object should be small because the BufferedImage data is copied by the TexturePaint object. At construction time the texture is anchored to the upper left corner of a Rectangle2D that is specified in user space. Texture is computed for locations in the device space by conceptually replicating the specified Rectangle2D infinitely in all directions in user space and mapping the BufferedImage to each replicated Rectangle2D. @see Paint @see Graphics2D#setPaint @version 1.36 0237 12/0203/0001

    Class Toolkit

    This class is the abstract superclass of all actual implementations of the Abstract Window Toolkit. Subclasses of Toolkit are used to bind the various components to particular native toolkit implementations.

    Most applications should not call any of the methods in this class directly. The methods defined by Toolkit are the "glue" that joins the platform-independent classes in the java.awt package with their counterparts in java.awt.peer. Some methods defined by Toolkit query the native operating system directly. @version 1.156 02181 12/0903/01 @author Sami Shaio @author Arthur van Hoff @author Fred Ecks @since JDK1.0

    Class Toolkit, void addAWTEventListener(AWTEventListener, long)

    Adds an AWTEventListener to receive all AWTEvents dispatched system-wide that conform to the given eventMask.

    First if there is a security manager its checkPermission method is called with an AWTPermission("listenToAllAWTEvents") permission. This may result in a SecurityException.

    eventMask is a bitmask of event types to receive. It is constructed by bitwise OR-ing together the event masks defined in AWTEvent.

    Note: event listener use is not recommended for normal application use but are intended solely to support special purpose facilities including support for accessibility event record/playback and diagnostic tracing. If listener is null no exception is thrown and no action is performed. @param listener the event listener. @param eventMask the bitmask of event types to receive @throws SecurityException if a security manager exists and its checkPermission method doesn't allow the operation. @see java.awt.event.AWTEventListener#removeAWTEventListener @see #getAWTEventListeners @see SecurityManager#checkPermission @see java.awt.Toolkit#addAWTEventListenerAWTEvent @see java.awt.AWTEventAWTPermission @see SecurityManager#checkPermissionjava.awt.event.AWTEventListener @see java.awt.AWTPermissionevent.AWTEventListenerProxy @since 1.2

    Class Toolkit, void addPropertyChangeListener(String, PropertyChangeListener)

    addAdds the specified property change listener for the named desktop property. If pcl is null no exception is thrown and no action is performed. @param name The name of the property to listen for @param pcl The property change listener @since 1.2
    Class Toolkit, ButtonPeer createButton(Button)

    Creates this toolkit's implementation of Button using the specified peer interface. @param target the button to be implemented. @return this toolkit's implementation of Button. @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true @see java.awt.GraphicsEnvironment#isHeadless @see java.awt.Button @see java.awt.peer.ButtonPeer
    Class Toolkit, CheckboxPeer createCheckbox(Checkbox)

    Creates this toolkit's implementation of Checkbox using the specified peer interface. @param target the check box to be implemented. @return this toolkit's implementation of Checkbox. @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true @see java.awt.GraphicsEnvironment#isHeadless @see java.awt.Checkbox @see java.awt.peer.CheckboxPeer
    Class Toolkit, CheckboxMenuItemPeer createCheckboxMenuItem(CheckboxMenuItem)

    Creates this toolkit's implementation of CheckboxMenuItem using the specified peer interface. @param target the checkbox menu item to be implemented. @return this toolkit's implementation of CheckboxMenuItem. @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true @see java.awt.GraphicsEnvironment#isHeadless @see java.awt.CheckboxMenuItem @see java.awt.peer.CheckboxMenuItemPeer
    Class Toolkit, ChoicePeer createChoice(Choice)

    Creates this toolkit's implementation of Choice using the specified peer interface. @param target the choice to be implemented. @return this toolkit's implementation of Choice. @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true @see java.awt.GraphicsEnvironment#isHeadless @see java.awt.Choice @see java.awt.peer.ChoicePeer
    Class Toolkit, Cursor createCustomCursor(Image, Point, String)

    Creates a new custom cursor object. If the image to display is invalid the cursor will be hidden (made completely transparent) and the hotspot will be set to (0 0). @param image the image to display when the cursor is active. @param hotSpot the X and Y of the large cursor's hot spot. The hotSpot values must be less than the Dimension returned by getBestCursorSize(). @param name a localized description of the cursor for Java Accessibility use. @exception IndexOutOfBoundsException if the hotSpot values are outside the bounds of the cursor. @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true @see java.awt.GraphicsEnvironment#isHeadless @since 1.2
    Class Toolkit, DialogPeer createDialog(Dialog)

    Creates this toolkit's implementation of Dialog using the specified peer interface. @param target the dialog to be implemented. @return this toolkit's implementation of Dialog. @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true @see java.awt.GraphicsEnvironment#isHeadless @see java.awt.Dialog @see java.awt.peer.DialogPeer
    Class Toolkit, DragGestureRecognizer createDragGestureRecognizer(Class, DragSource, Component, int, DragGestureListener)

    createCreates a concrete platform dependent subclass of the abstract DragGestureRecognizer class requested and associateassociates it with the DragSource Component and DragGestureListener specified. subclasses should override this to provide their own implementation @param abstractRecognizerClass The abstract class of the required recognizer @param ds The DragSource @param c The Component target for the DragGestureRecognizer @param srcActions The actions permitted for the gesture @param dgl The DragGestureListener @Return the new object or null. Always returns null if GraphicsEnvironment.isHeadless() returns true. @see java.awt.GraphicsEnvironment#isHeadless
    Class Toolkit, DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent)

    createCreates the peer for a DragSourceContext. Always throws InvalidDndOperationException if GraphicsEnvironment.isHeadless() returns true. @see java.awt.GraphicsEnvironment#isHeadless
    Class Toolkit, FileDialogPeer createFileDialog(FileDialog)

    Creates this toolkit's implementation of FileDialog using the specified peer interface. @param target the file dialog to be implemented. @return this toolkit's implementation of FileDialog. @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true @see java.awt.GraphicsEnvironment#isHeadless @see java.awt.FileDialog @see java.awt.peer.FileDialogPeer
    Class Toolkit, FramePeer createFrame(Frame)

    Creates this toolkit's implementation of Frame using the specified peer interface. @param target the frame to be implemented. @return this toolkit's implementation of Frame. @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true @see java.awt.GraphicsEnvironment#isHeadless @see java.awt.Frame @see java.awt.peer.FramePeer
    Class Toolkit, LabelPeer createLabel(Label)

    Creates this toolkit's implementation of Label using the specified peer interface. @param target the label to be implemented. @return this toolkit's implementation of Label. @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true @see java.awt.GraphicsEnvironment#isHeadless @see java.awt.Label @see java.awt.peer.LabelPeer
    Class Toolkit, ListPeer createList(List)

    Creates this toolkit's implementation of List using the specified peer interface. @param target the list to be implemented. @return this toolkit's implementation of List. @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true @see java.awt.GraphicsEnvironment#isHeadless @see java.awt.List @see java.awt.peer.ListPeer
    Class Toolkit, MenuPeer createMenu(Menu)

    Creates this toolkit's implementation of Menu using the specified peer interface. @param target the menu to be implemented. @return this toolkit's implementation of Menu. @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true @see java.awt.GraphicsEnvironment#isHeadless @see java.awt.Menu @see java.awt.peer.MenuPeer
    Class Toolkit, MenuBarPeer createMenuBar(MenuBar)

    Creates this toolkit's implementation of MenuBar using the specified peer interface. @param target the menu bar to be implemented. @return this toolkit's implementation of MenuBar. @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true @see java.awt.GraphicsEnvironment#isHeadless @see java.awt.MenuBar @see java.awt.peer.MenuBarPeer
    Class Toolkit, MenuItemPeer createMenuItem(MenuItem)

    Creates this toolkit's implementation of MenuItem using the specified peer interface. @param target the menu item to be implemented. @return this toolkit's implementation of MenuItem. @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true @see java.awt.GraphicsEnvironment#isHeadless @see java.awt.MenuItem @see java.awt.peer.MenuItemPeer
    Class Toolkit, PopupMenuPeer createPopupMenu(PopupMenu)

    Creates this toolkit's implementation of PopupMenu using the specified peer interface. @param target the popup menu to be implemented. @return this toolkit's implementation of PopupMenu. @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true @see java.awt.GraphicsEnvironment#isHeadless @see java.awt.PopupMenu @see java.awt.peer.PopupMenuPeer @since JDK1.1
    Class Toolkit, ScrollPanePeer createScrollPane(ScrollPane)

    Creates this toolkit's implementation of ScrollPane using the specified peer interface. @param target the scroll pane to be implemented. @return this toolkit's implementation of ScrollPane. @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true @see java.awt.GraphicsEnvironment#isHeadless @see java.awt.ScrollPane @see java.awt.peer.ScrollPanePeer @since JDK1.1
    Class Toolkit, ScrollbarPeer createScrollbar(Scrollbar)

    Creates this toolkit's implementation of Scrollbar using the specified peer interface. @param target the scroll bar to be implemented. @return this toolkit's implementation of Scrollbar. @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true @see java.awt.GraphicsEnvironment#isHeadless @see java.awt.Scrollbar @see java.awt.peer.ScrollbarPeer
    Class Toolkit, TextAreaPeer createTextArea(TextArea)

    Creates this toolkit's implementation of TextArea using the specified peer interface. @param target the text area to be implemented. @return this toolkit's implementation of TextArea. @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true @see java.awt.GraphicsEnvironment#isHeadless @see java.awt.TextArea @see java.awt.peer.TextAreaPeer
    Class Toolkit, TextFieldPeer createTextField(TextField)

    Creates this toolkit's implementation of TextField using the specified peer interface. @param target the text field to be implemented. @return this toolkit's implementation of TextField. @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true @see java.awt.GraphicsEnvironment#isHeadless @see java.awt.TextField @see java.awt.peer.TextFieldPeer
    Class Toolkit, WindowPeer createWindow(Window)

    Creates this toolkit's implementation of Window using the specified peer interface. @param target the window to be implemented. @return this toolkit's implementation of Window. @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true @see java.awt.GraphicsEnvironment#isHeadless @see java.awt.Window @see java.awt.peer.WindowPeer
    Class Toolkit, Dimension getBestCursorSize(int, int)

    Returns the supported cursor dimension which is closest to the desired sizes. Systems which only support a single cursor size will return that size regardless of the desired sizes. Systems which don't support custom cursors will return a dimension of 0 0.

    Note: if an image is used whose dimensions don't match a supported size (as returned by this method) the Toolkit implementation will attempt to resize the image to a supported size. Since converting low-resolution images is difficult no guarantees are made as to the quality of a cursor image which isn't a supported size. It is therefore recommended that this method be called and an appropriate image used so no image conversion is made. @param desiredWidth the preferred cursor width the component would like to use. @param desiredHeight the preferred cursor height the component would like to use. @return the closest matching supported cursor size or a dimension of 0 0 if the Toolkit implementation doesn't support custom cursors. @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true @see java.awt.GraphicsEnvironment#isHeadless @since 1.2

    Class Toolkit, ColorModel getColorModel()

    Determines the color model of this toolkit's screen.

    ColorModel is an abstract class that encapsulates the ability to translate between the pixel values of an image and its red green blue and alpha components.

    This toolkit method is called by the getColorModel method of the Component class. @return the color model of this toolkit's screen. @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true @see java.awt.GraphicsEnvironment#isHeadless @see java.awt.image.ColorModel @see java.awt.Component#getColorModel

    Class Toolkit, Object getDesktopProperty(String)

    obtainObtains a value for the specified desktop property. A desktop property is a uniquely named value for a resource that is Toolkit global in nature. Usually it also is an abstract representation for an underlying platform dependent desktop setting.
    Class Toolkit, FontMetrics getFontMetrics(Font)

    Gets the screen device metrics for rendering of the font. @param font a font. @return the screen metrics of the specified font in this toolkit. @deprecated This returns integer metricsAs of JDK version for1.2 replaced by the defaultFont method screengetLineMetrics. @see java.awt.font.LineMetrics @see java.awt.Font#getLineMetrics @see java.awt.GraphicsEnvironment#getScreenDevices
    Class Toolkit, FontPeer getFontPeer(String, int)

    Creates this toolkit's implementation of Font using the specified peer interface. @param targetname the font to be implemented. @param style the style of the font such as PLAIN BOLD ITALIC or a combination @return this toolkit's implementation of Font. @see java.awt.Font @see java.awt.peer.FontPeer @see java.awt.GraphicsEnvironment#getAllFonts @deprecated see java.awt.GraphicsEnvironment#getAllFonts
    Class Toolkit, Image getImage(String)

    Returns an image which gets pixel data from the specified file whose format can be either GIF JPEG or PNG. The underlying toolkit attempts to resolve multiple requests with the same filename to the same returned Image. Since the mechanism required to facilitate this sharing of Image objects may continue to hold onto images that are no longer of use for an indefinateindefinite period of time developers are encouraged to implement their own caching of images by using the createImage variant wherever available. @param filename the name of a file containing pixel data in a recognized file format. @return an image which gets its pixel data from the specified file. @see #createImage(java.lang.String)
    Class Toolkit, Image getImage(URL)

    Returns an image which gets pixel data from the specified URL. The pixel data referenced by the specified URL must be in one of the following formats: GIF JPEG or PNG. The underlying toolkit attempts to resolve multiple requests with the same URL to the same returned Image. Since the mechanism required to facilitate this sharing of Image objects may continue to hold onto images that are no longer of use for an indefinateindefinite period of time developers are encouraged to implement their own caching of images by using the createImage variant wherever available. @param url the URL to use in fetching the pixel data. @return an image which gets its pixel data from the specified URL. @see #createImage(java.net.URL)
    Class Toolkit, boolean getLockingKeyState(int)

    Returns whether the given locking key on the keyboard is currently in its "on" state. Valid key codes are VK_CAPS_LOCK VK_NUM_LOCK VK_SCROLL_LOCK and VK_KANA_LOCK @exception java.lang.IllegalArgumentException if keyCode is not one of the valid key codes @exception java.lang.UnsupportedOperationException if the host system doesn't allow getting the state of this key programmatically or if the keyboard doesn't have this key @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true @see java.awt.GraphicsEnvironment#isHeadless @since 1.3
    Class Toolkit, int getMaximumCursorColors()

    Returns the maximum number of colors the Toolkit supports in a custom cursor palette.

    Note: if an image is used which has more colors in its palette than the supported maximum the Toolkit implementation will attempt to flatten the palette to the maximum. Since converting low-resolution images is difficult no guarantees are made as to the quality of a cursor image which has more colors than the system supports. It is therefore recommended that this method be called and an appropriate image used so no image conversion is made. @return the maximum number of colors or zero if custom cursors are not supported by this Toolkit implementation. @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true @see java.awt.GraphicsEnvironment#isHeadless @since 1.2

    Class Toolkit, int getMenuShortcutKeyMask()

    Determines which modifier key is the appropriate accelerator key for menu shortcuts.

    Menu shortcuts which are embodied in the MenuShortcut class are handled by the MenuBar class.

    By default this method returns Event.CTRL_MASK. Toolkit implementations should override this method if the Control key isn't the correct key for accelerators. @return the modifier mask on the Event class that is used for menu shortcuts on this toolkit. @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true @see java.awt.GraphicsEnvironment#isHeadless @see java.awt.MenuBar @see java.awt.MenuShortcut @since JDK1.1

    Class Toolkit, PrintJob getPrintJob(Frame, String, JobAttributes, PageAttributes)

    Gets a PrintJob object which is the result of initiating a print operation on the toolkit's platform.

    Each actual implementation of this method should first check if there is a security manager installed. If there is the method should call the security manager's checkPrintJobAccess method to ensure initiation of a print operation is allowed. If the default implementation of checkPrintJobAccess is used (that is that method is not overriden) then this results in a call to the security manager's checkPermission method with a RuntimePermission("queuePrintJob") permission. @param frame the parent of the print dialog. May be null if and only if jobAttributes is not null and jobAttributes.getDialog() returns JobAttributes.DialogType.NONE or JobAttributes.DialogType.COMMON. @param jobtitle the title of the PrintJob. A null title is equivalent to "". @param jobAttributes a set of job attributes which will control the PrintJob. The attributes will be updated to reflect the user's choices as outlined in the JobAttributes documentation. May be null. @param pageAttributes a set of page attributes which will control the PrintJob. The attributes will be applied to every page in the job. The attributes will be updated to reflect the user's choices as outlined in the PageAttributes documentation. May be null. @return a PrintJob object or null if the user cancelled the print job. @throws NullPointerException if frame is null and either jobAttributes is null or jobAttributes.getDialog() returns JobAttributes.DialogType.NATIVE. @throws IllegalArgumentException if pageAttributes specifies differing cross feed and feed resolutions. This exception is always thrown when GraphicsEnvironment.isHeadless() returns true. @throws SecurityException if this thread is not allowed to initiate a print job request or if jobAttributes specifies print to file and this thread is not allowed to access the file system @see java.awt.PrintJob @see java.awt.GraphicsEnvironment#isHeadless @see java.lang.RuntimePermission @see java.awt.JobAttributes @see java.awt.PageAttributes @since 1.3

    Class Toolkit, PrintJob getPrintJob(Frame, String, Properties)

    Gets a PrintJob object which is the result of initiating a print operation on the toolkit's platform.

    Each actual implementation of this method should first check if there is a security manager installed. If there is the method should call the security manager's checkPrintJobAccess method to ensure initiation of a print operation is allowed. If the default implementation of checkPrintJobAccess is used (that is that method is not overriden) then this results in a call to the security manager's checkPermission method with a RuntimePermission("queuePrintJob") permission. @param frame the parent of the print dialog. May not be null. @param jobtitle the title of the PrintJob. A null title is equivalent to "". @param props a Properties object containing zero or more properties. Properties are not standardized and are not consistent across implementations. Because of this PrintJobs which require job and page control should use the version of this function which takes JobAttributes and PageAttributes objects. This object may be updated to reflect the user's job choices on exit. May be null. @return a PrintJob object or null if the user cancelled the print job. @throws NullPointerException if frame is null. This exception is always thrown when GraphicsEnvironment.isHeadless() returns true. @throws SecurityException if this thread is not allowed to initiate a print job request @see java.awt.GraphicsEnvironment#isHeadless @see java.awt.PrintJob @see java.lang.RuntimePermission @since JDK1.1

    Class Toolkit, int getScreenResolution()

    Returns the screen resolution in dots-per-inch. @return this toolkit's screen resolution in dots-per-inch. @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true @see java.awt.GraphicsEnvironment#isHeadless
    Class Toolkit, Dimension getScreenSize()

    Gets the size of the screen. On systems with multiple displays the primary display is used. Multi-screen aware display dimensions are available from GraphicsConfiguration and GraphicsDevice. @return the size of this toolkit's screen in pixels. @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true @see java.awt.GraphicsConfiguration#getBounds @see java.awt.GraphicsEnvironment#getDisplayMode @see java.awt.GraphicsEnvironment#isHeadless
    Class Toolkit, Clipboard getSystemClipboard()

    Gets the singleton instance of the system Clipboard which interfaces with clipboard facilities provided by the native platform. This clipboard enables data transfer between Java programs and native applications which use native clipboard facilities.

    In addition to any and all formats specified in the flavormap.properties file or other file specified by the AWT.DnD.flavorMapFileURL Toolkit property text returned by the system Clipboard's getTransferData() method is available in the following flavors:

    As with java.awt.datatransfer.StringSelection if the requested flavor is DataFlavor.plainTextFlavor or an equivalent flavor a Reader is returned. Note: The behavior of the system Clipboard's getTransferData() method for DataFlavor.plainTextFlavor and equivalent DataFlavors is inconsistent with the definition of DataFlavor.plainTextFlavor . Because of this support for DataFlavor.plainTextFlavor and equivalent flavors is deprecated.

    Each actual implementation of this method should first check if there is a security manager installed. If there is the method should call the security manager's checkSystemClipboardAccess method to ensure it's ok to to access the system clipboard. If the default implementation of checkSystemClipboardAccess is used (that is that method is not overriden) then this results in a call to the security manager's checkPermission method with an AWTPermission("accessClipboard") permission. @return the system Clipboard @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true @see java.awt.GraphicsEnvironment#isHeadless @see java.awt.datatransfer.Clipboard @see java.awt.datatransfer.StringSelection @see java.awt.datatransfer.DataFlavor.stringFlavor @see java.awt.datatransfer.DataFlavor.plainTextFlavor @see java.io.Reader @see java.awt.AWTPermission @since JDK1.1

    Class Toolkit, void loadSystemColors(int[])

    Fills in the integer array that is supplied as an argument with the current system color values. @param an integer array. @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true @see java.awt.GraphicsEnvironment#isHeadless @since JDK1.1
    Class Toolkit, Map mapInputMethodHighlight(InputMethodHighlight)

    Returns a map of visual attributes for the abstract level description of the given input method highlight or null if no mapping is found. The style field of the input method highlight is ignored. The map returned is unmodifiable. @param highlight input method highlight @return style attribute map or null @exception HeadlessException if GraphicsEnvironment.isHeadless returns true @see java.awt.GraphicsEnvironment#isHeadless @since 1.3
    Class Toolkit, void removeAWTEventListener(AWTEventListener)

    Removes an AWTEventListener from receiving dispatched AWTEvents.

    First if there is a security manager its checkPermission method is called with an AWTPermission("listenToAllAWTEvents") permission. This may result in a SecurityException.

    Note: event listener use is not recommended for normal application use but are intended solely to support special purpose facilities including support for accessibility event record/playback and diagnostic tracing. If listener is null no exception is thrown and no action is performed. @param listener the event listener. @throws SecurityException if a security manager exists and its checkPermission method doesn't allow the operation. @see java.awt.event.AWTEventListener#addAWTEventListener @see #getAWTEventListeners @see SecurityManager#checkPermission @see java.awt.Toolkit#addAWTEventListenerAWTEvent @see java.awt.AWTEventAWTPermission @see SecurityManager#checkPermissionjava.awt.event.AWTEventListener @see java.awt.AWTPermissionevent.AWTEventListenerProxy @since 1.2

    Class Toolkit, void removePropertyChangeListener(String, PropertyChangeListener)

    removeRemoves the specified property change listener for the named desktop property. If pcl is null no exception is thrown and no action is performed. @param name The name of the property to remove @param pcl The property change listener @since 1.2
    Class Toolkit, void setDesktopProperty(String, Object)

    setSets the named desktop property to the specified value and firefires a property change event to notify any listeners that the value has changed.
    Class Toolkit, void setLockingKeyState(int, boolean)

    Sets the state of the given locking key on the keyboard. Valid key codes are VK_CAPS_LOCK VK_NUM_LOCK VK_SCROLL_LOCK and VK_KANA_LOCK

    Depending on the platform setting the state of a locking key may involve event processing and therefore may not be immediately observable through getLockingKeyState. @exception java.lang.IllegalArgumentException if keyCode is not one of the valid key codes @exception java.lang.UnsupportedOperationException if the host system doesn't allow setting the state of this key programmatically or if the keyboard doesn't have this key @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true @see java.awt.GraphicsEnvironment#isHeadless @since 1.3


    Class Transparency

    The Transparency interface defines the common transparency modes for implementing classes. @version 1.17 0218 12/0203/0001

    Class Window

    A Window object is a top-level window with no borders and no menubar. The default layout for a window is BorderLayout.

    A window must have either a frame dialog or another window defined as its owner when it's constructed.

    In a multi-screen environment you can create a Window on a different screen device by constructing the Window with GraphicsConfiguration) The GraphicsConfiguration object is one of the GraphicsConfiguration objects of the target screen device.

    In a virtual device multi-screen environment in which the desktop area could span multiple physical screen devices the bounds of all configurations are relative to the virtual device coordinate system. The origin of the virtual-coordinate system is at the upper left-hand corner of the primary physical screen. Depending on the location of the primary screen in the virtual device negative coordinates are possible as shown in the following figure.

    In such an environment when calling setLocation you must pass a virtual coordinate to this method. Similarly calling getLocationOnScreen on a Window returns virtual device coordinates. Call the getBounds method of a GraphicsConfiguration to find its origin in the virtual coordinate system.

    The following code sets the location of a Window at (10 10) relative to the origin of the physical screen of the corresponding GraphicsConfiguration. If the bounds of the GraphicsConfiguration is not taken into account the Window location would be set at (10 10) relative to the virtual-coordinate system and would appear on the primary physical screen which might be different from the physical screen of the specified GraphicsConfiguration.

     Window w = new Window(Window owner GraphicsConfiguration gc); Rectangle bounds = gc.getBounds(); w.setLocation(10 + bounds.x 10 + bounds.y); 

    Windows are capable of generating the following window eventsWindowEvents: WindowOpened WindowClosed WindowGainedFocus WindowLostFocus. @version 1.138 06169 12/1503/01 @author Sami Shaio @author Arthur van Hoff @see WindowEvent @see #addWindowListener @see java.awt.BorderLayout @since JDK1.0


    Class Window.AccessibleAWTWindow, AccessibleRole getAccessibleRole()

    Get the role of this object. @return an instance of AccessibleRole describing the role of the object @see javax.accessibility.AccessibleRole
    Class Window.AccessibleAWTWindow, AccessibleStateSet getAccessibleStateSet()

    Get the state of this object. @return an instance of AccessibleStateSet containing the current state set of the object @see javax.accessibility.AccessibleState

    Class Window, constructor Window(Frame)

    Constructs a new invisible window with the specified Frame as its owner. The Window will not be focusable unless its owner is showing on the screen.

    If there is a security manager this method first calls the security manager's checkTopLevelWindow method with this as its argument to determine whether or not the window must be displayed with a warning banner. @param owner the Frame to act as owner @exception IllegalArgumentException if the owner's gcGraphicsConfiguration is not from a screen device. @exception java.lang.IllegalArgumentException if owner is null; this exception is always thrown when GraphicsEnvironment.isHeadless returns true @see java.awt.GraphicsEnvironment#isHeadless @see java.lang.SecurityManager#checkTopLevelWindow @see #isShowing

    Class Window, constructor Window(Window)

    Constructs a new invisible window with the specified Window as its owner. The Window will not be focusable unless its nearest owning Frame or Dialog is showing on the screen.

    If there is a security manager this method first calls the security manager's checkTopLevelWindow method with this as its argument to determine whether or not the window must be displayed with a warning banner. @param owner the Window to act as owner @exception IllegalArgumentException if the owner's GraphicsConfiguration is not from a screen device @exception java.lang.IllegalArgumentException if owner is null. This exception is always thrown when GraphicsEnvironment.isHeadless() returns true. @see java.awt.GraphicsEnvironment#isHeadless @see java.lang.SecurityManager#checkTopLevelWindow @see #isShowing @since 1.2

    Class Window, constructor Window(Window, GraphicsConfiguration)

    Constructs a new invisible window with the specified window as its owner and a GraphicsConfiguration of a screen device. The Window will not be focusable unless its nearest owning Frame or Dialog is showing on the screen.

    If there is a security manager this method first calls the security manager's checkTopLevelWindow method with this as its argument to determine whether or not the window must be displayed with a warning banner. @param owner the window to act as owner @param gc the GraphicsConfiguration of the target screen device. If; if gc is null the system default GraphicsConfiguration is assumed. @throws IllegalArgumentException if owner is null. @throws IllegalArgumentException if gc is not from a screen device; this exception is always thrown when GraphicsEnvironment.isHeadless returns true @see java.langawt.SecurityManagerGraphicsEnvironment#checkTopLevelWindowisHeadless @see java.awtlang.SecurityManager#checkTopLevelWindow @see GraphicsConfiguration#getBounds @see #isShowing @since 1.3

    Class Window, void addWindowListener(WindowListener)

    Adds the specified window listener to receive window events from this window. If l is null no exception is thrown and no action is performed. @param l the window listener @see #removeWindowListener @see #getWindowListeners
    Class Window, void applyResourceBundle(ResourceBundle)

    ApplyApplies the settings in the given ResourceBundle to this Window. Currently this applies the ResourceBundle's ComponentOrientation to this Window and all components contained within it. @see java.awt.ComponentOrientation @since 1.2 @deprecated As of J2SE 1.4 replaced by Component.applyComponentOrientation
    Class Window, void applyResourceBundle(String)

    LoadLoads the ResourceBundle with the given name using the default locale and apply its settings to this window. Currently this applies the ResourceBundle'sits ComponentOrientation to this Window and all components contained within it. @see java.awt.ComponentOrientation @since 1.2 @deprecated As of J2SE 1.4 replaced by Component.applyComponentOrientation
    Class Window, void dispose()

    Releases all of the native screen resources used by this Window its subcomponents and all of its owned children. That is the resources for these Components will be destroyed any memory they consume will be returned to the OS and they will be marked as undisplayable.

    The Window and its subcomponents can be made displayable again by rebuilding the native resources with a subsequent call to pack or show. The states of the recreated Window and its subcomponents will be identical to the states of these objects at the point where the Window was disposed (not accounting for additional modifcations between those actions).

    @see Component#isDisplayable @see Window#pack @see Window#show
    Class Window, Component getFocusOwner()

    Returns the child componentComponent of this Window whichthat has focus if and only if this Window is activefocused; returns null otherwise. @return the componentchild Component with focus or null if nothis Window children have focusis not focused assigned@see to#getMostRecentFocusOwner them.@see #isFocused
    Class Window, EventListener[] getListeners(Class)

    ReturnReturns an array of all the listenersobjects that were addedcurrently registered as toFooListeners the Windowupon this withWindow. addXXXListener()FooListeners where XXX isare registered using the nameaddFooListener ofmethod.

    You can specify the listenerType argument. For example to get all ofwith a class literal such as theFooListener.class. WindowListener(s)For forexample theyou can givenquery a Window w onefor its window listeners with the would writefollowing code:

     WindowListener[] wls = (WindowListener[])(w.getListeners(WindowListener.class)) ;
    If no such listenerlisteners exist list exists thenthis method returns an empty array is returned. @param listenerType Typethe type of listeners requested; this parameter should specify an interface that descends from java.util.EventListener @return allan array of theall objects registered as FooListeners on this window or an empty array if no such listeners of the specifiedhave been added type@exception supported byClassCastException if thislistenerType doesn't specify a class or interface that implements java.util.EventListener
    text@see field#getWindowListeners @since 1.3
    Class Window, Toolkit getToolkit()

    Returns the toolkit of this frame. @return the toolkit of this window. @see java.awt.Toolkit @see java.awt.Toolkit#getDefaultToolkit() @see java.awt.Component#getToolkit()
    Class Window, void hide()

    Hide this Window its subcomponents and all of its owned children. The Window and its subcomponents can be made visible again with a call to show.

    @see Window#show @see Window#dispose
    Class Window, boolean isShowing()

    Checks if this Window is showing on screen. @see java.awt.Component#setVisible(boolean)
    Class Window, void processEvent(AWTEvent)

    Processes events on this window. If the event is an WindowEvent it invokes the processWindowEvent method else it invokes its superclass's processEvent.

    Note that if the event parameter is null the behavior is unspecified and may result in an exception. @param e the event

    Class Window, void processWindowEvent(WindowEvent)

    Processes window events occurring on this window by dispatching them to any registered WindowListener objects. NOTE: This method will not be called unless window events are enabled for this component; this happens when one of the following occurs: a) Component#enableEvents

    Note that if the event parameter is null the behavior is unspecified and may result in an exception. @param e the window event @see Component#enableEvents

    Class Window, void removeWindowListener(WindowListener)

    Removes the specified window listener so that it no longer receives window events from this window. If l is null no exception is thrown and no action is performed. @param l the window listener @see #addWindowListener @see #getWindowListeners
    Class Window, void setCursor(Cursor)

    Set the cursor image to a specified cursor. @param cursor One of the constants defined by the Cursor class. If this parameter is null then the cursor for this window will be set to the type Cursor.DEFAULT_CURSOR. @see java.awt.Component#getCursor @see java.awt.Cursor @since JDK1.1
    Class Window, void show()

    Makes the Window visible. If the Window and/or its owner are not yet displayable both are made displayable. The Window will be validated prior to being made visible. If the Window is already visible this will bring the Window to the front. @see java.awt.Component#isDisplayable @see java.awt.Window#toFront @see java.awt.Component#setVisible
    Class Window, void toBack()

    SendsIf this windowWindow 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 windowWindow at the bottom of the stacking order and makes theshows corresponding adjustment toit 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. @see

    Because of variations in native windowing javasystems 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.awt 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. @see #toFront

    Class Window, void toFront()

    BringsIf this windowWindow is visible brings this Window to the front and may make it the focused Window.

    Places this windowWindow at the top of the stacking order and shows it in front of any other Windows in this VM. No action will take place is 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. @see

    Because of variations in native windowing systems no guarantees about changes to javathe focused and active Windows can be made. 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. On platforms where the stacking order does not typically affect the focused window this method will probably leave the focused and active Windows unchanged.awt

    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. @see #toBack