|
Generated by JDiff |
||||||||
| PREV PACKAGE NEXT PACKAGE FRAMES NO FRAMES | |||||||||
This file contains all the changes in documentation in the packagejava.awtas colored differences. Deletions are shownlike 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.
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:@author John Rose @author Amy Fowler @version 1.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()); } }31 1232 01/0317/0102 @since 1.1
This class is for AWT permissions. AnClass AWTPermission, constructor AWTPermission(String, String)AWTPermissioncontains 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
AWTPermissiontarget names and for each provides a description of what the permission allows and a discussion of the risks of granting code the permission.
@see java.security.BasicPermission @see java.security.Permission @see java.security.Permissions @see java.security.PermissionCollection @see java.lang.SecurityManager @version 1.
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. 21 1222 02/03/01/02 @author Marianne Mueller @author Roland Schemers
Creates a newAWTPermissionobject with the specified name. The name is the symbolic name of theAWTPermissionand the actions string is currently unused and should benull.This constructor exists for use by the Policy object to instantiate new permission objects.@param name the name of theAWTPermission@param actions should benull
An interface for events that know how to dispatch themselves. By implementing this interface an event can be placed upon the event queue and itsClass ActiveEvent, void dispatch()dispatch()method will be called when the event is dispatched using theEventDispatchThread.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
ActiveEventcan 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
ActiveEventto 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.101112/03/0112/02 @since 1.2
Dispatch the event toit'sits target listeners of the events source or do whatever it is this event is supposed to do.
Class AlphaComposite, float getAlpha()Tests ifDetermines whether the specifiedObjectobject is equal to thisAlphaComposite.The result is
object. @param obj thetrueif and only if the argument is notnulland is anAlphaCompositeobject that has the same compositing rule and alpha value as thisObjectto test for equality @returntrueifobjequals thisAlphaComposite;falseotherwise.
Returns the alpha value of thisClass AlphaComposite, AlphaComposite getInstance(int, float)AlphaComposite. If thisAlphaCompositedoes not have an alpha value 1.0 is returned. @return the alpha value of thisAlphaComposite.
Creates anAlphaCompositeobject with the specified rule and the constant alpha to multiply with the alpha of the source. The source is multiplied with the specified alpha before being composited with the destination. @param rule the compositing rule @param alpha the constant alpha to be multiplied with the alpha of the source.alphamust be a floating point number in the inclusive range [0.0 1.0]. @throws IllegalArgumentException ifalphais less than 0.0 or greater than 1.0 or ifruleis not one of the following: #CLEAR #SRC #DST #SRC_OVER #DST_OVER #SRC_IN #DST_IN #SRC_OUT #DST_OUT #SRC_ATOP #DST_ATOP or #XOR
Capabilities and properties of buffers. @see java.awt.image.BufferStrategy#getCapabilities() @see GraphicsConfiguration#Class BufferCapabilities, FlipContents getFlipContents()getCapabilitiesgetBufferCapabilities @author Michael Martak @since 1.4
@return the resulting contents of the back buffer after page-flipping. This value isClass BufferCapabilities, boolean isPageFlipping()nullwhen theisPageFlippingreturnsfalseimplying blitting. It can be one ofFlipContents.UNDEFINED(the assumed default)FlipContents.BACKGROUNDFlipContents.PRIORorFlipContents.COPIED. @see #isPageFlipping @see FlipContents#UNDEFINED @see FlipContents#BACKGROUND @see FlipContents#PRIOR @see FlipContents#COPIED
@return whether or not the buffer strategy uses page flipping; a set of buffers that uses page flipping can swap the contents internally between the front buffer and one or more back buffers by switching the video pointer (or by copying memory internally). A non-flipping set of buffers uses blitting to copy the contents from one buffer to another; when this is the casegetFlipContentsreturnsnull
TheClass Choice, int getSelectedIndex()Choiceclass 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
Choicecomponents and the behavior ofsetSize()/getSize()is bound by such limitations. Native GUIChoicecomponents' size are often bound by such attributes as font size and length of items contained within theChoice.@version 1.
787912/03/0120/02 @author Sami Shaio @author Arthur van Hoff @since JDK1.0
Returns the index of the currently selected item. If nothing is selected returns -1. @return the index of the currently selected item or -1 if nothing is currently selected @see #getSelectedItem
Determines whether another object is equal to thisColor.The result is
trueif and only if the argument is notnulland is aColorobject that has the same red green blue andbluealpha values as this object. @param obj the object to test for equality with thisColor@returntrueif the objects are the same;falseotherwise. @since JDK1.0
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.Class Component, void addMouseMotionListener(MouseMotionListener)The
Componentclass is the abstract superclass of the nonmenu-related Abstract Window Toolkit components. ClassComponentcan 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 theSerializableprotocol will be saved when the object is stored. If an AWT object has listeners that aren't marked serializable they will be dropped atwriteObjecttime. 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 serializingaButtonby itself will causeMyAppand 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 aboutMyAppand theActionListenerbeing 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()); } }Note: For more information on the paint mechanisms utilitized by AWT and Swing including information on how to write the most efficient painting code see Painting in AWT and Swing. @version 1.
330 12347 05/03/0102 @author Arthur van Hoff @author Sami Shaio
Adds the specified mouse motion listener to receive mouse motion events from this component. If listenerClass Component, void addPropertyChangeListener(String, PropertyChangeListener)lisnullno exception is thrown and no action is performed. @param l the mouse motion listener @see java.awt.event.MouseMotionEventMouseEvent @see java.awt.event.MouseMotionListener @see #removeMouseMotionListener @see #getMouseMotionListeners @since JDK1.1
Adds a PropertyChangeListener to the listener list for a specific property. The specified property may be user-defined or one of the following:Class Component, PropertyChangeListener[] getPropertyChangeListeners(String)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.
- this Component's font ("font")
- this Component's background color ("background")
- this Component's foreground color ("foreground")
- this Component's focusability ("focusable")
- this Component's focus traversal keys enabled state ("focusTraversalKeysEnabled")
- this Component's Set of FORWARD_TRAVERSAL_KEYS ("forwardFocusTraversalKeys")
- this Component's Set of BACKWARD_TRAVERSAL_KEYS ("backwardFocusTraversalKeys")
- this Component's Set of UP_CYCLE_TRAVERSAL_KEYS ("upCycleFocusTraversalKeys")
If listener is null no exception is thrown and no action is performed. @param propertyName one of the property names listed above @param listener the PropertyChangeListener to be added @see #removePropertyChangeListener(java.lang.String java.beans.PropertyChangeListener) @see #getPropertyChangeListeners(java.lang.String) @see #addPropertyChangeListener(java.lang.String java.beans.PropertyChangeListener)
Returns an array of all the listeners which have been associated with the named property. @return all of the PropertyChangeListeners associated with the named property or an empty array if no listeners have been added @see #addPropertyChangeListener(java.lang.String java.beans.PropertyChangeListener) @see #removePropertyChangeListener(java.lang.String java.beans.PropertyChangeListener) @see #getPropertyChangeListeners @since 1.4
Class Component, boolean imageUpdate(Image, int, int, int, int, int)Repaints the component when the image has changed. ThisClass Component, void paint(Graphics)imageUpdatemethod of anImageObserveris called when more information about an image which had been previously requested using an asynchronous routine such as thedrawImagemethod ofGraphicsbecomes available. See the definition ofimageUpdatefor more information on this method and its arguments.The
imageUpdatemethod ofComponentincrementally draws an image on the component as more of the bits of the image are available.If the system property
awt.image.is missing or has the valueincrementalDrawincrementaldrawtruethe image is incrementally drawn. If the system property has any other value then the image is not drawn until it has been completely loaded.Also if incremental drawing is in effect the value of the system property
awt.image.redrawrateis interpreted as an integer to give the maximum redraw rate in milliseconds. If the system property is missing or cannot be interpreted as an integer the redraw rate is once every 100ms.The interpretation of the
xywidthandheightarguments depends on the value of theinfoflagsargument. @param img the image being observed @param infoflags seeimageUpdatefor more information @param x the x coordinate @param y the y coordinate @param w the width @param h the height @returnfalseif the infoflags indicate that the image is completely loaded;trueotherwise. @see java.awt.image.ImageObserver @see Graphics#drawImage(Image int int Color java.awt.image.ImageObserver) @see Graphics#drawImage(Image int int java.awt.image.ImageObserver) @see Graphics#drawImage(Image int int int int Color java.awt.image.ImageObserver) @see Graphics#drawImage(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
Paints this component.Class Component, void processMouseMotionEvent(MouseEvent)This method is called when the contents of the component should be painted;
in response tosuch as when the component is first being shown ordamageis damaged and in needneedingof repair. The clip rectangle in theGraphicsparameterwill beis set to the area which needs to be painted. Subclasses ofComponentthat override this method need not callsuper.paint(g).For performance reasons
ComponentsComponents with zero width or height aren't considered to need painting when they are first shown and also aren't considered to need repair.Note: For more information on the paint mechanisms utilitized by AWT and Swing including information on how to write the most efficient painting code see Painting in AWT and Swing. @param g the graphics context to use for painting @see #update @since JDK1.0
Processes mouse motion events occurring on this component by dispatching them to any registeredClass Component, void removeMouseMotionListener(MouseMotionListener)MouseMotionListenerobjects.This method is not called unless mouse motion events are enabled for this component. Mouse motion events are enabled when one of the following occurs:
- A
MouseMotionListenerobject is registered viaaddMouseMotionListener.- Mouse motion events are enabled via
enableEvents.Note that if the event parameter is
nullthe behavior is unspecified and may result in an exception. @param e the mouse motion event @see java.awt.event.MouseMotionEventMouseEvent @see java.awt.event.MouseMotionListener @see #addMouseMotionListener @see #enableEvents @since JDK1.1
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 listenerClass Component, void removePropertyChangeListener(String, PropertyChangeListener)lisnullno exception is thrown and no action is performed. @param l the mouse motion listener @see java.awt.event.MouseMotionEventMouseEvent @see java.awt.event.MouseMotionListener @see #addMouseMotionListener @see #getMouseMotionListeners @since JDK1.1
Removes 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.Class Component, void repaint()If listener is null no exception is thrown and no action is performed. @param propertyName a valid property name @param listener the PropertyChangeListener to be removed @see #addPropertyChangeListener(java.lang.String java.beans.PropertyChangeListener) @see #getPropertyChangeListeners(java.lang.String) @see #removePropertyChangeListener(java.beans.PropertyChangeListener)
Repaints this component.Class Component, void repaint(int, int, int, int)
ThisIf this component is a lightweight component this method causes a call to this component'spaintmethod as soon as possible. Otherwise this method causes a call to this component'supdatemethod as soon as possible.Note: For more information on the paint mechanisms utilitized by AWT and Swing including information on how to write the most efficient painting code see Painting in AWT and Swing. @see #update(Graphics) @since JDK1.0
Repaints the specified rectangle of this component.Class Component, void repaint(long)
ThisIf this component is a lightweight component this method causes a call to this component'spaintmethod as soon as possible. Otherwise this method causes a call to this component'supdatemethod as soon as possible.Note: For more information on the paint mechanisms utilitized by AWT and Swing including information on how to write the most efficient painting code see Painting in AWT and Swing. @param x the x coordinate @param y the y coordinate @param width the width @param height the height @see #update(Graphics) @since JDK1.0
Repaints the component.Class Component, void repaint(long, int, int, int, int)This willIf thisresultcomponent is a lightweight component this results in a call towithinupdatepainttmmilliseconds.Note: For more information on the paint mechanisms utilitized by AWT and Swing including information on how to write the most efficient painting code see Painting in AWT and Swing. @param tm maximum time in milliseconds before update @see #paint @see #update(Graphics) @since JDK1.0
Repaints the specified rectangle of this component withinClass Component, void setIgnoreRepaint(boolean)tmmilliseconds.
ThisIf this component is a lightweight component this method causes a call to this component'spaintmethod. Otherwise this method causes a call to this component'supdatemethod.Note: For more information on the paint mechanisms utilitized by AWT and Swing including information on how to write the most efficient painting code see Painting in AWT and Swing. @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 #update(Graphics) @since JDK1.0
Sets whether or not paint messages received from the operating system should be ignored. This does not affect paint events generated in software by the AWT unless they are an immediate response to an OS-level paint message.Class Component, void transferFocusUpCycle()This is useful for example if running under full-screen mode and better performance is desired or if page-flipping is used as the buffer strategy. @since 1.4 @see #getIgnoreRepaint @see Canvas#createBufferStrategy @see Window#createBufferStrategy @see java.awt.image.BufferStrategy @see GraphicsDevice#setFullScreenWindow
Transfers the focus up one focus traversal cycle. Typically the focus owner is set to this Component's focus cycle root and the current focus cycle root is set to the new focus owner's focus cycle root. If however this Component's focus cycle root is a Window then the focus owner is set to the focus cycle root's default Component to focus and the current focus cycle root is unchanged. @see #requestFocus() @see Container#isFocusCycleRoot() @see Container#setFocusCycleRoot(boolean) @since 1.4Class Component, void update(Graphics)
Updates this component.
TheIf this component is not a lightweight component the AWT calls theupdatemethod in response to a call torepaint.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 ofComponentcalls this component'spaintmethod to redraw this component. This method is commonly overridden by subclasses which need to do additional work in response to a call torepaint. Subclasses of Component that override this method should either callsuper.update(g)or callpaintdirectly.The origin of the graphics context its (
00) coordinate point is the top-left corner of this component. The clipping region of the graphics context is the bounding rectangle of this component.Note: For more information on the paint mechanisms utilitized by AWT and Swing including information on how to write the most efficient painting code see Painting in AWT and Swing. @param g the specified context to use for updating @see #paint @see #repaint() @since JDK1.0
A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT components.Class Container, Component add(Component)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.
223 03229 04/02/02 @author Arthur van Hoff @author Sami Shaio @see #add(java.awt.Component int) @see #getComponent(int) @see LayoutManager @since JDK1.0
Appends the specified component to the end of this container. This is a convenience method for #addImplClass Container, void add(Component, Object)Note: If a component has been added to a container that has been displayed
validatemust be called on that container to display the new component. If multiple components are being added you can improve efficiency by callingvalidateonly once after all the components have been added. @param comp the component to be added @see #addImpl @see #validate @see #revalidate @return the component argument
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 #addImplClass Container, void add(Component, Object, int)Note: If a component has been added to a container that has been displayed
validatemust be called on that container to display the new component. If multiple components are being added you can improve efficiency by callingvalidateonly once after all the components have been added. @param comp the component to be added @param constraints an object expressing layout contraints for this component @see #addImpl @see #validate @see #revalidate @see LayoutManager @since JDK1.1
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 #addImplClass Container, Component add(Component, int)Note: If a component has been added to a container that has been displayed
validatemust be called on that container to display the new component. If multiple components are being added you can improve efficiency by callingvalidateonly once after all the components have been added. @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.;-1means insert at the end.component @see #addImpl @see #validate @see #revalidate @see #remove @see LayoutManager
Adds the specified component to this container at the given position. This is a convenience method for #addImplClass Container, Component add(String, Component)Note: If a component has been added to a container that has been displayed
validatemust be called on that container to display the new component. If multiple components are being added you can improve efficiency by callingvalidateonly once after all the components have been added. @param comp the component to be added @param index the position at which to insert the component or-1to append the component to the end @return the componentcomp@see #addImpl @see #remove @see #validate @see #revalidate
Adds the specified component to this container. This is a convenience method for #addImplClass Container, void addNotify()This method is obsolete as of 1.1. Please use the method
add(Component Object)instead. @see add(Component Object)
Makes this Container displayable by connecting it to a native screen resource. Making a container displayable will causeClass Container, void removeNotify()anyall of its children to be made displayable. This method is called internally by the toolkit and should not be called directly by programs. @see Component#isDisplayable @see #removeNotify
Makes this Container undisplayable by removing its connection to its native screen resource.Class Container, void validate()MakeMaking a container undisplayable will causeanyall of its children to be made undisplayable. This method is called by the toolkit internally and should not be called directly by programs. @see Component#isDisplayable @see #addNotify
Validates this container and all of its subcomponents.
AWTTheusesvalidatemethod is used to cause a container to lay out its subcomponents again.after the components it contains haveIt should be invoked when thisbeencontainer's subcomponents are modified (added to ormodifiedremoved from the container or layout-related information changed) after the container has been displayed. @see #validateadd(java.awt.Component) @see Component#invalidate @see #revalidate
The default KeyboardFocusManager for AWT applications. Focus traversal is done in response to a Component's focus traversal keys and using a Container's FocusTraversalPolicy. @author David Mendenhall @version 1.12 0314 04/0211/02 @see FocusTraversalPolicy @see Component#setFocusTraversalKeys @see Component#getFocusTraversalKeys @since 1.4
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 thegetInsetsmethod however since these dimensions are platform-dependent a valid insets value cannot be obtained until the dialog is made displayable by either callingpackorshow. Since the border area is included in the overall size of the dialog the border effectively obscures a portion of the dialog constraining the area available for rendering and/or displaying subcomponents to the rectangle which has an upper-left corner location of(insets.left insets.top)and has a size ofwidth - (insets.left + insets.right)byheight - (insets.top + insets.bottom).The default layout for a dialog is
BorderLayout.A dialog may have its native decorations (i.e. Frame & Titlebar) turned off with
setUndecorated. This can only be done while the dialog is not displayableA dialog must have either a frame or another dialog defined as its owner when it's constructed. When the owner window of a visible dialog is minimized the dialog will automatically be hidden from the user. When the owner window is subsequently restored the dialog is made visible to the user again.
In a multi-screen environment you can create a
Dialogon 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 application except for any windows created with the dialog as their owner.
Dialogs are capable of generating the following
WindowEvents:WindowOpenedWindowClosingWindowClosedWindowActivatedWindowDeactivatedWindowGainedFocusWindowLostFocus. @see WindowEvent @see Window#addWindowListener @version 1.83 1284 05/0329/0102 @author Sami Shaio @author Arthur van Hoff @since JDK1.0
Class EventQueue, void dispatchEvent(AWTEvent)EventQueueis 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
EventQueuewith 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 theEventQueuecan 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
AWTEventA is enqueued to theEventQueuebeforeAWTEventB 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
EventQueueper context. Other browsers place all applets into the same context implying that there will be only a single globalEventQueuefor 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.82 1284 04/0317/0102 @since 1.1
Dispatches 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:Class EventQueue, void postEvent(AWTEvent)
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.AWTEventor a subclass of it @throws NullPointerException ifeventisnull
Posts a 1.1-style event to theClass EventQueue, void push(EventQueue)EventQueue. If there is an existing event on the queue with the same ID and event source the sourceComponent'scoalesceEventsmethod will be called. @param theEvent an instance ofjava.awt.AWTEventor a subclass of it @throws NullPointerException iftheEventisnull
Replaces the existingEventQueuewith the specified one. Any pending events are transferred to the newEventQueuefor processing by it. @param newEventQueue anEventQueue(or subclass thereof) instance to be use @see java.awt.EventQueue#pop @throws NullPointerException ifnewEventQueueisnull
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.Class FlowLayout, void layoutContainer(Container)For example the following picture shows an applet using the flow layout manager (its default layout manager) to position 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.
43 1244 04/0317/0102 @author Arthur van Hoff @author Sami Shaio @since JDK1.0
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 theconstraintsalignment of thisFlowLayoutobject. @param target the specified component being laid out @see Container @see java.awt.Container#doLayout
TheClass Font, boolean equals(Object)Fontclass represents fonts which are used to render text in a visible way. A font provides the information needed to map sequences of characters to sequences of glyphs and to render sequences of glyphs onGraphicsandComponentobjects.Characters and Glyphs
A character is a symbol that represents an item such as a letter a digit or punctuation in an abstract way. For example'g'LATIN SMALL LETTER G is a character.A glyph is a shape used to render a character or a sequence of characters. In simple writing systems such as Latin typically one glyph represents one character. In general however characters and glyphs do not have one-to-one correspondence. For example the character 'á' LATIN SMALL LETTER A WITH ACUTE can be represented by two glyphs: one for 'a' and one for '´'. On the other hand the two-character string "fi" can be represented by a single glyph an "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 sequences to glyph sequences using a font technology such as TrueType or PostScript Type 1. All implementations of the Java 2 platform must support TrueType fonts; support for other font technologies is implementation dependent. Physical fonts may use names such as Helvetica Palatino HonMincho or any number of other font names. Typically each physical font supports only a limited set of writing systems for example only Latin characters or only Japanese and Basic Latin. The set of available physical fonts varies between configurations. Applications that require specific fonts can bundle them and instantiate them using the createFont method.
Logical fonts are the five font families defined by the Java platform which must be supported by any Java runtime environment: Serif SansSerif Monospaced Dialog and DialogInput. These logical fonts are not actual font libraries. Instead the logical font names are mapped to physical fonts by the Java runtime environment. The mapping is implementation and usually locale dependent so the look and the metrics provided by them vary. Typically each logical font name maps to several physical fonts in order to cover a large range of characters.
Peered AWT components such as Label and TextField can only use logical fonts.
For a discussion of the relative advantages and disadvantages of using physical or logical fonts see the Internationalization FAQ document.
Font Faces and Names
AFontcan 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
Fontobject. The logical font name is simply the name that was used to construct 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
Fontclass 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 severalFontobjects associated with a font face each differing in size style transform and font features. The getAllFonts method of theGraphicsEnvironmentclass returns an array of all font faces available in the system. These font faces are returned asFontobjects with a size of 1 identity transform and default font features. These base fonts can then be used to derive newFontobjects with varying sizes styles transforms and font features via thederiveFontmethods in this class. @version 1.171 12177 04/0327/0102
Compares thisFontobject to the specifiedObject. @param obj theObjectto compare.@returntrueif the objects are the same or if the argument is aFontobject describing the same font as this object;falseotherwise. @since JDK1.0
AClass Frame, Image getIconImage()Frameis 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 may be obtained using the
getInsetsmethod however since these dimensions are platform-dependent a valid insets value cannot be obtained until the frame is made displayable by either callingpackorshow. 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 ofwidth - (insets.left + insets.right)byheight - (insets.top + insets.bottom).The default layout for a frame is
BorderLayout.A frame may have its native decorations (i.e.
FrameandTitlebar) turned off withsetUndecorated. This can only be done while the frame is not displayableIn a multi-screen environment you can create a
Frameon a different screen device by constructing theFramewith #Frame(GraphicsConfiguration) or titl GraphicsConfiguration)}. TheGraphicsConfigurationobject is one of theGraphicsConfigurationobjects 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.
![]()
In such an environment when calling
setLocationyou must pass a virtual coordinate to this method. Similarly callinggetLocationOnScreenon aFramereturns virtual device coordinates. Call thegetBoundsmethod of aGraphicsConfigurationto find its origin in the virtual coordinate system.The following code sets the location of the
Frameat (10 10) relative to the origin of the physical screen of the correspondingGraphicsConfiguration. If the bounds of theGraphicsConfigurationis not taken into account theFramelocation 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 specifiedGraphicsConfiguration.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
WindowEvents:@version 1.
WINDOW_OPENEDWINDOW_CLOSINGWINDOW_CLOSEDWINDOW_ICONIFIEDWINDOW_DEICONIFIEDWINDOW_ACTIVATEDWINDOW_DEACTIVATEDWINDOW_GAINED_FOCUSWINDOW_LOST_FOCUSWINDOW_STATE_CHANGED131 12134 04/0311/0102 @author Sami Shaio @see WindowEvent @see Window#addWindowListener @since JDK1.0
Gets the image to be displayed in the minimized icon for this frame. @return the icon image for this frame orClass Frame, Rectangle getMaximizedBounds()nullif this frame doesn't have an icon image. @see #setIconImage(IconImage)
Gets maximized bounds for this frame.Class Frame, void setMaximizedBounds(Rectangle)@return maximized bounds for this frame. May be null.Some fields maybecontainInteger.MAX_VALUEto indicate that system supplied values for this field must be used. @return maximized bounds for this frame; may benull@see #setMaximizedBounds(Rectangle) @since 1.4
Class Frame, void setUndecorated(boolean)SetSets the maximized bounds for this frame.When a frame is in maximized state the system supplies some
defaultdefaults boundsfor the maximized state.Using thisThis method allows some or all of those system supplied valuesmayto beoverridenoverridden.If
boundsisnullaccept bounds supplied by the system. Ifit's notnon-nullyou can override some of the system supplied values while accepting others by setting those fields you want to accept from system toInteger.MAX_VALUE.On some systems only the size portion of the bounds is taken into account. @param bounds bounds for the maximized state
.@see getMaximizedBounds @since 1.4
Disables or enables decorations for this frame. This method can only be called while the frame is not displayable. @param undecoratedtrueif no frame decorations are to be enabled;falseif frame decorations are to be enabled. @throwsIllegalComponentStateExceptionif the frame is displayable. @see #isUndecorated @see Component#isDisplayable @see javax.swing.JFrame#setDefaultLookAndFeelDecorated(boolean) @since 1.4
TheGraphicsConfigurationclass describes the characteristics of a graphics destination such as a printer or monitor. There can be manyGraphicsConfigurationobjects associated with a single graphics device representing different drawing modes or capabilities. The corresponding native structure will vary from platform to platform. For example on X11 windowing systems each visual is a differentGraphicsConfiguration. Onwin32Microsoft WindowsGraphicsConfigurations represent PixelFormats available in the current resolution and color depth.In a virtual device multi-screen environment in which the desktop area could span multiple physical screen devices the bounds of the
GraphicsConfigurationobjects are relative to the virtual coordinate system. When setting the location of a component use getBounds to get the bounds of the desiredGraphicsConfigurationand offset the location with the coordinates of theGraphicsConfigurationas the following code sample illustrates:Frame f = new Frame(GraphicsConfigurationgc); // where gc is a GraphicsConfiguration Rectangle bounds = gc.getBounds(); f.setLocation(10 + bounds.x 10 + bounds.y);To determine if your environment is a virtual device environment call
getBoundson all of theGraphicsConfigurationobjects in your system. If any of the origins of the returned boundsareis not (0 0) your environment is a virtual device environment.You can also use
getBoundsto determine the bounds of the virtual device.CallTo do this first callgetBoundson all of theGraphicsConfigurationobjects in your system. Then calculate the union of all of the bounds returned from the calls togetBounds. The union is the bounds of the virtual device. The following code sample calculates the bounds of the virtual device.Rectangle virtualBounds = new Rectangle(); GraphicsEnvironment ge = GraphicsEnvironment. getLocalGraphicsEnvironment(); GraphicsDevice[] gs = ge.getScreenDevices(); for (int j = 0; j@see Window @see Frame @see GraphicsEnvironment @see GraphicsDevice
TheGraphicsDeviceclass 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 theGraphicsDevicecan be used.In a multi-screen environment the
GraphicsConfigurationobjects can be used to render components on multiple screens. The following code sample demonstrates how to create aJFrameobject for eachGraphicsConfigurationon each screen device in theGraphicsEnvironment:GraphicsEnvironment ge = GraphicsEnvironment. getLocalGraphicsEnvironment(); GraphicsDevice[] gs = ge.getScreenDevices(); for (int j = 0; j@see GraphicsEnvironment @see GraphicsConfiguration @version 1. 25 1226 08/0316/0102
TheClass GraphicsEnvironment, Graphics2D createGraphics(BufferedImage)GraphicsEnvironmentclass describes the collection of GraphicsDevice objects and java.awt.Font objects available to a Java(tm) application on a particular platform. The resources in thisGraphicsEnvironmentmight be local or on a remote machine.GraphicsDeviceobjects can be screens printers or image buffers and are the destination of Graphics2D drawing methods. EachGraphicsDevicehas a number of GraphicsConfiguration objects associated with it. These objects specify the different configurations in which theGraphicsDevicecan be used. @see GraphicsDevice @see GraphicsConfiguration @version 1.51 1253 04/0327/0102
Returns aClass GraphicsEnvironment, Font[] getAllFonts()Graphics2Dobject for rendering into the specified BufferedImage @param img the specifiedBufferedImage@return aGraphics2Dto be used for rendering into the specifiedBufferedImage.
Returns an array containing a one-point size instance of all fonts available in thisClass GraphicsEnvironment, Point getCenterPoint()GraphicsEnvironment. Typical usage would be to allow a user to select a particular font. Then the application can size the font and set various font attributes by calling thederiveFontmethod on the choosen instance.This method provides for the application the most precise control over which
Fontinstance is used to render text. If a font in thisGraphicsEnvironmenthas multiple programmable variations only one instance of thatFontis returned in the array and other variations must be derived by the application.If a font in this environment has multiple programmable variations such as Multiple-Master fonts only one instance of that font is returned in the
Fontarray. The other variations must be derived by the application. @return an array ofFontobjects.@see #getAvailableFontFamilyNames @see java.awt.Font @see java.awt.Font#deriveFont @see java.awt.Font#getFontName @since 1.2
Returns the Point where Windows should be centered. It is recommended that centered Windows be checked to ensure they fit within the available display area using getMaximumWindowBounds(). @return the point where Windows should be centeredClass GraphicsEnvironment, GraphicsDevice getDefaultScreenDevice().@exception HeadlessException if isHeadless() returns true @see #getMaximumWindowBounds @since 1.4
Returns the default screenClass GraphicsEnvironment, GraphicsEnvironment getLocalGraphicsEnvironment()GraphicsDevice. @return theGraphicsDevicethat represents the default screen device.@exception HeadlessException if isHeadless() returns true @see isHeadless
Returns the localClass GraphicsEnvironment, Rectangle getMaximumWindowBounds()GraphicsEnvironment. @returnthisthe localGraphicsEnvironment.
Returns the maximum bounds for centered Windows. These bounds account for objects in the native windowing system such as task bars and menu bars. The returned bounds will reside on a single display with one exception: on multi-screen systems where Windows should be centered across all displays this method returns the bounds of the entire display area.Class GraphicsEnvironment, GraphicsDevice[] getScreenDevices()To get the usable bounds of a single display use
GraphicsConfiguration.getBounds()andToolkit.getScreenInsets(). @return the maximum bounds for centered Windows.@exception HeadlessException if isHeadless() returns true @see #getCenterPoint @see GraphicsConfiguration#getBounds @see Toolkit#getScreenInsets @since 1.4
Returns an array of all of the screenClass GraphicsEnvironment, boolean isHeadless()GraphicsDeviceobjects. @return an array containing all theGraphicsDeviceobjects that represent screen devices.@exception HeadlessException if isHeadless() returns true @see isHeadless
Tests whether or not a display keyboard and mouse can be supported in this environment. If this method returns true a HeadlessException is thrown from areas of the Toolkit and GraphicsEnvironment that are dependent on a display keyboard or mouse. @returnClass GraphicsEnvironment, boolean isHeadlessInstance()trueif this environment cannot support a display keyboard and mouse;falseotherwise.@see java.awt.HeadlessException @since 1.4
Returns whether or not a display keyboard and mouse can be supported in this graphics environment. If this returns trueHeadlessExceptionwill be thrown from areas of the graphics environment that are dependent on a display keyboard or mouse. @returntrueif a display keyboard and mouse can be supported in this environment;falseotherwise.@see java.awt.HeadlessException @see #isHeadless @since 1.4
This method is obsolete and supplied for backwards compatability only; new code should call adjustForGravity() instead. @see adjustForGravity
Class GridBagLayout, void ArrangeGrid(Container)This method is obsolete and supplied for backwards compatability only; new code should call arrangeGrid() instead. @see arrangeGrid
Class GridBagLayout, GridBagLayoutInfo GetLayoutInfo(Container, int)This method is obsolete and supplied for backwards compatability only; new code should call getLayoutInfo() instead. @see getLayoutInfoClass GridBagLayout, Dimension GetMinSize(Container, GridBagLayoutInfo)
This method is obsolete and supplied for backwards compatability only; new code should call getMinSize() instead. @see getMinSize
Class GridBagLayout, void adjustForGravity(GridBagConstraints, Rectangle)Adjusts the x y width and height fields to the correct values depending on the constraint geometry and pads. @param constraints the constraints to be applied @param r the Rectangle to be adjusted @since 1.4
Class GridBagLayout, void arrangeGrid(Container)Class GridBagLayout, float getLayoutAlignmentX(Container)LayLays out the grid. @param parent the layout container @since 1.4
Returns the alignment along the x axis. This specifies how the component would like to be aligned relative to other components. The value should be a number between 0 and 1 where 0 represents alignment along the origin 1 is aligned the furthest away from the origin 0.5 is centered etc.Class GridBagLayout, float getLayoutAlignmentY(Container)@return the value
0.5fto indicate centered
Returns the alignment along the y axis. This specifies how the component would like to be aligned relative to other components. The value should be a number between 0 and 1 where 0 represents alignment along the origin 1 is aligned the furthest away from the origin 0.5 is centered etc.Class GridBagLayout, GridBagLayoutInfo getLayoutInfo(Container, int)@return the value
0.5fto indicate centered
Class GridBagLayout, Dimension getMinSize(Container, GridBagLayoutInfo)FillFills in an instance ofthe above structureGridBagLayoutInfofor the current set of managed children. This requires three passes through the set of children:1)This also caches the minsizes for all the children when they are first encountered (so subsequent loops don't need to ask again). @param parent the layout container @param sizeflag either
- Figure out the dimensions of the layout grid
2).- Determine which cells the components occupy
3).- Distribute the weights and min sizes amoung the rows/columns.
PREFERREDSIZEorMINSIZE@return theGridBagLayoutInfofor the set of children @since 1.4
Class GridBagLayout, void layoutContainer(Container)FigureFigures out the minimum size of the master based on the information from getLayoutInfo(). @param parent the layout container @param info the layout info for this parent @return aDimensionobject containing the minimum size @since 1.4
Lays out the specified container using this grid bag layout. This method reshapes components in the specified container in order to satisfy the contraints of thisClass GridBagLayout, GridBagConstraints lookupConstraints(Component)GridBagLayoutobject.Most applications do not call this method directly. @param parent the container in which to do the layout
.@see java.awt.Container @see java.awt.Container#doLayout
Retrieves the constraints for the specified component. The return value is not a copy but is the actualClass GridBagLayout, Dimension maximumLayoutSize(Container)GridBagConstraintsobject used by the layout mechanism. @param comp the component to be queried @return the contraints for the specifiedcomponen.component
Returns the maximum dimensions for this layout given the components in the specified target container. @param target theClass GridBagLayout, Dimension minimumLayoutSize(Container)componentcontainer which needs to be laid out @see Container @see #minimumLayoutSize(Container) @see #preferredLayoutSize(Container) @return the maximum dimensions for this layout
Determines the minimum size of theClass GridBagLayout, Dimension preferredLayoutSize(Container)container using this grid bag layout.targetparentMost applications do not call this method directly. @param
targetparent the container in which to do the layout.@see java.awt.Container#doLayout @return the minimum size of theparentcontainer
Determines the preferred size of theClass GridBagLayout, Hashtable comptablecontainer using this grid bag layout.targetparentMost applications do not call this method directly. @param
targetparent the container in which to do the layout.@see java.awt.Container#getPreferredSize @return the preferred size of theparentcontainer
This hashtable maintains the association between a component and its gridbag constraints. The Keys incomptableare the components and the values are the instances ofGridBagConstraints. @serial @see java.awt.GridBagConstraints
TheClass GridLayout, Dimension minimumLayoutSize(Container)GridLayoutclass 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")); } }
If the container's
ComponentOrientationproperty is horizontal and left-to-right the above example produces the output shown in Figure 1. If the container'sComponentOrientationproperty 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 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.
313212/03/0111/02 @author Arthur van Hoff @since JDK1.0
Determines the minimum size of the container argument using this grid layout.Class GridLayout, Dimension preferredLayoutSize(Container)The minimum width of a grid layout is the largest minimum width of any of the
widthscomponents 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
heightscomponents 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
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
widthscomponents 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
heightscomponents 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()
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
setattributeNameToDefaultmethod. Default value fields are not provided. @version 1.6712/03/0119/02 @author David Mendenhall
A type-safe enumeration of possible multipleClass JobAttributes.MultipleDocumentHandlingType, MultipleDocumentHandlingType SEPARATE_DOCUMENTS_COLLATED_COPIESdocumentcopy handling states.TheseItstates are in partial compliance with IPPis used to control how the sheets1.1of multiple copies of a single document are collated.
TheClass JobAttributes.MultipleDocumentHandlingType, MultipleDocumentHandlingType SEPARATE_DOCUMENTS_UNCOLLATED_COPIESMultipleDocumentHandlingTypeinstance to use for specifying that the job should be divided into separate collateddocumentscopies.
TheMultipleDocumentHandlingTypeinstance to use for specifying that the job should be divided into separate uncollateddocumentscopies.
Specifies the handling of multipleClass JobAttributes, void setMultipleDocumentHandling(MultipleDocumentHandlingType)documentscopies including collation for jobs using these attributes. This attribute is updated to the value chosen by the user. @return MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_COLLATED_COPIES or MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_UNCOLLATED_COPIES.
Specifies the handling of multipleClass JobAttributes, void setMultipleDocumentHandlingToDefault()documentscopies including collation for jobs using these attributes. Not specifying this attribute is equivalent to specifying MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_UNCOLLATED_COPIES. @param multipleDocumentHandling MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_COLLATED_COPIES or MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_UNCOLLATED_COPIES. @throws IllegalArgumentException if multipleDocumentHandling is null.
Sets the handling of multipledocumentscopies including collation for jobs using these attributes to the default. The default handling is MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_UNCOLLATED_COPIES.
The KeyboardFocusManager is responsible for managing the active and focused Windows and the current focus owner. The focus owner is defined as the Component in an application that will typically receive all KeyEvents generated by the user. The focused Window is the Window that is or contains the focus owner. Only a Frame or a Dialog can be the active Window. The native windowing system may denote the active Window or its children with special decorations such as a highlighted title bar. The active Window is always either the focused Window or the first Frame or Dialog that is an owner of the focused Window.Class KeyboardFocusManager, void addPropertyChangeListener(String, PropertyChangeListener)The KeyboardFocusManager is both a centralized location for client code to query for the focus owner and initiate focus changes and an event dispatcher for all FocusEvents WindowEvents related to focus and KeyEvents.
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 KeyboardFocusManager per context. Other browsers place all applets into the same context implying that there will be only a single global KeyboardFocusManager for all applets. This behavior is implementation-dependent. Consult your browser's documentation for more information. No matter how many contexts there may be however there can never be more than one focus owner focused Window or active Window per ClassLoader. @author David Mendenhall @version 1.
2529 03/0221/02 @see Window @see Frame @see Dialog @see java.awt.event.FocusEvent @see java.awt.event.WindowEvent @see java.awt.event.KeyEvent @since 1.4
Adds a PropertyChangeListener to the listener list for a specific property. The specified property may be user-defined or one of the following:Class KeyboardFocusManager, PropertyChangeListener[] getPropertyChangeListeners(String)If listener is null no exception is thrown and no action is performed. @param propertyName one of the property names listed above @param listener the PropertyChangeListener to be added @see #addPropertyChangeListener(java.beans.PropertyChangeListener) @see #removePropertyChangeListener(java.lang.String java.beans.PropertyChangeListener) @see #getPropertyChangeListeners(java.lang.String)
- the focus owner ("focusOwner")
- the permanent focus owner ("permanentFocusOwner")
- the focused Window ("focusedWindow")
- the active Window ("activeWindow")
- the default focus traversal policy ("defaultFocusTraversalPolicy")
- the Set of default FORWARD_TRAVERSAL_KEYS ("forwardDefaultFocusTraversalKeys")
- the Set of default BACKWARD_TRAVERSAL_KEYS ("backwardDefaultFocusTraversalKeys")
- the Set of default UP_CYCLE_TRAVERSAL_KEYS ("upCycleDefaultFocusTraversalKeys")
- the Set of default DOWN_CYCLE_TRAVERSAL_KEYS ("downCycleDefaultFocusTraversalKeys")
- the current focus cycle root ("currentFocusCycleRoot")
Returns an array of all theClass KeyboardFocusManager, VetoableChangeListener[] getVetoableChangeListeners(String)PropertyChangeListeners associated with the named property. @return all of thePropertyChangeListeners associated with the named property or an empty array if no such listeners have been added. @see #addPropertyChangeListener(java.lang.String java.beans.PropertyChangeListener) @see #removePropertyChangeListener(java.lang.String java.beans.PropertyChangeListener) @since 1.4
Returns an array of all theClass KeyboardFocusManager, void removePropertyChangeListener(String, PropertyChangeListener)VetoableChangeListeners associated with the named property. @return all of theVetoableChangeListeners associated with the named property or an empty array if no such listeners have been added. @see #addVetoableChangeListener(java.lang.String java.beans.VetoableChangeListener) @see #removeVetoableChangeListener(java.lang.String java.beans.VetoableChangeListener) @see #getVetoableChangeListeners @since 1.4
Removes 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 a valid property name @param listener the PropertyChangeListener to be removed @see #addPropertyChangeListener(java.lang.String java.beans.PropertyChangeListener) @see #getPropertyChangeListeners(java.lang.String) @see #removePropertyChangeListener(java.beans.PropertyChangeListener)
TheListcomponent 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
cntis 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
Listis created with four rows so thatlst = new List()is equivalent tolist = new List(4 false).Beginning with Java 1.1 the Abstract Window Toolkit sends the
Listobject 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
ItemEventto the list. When the user double-clicks on an item in a scrolling list AWT sends an instance ofActionEventto 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
ItemListenerorActionListeneras 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.
919212/03/0127/02 @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
AMenuobject 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
MenuItemclass. It can be an instance ofMenuItema submenu (an instance ofMenu) or a check box (an instance ofCheckboxMenuItem). @version 1.68 1269 02/0304/0102 @author Sami Shaio @see java.awt.MenuItem @see java.awt.CheckboxMenuItem @since JDK1.0
The abstract classMenuComponentis the superclass of all menu-related components. In this respect the classMenuComponentis analogous to the abstract superclassComponentfor AWT components.Menu components receive and process AWT events just as components do through the method
processEvent. @version 1.656712/03/0121/02 @author Arthur van Hoff @since JDK1.0
Inner class ofMenuComponentused 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.
A point representing a location in (x y) coordinate space specified in integer precision. @version 1.Class Point, void setLocation(double, double)343512/03/0120/02 @author Sami Shaio @since JDK1.0
Sets the location of this point to the specifiedfloatdouble coordinates. Thefloatdouble values will be rounded to integer values. Any number smaller thanInteger.MIN_VALUEwill be reset toMIN_VALUEand any number larger thanInteger.MAX_VALUEwill be reset toMAX_VALUE. @param x the x coordinate of the new location @param y the y coordinate of the new location @see #getLocation
Tests if the interior of thisPolygonentirely contains the specifiedRectangle2D. @param r the specifiedRectangle2D@returntrueif thisPolygonentirely contains the specifiedRectangle2D;falseotherwise. @see #contains(double double double double)
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.Class Robot, void delay(int)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.mouseMovewill 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
AWTExceptionwill 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.
202112/03/0115/02 @author Robi Khan @since 1.3
Sleeps for the specified time. To catch anyInterruptedExceptions that occurThread.sleep()may be used instead. @param ms time to sleep in milliseconds @throws IllegalArgumentException ifmsis not between 0 and 60 000 milliseconds inclusive @see java.lang.Thread#sleep()
TheScrollbarclass 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
maximumminus thevisible. In the previous example because themaximumis 300 and thevisibleis 60 the actual maximum value is 240. The range