java.awt

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » AWT » java.awt 
java.awt
Contains all of the classes for creating user interfaces and for painting graphics and images. A user interface object such as a button or a scrollbar is called, in AWT terminology, a component. The Component class is the root of all AWT components. See Component for a detailed description of properties that all AWT components share.

Some components fire events when a user interacts with the components. The AWTEvent class and its subclasses are used to represent the events that AWT components can fire. See AWTEvent for a description of the AWT event model.

A container is a component that can contain components and other containers. A con tainer can also have a layout manager that controls the visual placement of components in the container. The AWT package contains several layout manager classes and an interface for building your own layout manager. See Container and LayoutManager for more information.

Each {@code Component} object is limited in its maximum size and its location because the values are stored as an integer. Also, a platform may further restrict maximum size and location coordinates. The exact maximum values are dependent on the platform. There is no way to change these maximum values, either in Java code or in native code. These limitations also impose restrictions on component layout. If the bounds of a Component object exceed a platform limit, there is no way to properly arrange them within a Container object. The object's bounds are defined by any object's coordinate in combination with its size on a respective axis.

Additional Specification

@since JDK1.0
Java Source File NameTypeComment
ActiveEvent.javaInterface An interface for events that know how to 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.

Adjustable.javaInterface The interface for objects which have an adjustable numeric value contained within a bounded range of values.
AlphaComposite.javaClass The AlphaComposite class implements basic alpha compositing rules for combining source and destination colors to achieve blending and transparency effects with graphics and images. The specific rules implemented by this class are the basic set of 12 rules described in T.
AttributeValue.javaClass
AWTError.javaClass Thrown when a serious Abstract Window Toolkit error has occurred.
AWTEvent.javaClass 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.

AWTEventMulticaster.javaClass AWTEventMulticaster implements efficient and thread-safe multi-cast event dispatching for the AWT events defined in the java.awt.event package.

The following example illustrates how to use this class:


 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
 ActionListener listener = actionListener;
 if (listener != null) {
 listener.actionPerformed(new ActionEvent());
 }
 }
 }
 
The important point to note is the first argument to the add and remove methods is the field maintaining the listeners.
AWTException.javaClass Signals that an Absract Window Toolkit exception has occurred.
AWTKeyStroke.javaClass An AWTKeyStroke represents a key action on the keyboard, or equivalent input device.
AWTPermission.javaClass 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).

BasicStroke.javaClass 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.
BorderLayout.javaClass 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.
BufferCapabilities.javaClass Capabilities and properties of buffers.
Button.javaClass This class creates a labeled button.
Canvas.javaClass 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.
CardLayout.javaClass A CardLayout object is a layout manager for a container.
Checkbox.javaClass 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 following context describes the graphic.

The button labeled one is in the "on" state, and the other two are in the "off" state.

CheckboxGroup.javaClass The CheckboxGroup class is used to group together a set of Checkbox buttons.
CheckboxMenuItem.javaClass This class represents a check box that can be included in a menu. Selecting 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:

Menu labeled Examples, containing items Basic, Simple, Check, and More Examples.</td></tr><tr><td valign=top align=right width=200><B><A href=Choice.java

Class The Choice class presents a pop-up menu of choices.
Color.javaClass The Color class is used to encapsulate colors in the default sRGB color space or colors in arbitrary color spaces identified by a ColorSpace .
ColorPaintContext.javaClass
Component.javaClass A component is an object having a graphical representation that can be displayed on the screen and that can interact with the user.
ComponentOrientation.javaClass The ComponentOrientation class encapsulates the language-sensitive orientation that is to be used to order the elements of a component or of text.
Composite.javaInterface The Composite interface, along with CompositeContext , defines the methods to compose a draw primitive with the underlying graphics area. After the Composite is set in the Graphics2D context, it combines a shape, text, or an image being rendered with the colors that have already been rendered according to pre-defined rules.
CompositeContext.javaInterface The CompositeContext interface defines the encapsulated and optimized environment for a compositing operation. CompositeContext objects maintain state for compositing operations.
Conditional.javaInterface Conditional is used by the EventDispatchThread's message pumps to determine if a given pump should continue to run, or should instead exit and yield control to the parent pump.
Container.javaClass 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.

ContainerOrderFocusTraversalPolicy.javaClass A FocusTraversalPolicy that determines traversal order based on the order of child Components in a Container.
Cursor.javaClass A class to encapsulate the bitmap representation of the mouse cursor.
DefaultFocusTraversalPolicy.javaClass A FocusTraversalPolicy that determines traversal order based on the order of child Components in a Container.
DefaultKeyboardFocusManager.javaClass The default KeyboardFocusManager for AWT applications.
Desktop.javaClass The Desktop class allows a Java application to launch associated applications registered on the native desktop to handle a java.net.URI or a file.

Supported operations include:

  • launching the user-default browser to show a specified URI;
  • launching the user-default mail client with an optional mailto URI;
  • launching a registered application to open, edit or print a specified file.

This class provides methods corresponding to these operations.

Dialog.javaClass 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.
Dimension.javaClass The Dimension class encapsulates the width and height of a component (in integer precision) in a single object.
DisplayMode.javaClass The DisplayMode class encapsulates the bit depth, height, width, and refresh rate of a GraphicsDevice.
Event.javaClass NOTE: The Event class is obsolete and is available only for backwards compatilibility.
EventDispatchThread.javaClass EventDispatchThread is a package-private AWT class which takes events off the EventQueue and dispatches them to the appropriate AWT components. The Thread starts a "permanent" event pump with a call to pumpEvents(Conditional) in its run() method.
EventFilter.javaInterface
EventQueue.javaClass 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 EventQueue.dispatchEvent(AWTEvent) dispatchEvent(AWTEvent) method on this EventQueue with the event to be dispatched as an argument.

FileDialog.javaClass The FileDialog class displays a dialog window from which the user can select a file.
FlowLayout.javaClass A flow layout arranges components in a directional flow, much like lines of text in a paragraph.
FocusTraversalPolicy.javaClass A FocusTraversalPolicy defines the order in which Components with a particular focus cycle root are traversed.
Font.javaClass The Font class 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 on Graphics and Component objects.

Characters and Glyphs

A character is a symbol that represents an item such as a letter, a digit, or punctuation in an abstract way.
FontFormatException.javaClass Thrown by method createFont in the Font class to indicate that the specified font is bad.
FontMetrics.javaClass The FontMetrics class defines a font metrics object, which encapsulates information about the rendering of a particular font on a particular screen.
Frame.javaClass 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.

GradientPaint.javaClass The GradientPaint class provides a way to fill a Shape with a linear color gradient pattern. If Point P1 with Color C1 and Point P2 with Color C2 are specified in user space, the Color on the P1, P2 connecting line is proportionally changed from C1 to C2.
GradientPaintContext.javaClass
Graphics.javaClass 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.

Graphics2D.javaClass This Graphics2D class extends the Graphics class to provide more sophisticated control over geometry, coordinate transformations, color management, and text layout.
GraphicsCallback.javaClass
GraphicsConfigTemplate.javaClass The GraphicsConfigTemplate class is used to obtain a valid GraphicsConfiguration .
GraphicsConfiguration.javaClass The GraphicsConfiguration class describes the characteristics of a graphics destination such as a printer or monitor. There can be many GraphicsConfiguration objects associated with a single graphics device, representing different drawing modes or capabilities.
GraphicsDevice.javaClass The GraphicsDevice class describes the graphics devices that might be available in a particular graphics environment.
GraphicsEnvironment.javaClass 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.
GridBagConstraints.javaClass The GridBagConstraints class specifies constraints for components that are laid out using the GridBagLayout class.
GridBagLayout.javaClass The GridBagLayout class is a flexible layout manager that aligns components vertically, horizontally or along their baseline 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 GridBagLayout is associated with an instance of GridBagConstraints .

GridBagLayoutInfo.javaClass The GridBagLayoutInfo is an utility class for GridBagLayout layout manager.
GridLayout.javaClass The GridLayout class is a layout manager that lays out a container's components in a rectangular grid.
HeadlessException.javaClass Thrown when code that is dependent on a keyboard, display, or mouse is called in an environment that does not support a keyboard, display, or mouse.
IllegalComponentStateException.javaClass Signals that an AWT component is not in an appropriate state for the requested operation.
Image.javaClass The abstract class Image is the superclass of all classes that represent graphical images.
ImageCapabilities.javaClass Capabilities and properties of images.
Insets.javaClass An Insets object is a representation of the borders of a container.
ItemSelectable.javaInterface The interface for objects which contain a set of items for which zero or more can be selected.
JobAttributes.javaClass 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.

KeyboardFocusManager.javaClass The KeyboardFocusManager is responsible for managing the active and focused Windows, and the current focus owner.
KeyEventDispatcher.javaInterface A KeyEventDispatcher cooperates with the current KeyboardFocusManager in the targeting and dispatching of all KeyEvents.
KeyEventPostProcessor.javaInterface A KeyEventPostProcessor cooperates with the current KeyboardFocusManager in the final resolution of all unconsumed KeyEvents.
Label.javaClass A Label object is a component for placing text in a container.
LayoutManager.javaInterface Defines the interface for classes that know how to lay out Containers.

Swing's painting architecture assumes the children of a JComponent do not overlap.

LayoutManager2.javaInterface Defines an interface for classes that know how to layout Containers based on a layout constraints object.
LinearGradientPaint.javaClass The LinearGradientPaint class provides a way to fill a java.awt.Shape with a linear color gradient pattern.
LinearGradientPaintContext.javaClass Provides the actual implementation for the LinearGradientPaint.
List.javaClass The List component presents the user with a scrolling list of text items.
MediaTracker.javaClass The MediaTracker class is a utility class to track the status of a number of media objects.
Menu.javaClass 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.

MenuBar.javaClass The MenuBar class encapsulates the platform's concept of a menu bar bound to a frame.
MenuComponent.javaClass The abstract class MenuComponent is the superclass of all menu-related components.
MenuContainer.javaInterface The super class of all menu related containers.
MenuItem.javaClass 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 following text describes this graphic.
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".

MenuShortcut.javaClass The MenuShortcutclass represents a keyboard accelerator for a MenuItem.

Menu shortcuts are created using virtual keycodes, not characters.

ModalEventFilter.javaClass
MouseInfo.javaClass MouseInfo provides methods for getting information about the mouse, such as mouse pointer location and the number of mouse buttons.
MultipleGradientPaint.javaClass This is the superclass for Paints which use a multiple color gradient to fill in their raster.
MultipleGradientPaintContext.javaClass This is the superclass for all PaintContexts which use a multiple color gradient to fill in their raster.
PageAttributes.javaClass 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.

Paint.javaInterface This Paint interface defines how color patterns can be generated for Graphics2D operations.
PaintContext.javaInterface The PaintContext interface defines the encapsulated and optimized environment to generate color patterns in device space for fill or stroke operations on a Graphics2D .
Panel.javaClass Panel is the simplest container class.
Point.javaClass A point representing a location in (x,y) coordinate space, specified in integer precision.
PointerInfo.javaClass A class that describes the pointer position. It provides the GraphicsDevice where the pointer is and the Point that represents the coordinates of the pointer.

Instances of this class should be obtained via MouseInfo.getPointerInfo . The PointerInfo instance is not updated dynamically as the mouse moves.

Polygon.javaClass The Polygon class encapsulates a description of a closed, two-dimensional region within a coordinate space.
PopupMenu.javaClass A class that implements a menu which can be dynamically popped up at a specified position within a component.
PrintGraphics.javaInterface An abstract class which provides a print graphics context for a page.
PrintJob.javaClass An abstract class which initiates and executes a print job.
RadialGradientPaint.javaClass The RadialGradientPaint class provides a way to fill a shape with a circular radial color gradient pattern.
RadialGradientPaintContext.javaClass Provides the actual implementation for the RadialGradientPaint. This is where the pixel processing is done.
Rectangle.javaClass A Rectangle specifies an area in a coordinate space that is enclosed by the Rectangle object's upper-left point (x,y) in the coordinate space, its width, and its height.
RenderingHints.javaClass The RenderingHints class defines and manages collections of keys and associated values which allow an application to provide input into the choice of algorithms used by other classes which perform rendering and image manipulation services.
Robot.javaClass 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.
Scrollbar.javaClass The Scrollbar class embodies a scroll bar, a familiar user-interface object.
ScrollPane.javaClass A container class which implements automatic horizontal and/or vertical scrolling for a single child component.
ScrollPaneAdjustable.javaClass This class represents the state of a horizontal or vertical scrollbar of a ScrollPane.
SentEvent.javaClass A wrapping tag for a nested AWTEvent which indicates that the event was sent from another AppContext.
SequencedEvent.javaClass A mechanism for ensuring that a series of AWTEvents are executed in a precise order, even across multiple AppContexts.
Shape.javaInterface The Shape interface provides definitions for objects that represent some form of geometric shape.
SplashScreen.javaClass The splash screen can be created at application startup, before the Java Virtual Machine (JVM) starts.
Stroke.javaInterface 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.
SystemColor.javaClass A class to encapsulate symbolic colors representing the color of native GUI objects on a system.
SystemTray.javaClass The SystemTray class represents the system tray for a desktop.
TextArea.javaClass A TextArea object is a multi-line region that displays text.
TextComponent.javaClass The TextComponent class is the superclass of any component that allows the editing of some text.
TextField.javaClass 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.

TexturePaint.javaClass The TexturePaint class provides a way to fill a Shape with a texture that is specified as a BufferedImage .
TexturePaintContext.javaClass
Toolkit.javaClass This class is the abstract superclass of all actual implementations of the Abstract Window Toolkit.
Transparency.javaInterface The Transparency interface defines the common transparency modes for implementing classes.
TrayIcon.javaClass A TrayIcon object represents a tray icon that can be added to the SystemTray system tray .
Window.javaClass A Window object is a top-level window with no borders and no menubar.
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.