Module java.desktop

# Package java.awt

package 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 container 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 `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

- The AWT Focus Subsystem
- The AWT Modality
- The Java AWT Native Interface (JAWT)

Since:
  1.0

Related Packages
Module
Package
Description
java.desktop
java.awt.color
Provides classes for color spaces.
java.datatransfer
java.awt.datatransfer
Provides interfaces and classes for transferring data between and within applications.
java.desktop
java.awt.desktop
Provides interfaces and classes for interaction with various desktop capabilities.
java.desktop
java.awt.dnd
Drag and Drop is a direct manipulation gesture found in many Graphical User Interface systems that provides a mechanism to transfer information between two entities logically associated with presentation elements in the GUI.
java.desktop
java.awt.event
Provides interfaces and classes for dealing with different types of events fired by AWT components.
java.desktop
java.awt.font
Provides classes and interface relating to fonts.
java.desktop
java.awt.geom
Provides the Java 2D classes for defining and performing operations on objects related to two-dimensional geometry.
java.desktop
java.awt.im
Provides classes and interfaces for the input method framework.
java.desktop
java.awt.image
Provides classes for creating and modifying images.
java.desktop
java.awt.print
Provides classes and interfaces for a general printing API.
Class
Description
ActiveEvent
An interface for events that know how to dispatch themselves.
Adjustable
The interface for objects which have an adjustable numeric value contained within a bounded range of values.
AlphaComposite
The `AlphaComposite` class implements basic alpha compositing rules for combining source and destination colors to achieve blending and transparency effects with graphics and images.
AWTError
Thrown when a serious Abstract Window Toolkit error has occurred.
AWTEvent
The root event class for all AWT events.
AWTEventMulticaster
`AWTEventMulticaster` implements efficient and thread-safe multi-cast event dispatching for the AWT events defined in the `java.awt.event` package.
AWTException
Signals that an Abstract Window Toolkit exception has occurred.
AWTKeyStroke
An `AWTKeyStroke` represents a key action on the keyboard, or equivalent input device.
AWTPermission
This class is for AWT permissions.
BasicStroke
The `BasicStroke` class defines a basic set of rendering attributes for the outlines of graphics primitives, which are rendered with a `Graphics2D` object that has its Stroke attribute set to this `BasicStroke`.
BorderLayout
A border layout lays out a container, arranging and resizing its components to fit in five regions: north, south, east, west, and center.
BufferCapabilities
Capabilities and properties of buffers.
BufferCapabilities.FlipContents
A type-safe enumeration of the possible back buffer contents after page-flipping
Button
This class creates a labeled button.
Canvas
A `Canvas` component represents a blank rectangular area of the screen onto which the application can draw or from which the application can trap input events from the user.
CardLayout
A `CardLayout` object is a layout manager for a container.
Checkbox
A check box is a graphical component that can be in either an "on" (`true`) or "off" (`false`) state.
CheckboxGroup
The `CheckboxGroup` class is used to group together a set of `Checkbox` buttons.
CheckboxMenuItem
This class represents a check box that can be included in a menu.
Choice
The `Choice` class presents a pop-up menu of choices.
Color
The `Color` class is used to encapsulate colors in the default sRGB color space or colors in arbitrary color spaces identified by a `ColorSpace`.
Component
A component is an object having a graphical representation that can be displayed on the screen and that can interact with the user.
Component.BaselineResizeBehavior
Enumeration of the common ways the baseline of a component can change as the size changes.
ComponentOrientation
The ComponentOrientation class encapsulates the language-sensitive orientation that is to be used to order the elements of a component or of text.
Composite
The `Composite` interface, along with `CompositeContext`, defines the methods to compose a draw primitive with the underlying graphics area.
CompositeContext
The `CompositeContext` interface defines the encapsulated and optimized environment for a compositing operation.
Container
A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT components.
ContainerOrderFocusTraversalPolicy
A FocusTraversalPolicy that determines traversal order based on the order of child Components in a Container.
Cursor
A class to encapsulate the bitmap representation of the mouse cursor.
DefaultFocusTraversalPolicy
A FocusTraversalPolicy that determines traversal order based on the order of child Components in a Container.
DefaultKeyboardFocusManager
The default KeyboardFocusManager for AWT applications.
Desktop
The `Desktop` class allows interact with various desktop capabilities.
Desktop.Action
Represents an action type.
Dialog
A Dialog is a top-level window with a title and a border that is typically used to take some form of input from the user.
Dialog.ModalExclusionType
Any top-level window can be marked not to be blocked by modal dialogs.
Dialog.ModalityType
Modal dialogs block all input to some top-level windows.
Dimension
The `Dimension` class encapsulates the width and height of a component (in integer precision) in a single object.
DisplayMode
The `DisplayMode` class encapsulates the bit depth, height, width, and refresh rate of a `GraphicsDevice`.
Event
Deprecated.
It is recommended that `AWTEvent` and its subclasses be used instead
EventQueue
`EventQueue` is a platform-independent class that queues events, both from the underlying peer classes and from trusted application classes.
FileDialog
The `FileDialog` class displays a dialog window from which the user can select a file.
FlowLayout
A flow layout arranges components in a directional flow, much like lines of text in a paragraph.
FocusTraversalPolicy
A FocusTraversalPolicy defines the order in which Components with a particular focus cycle root are traversed.
Font
The `Font` class represents fonts, which are used to render text in a visible way.
FontFormatException
Thrown by method createFont in the `Font` class to indicate that the specified font is bad.
FontMetrics
The `FontMetrics` class defines a font metrics object, which encapsulates information about the rendering of a particular font on a particular screen.
Frame
A `Frame` is a top-level window with a title and a border.
GradientPaint
The `GradientPaint` class provides a way to fill a `Shape` with a linear color gradient pattern.
Graphics
The `Graphics` class is the abstract base class for all graphics contexts that allow an application to draw onto components that are realized on various devices, as well as onto off-screen images.
Graphics2D
This `Graphics2D` class extends the `Graphics` class to provide more sophisticated control over geometry, coordinate transformations, color management, and text layout.
GraphicsConfigTemplate
The `GraphicsConfigTemplate` class is used to obtain a valid `GraphicsConfiguration`.
GraphicsConfiguration
The `GraphicsConfiguration` class describes the characteristics of a graphics destination such as a printer or monitor.
GraphicsDevice
The `GraphicsDevice` class describes the graphics devices that might be available in a particular graphics environment.
GraphicsDevice.WindowTranslucency
Kinds of translucency supported by the underlying system.
GraphicsEnvironment
The `GraphicsEnvironment` class describes the collection of `GraphicsDevice` objects and `Font` objects available to a Java(tm) application on a particular platform.
GridBagConstraints
The `GridBagConstraints` class specifies constraints for components that are laid out using the `GridBagLayout` class.
GridBagLayout
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.
GridBagLayoutInfo
The `GridBagLayoutInfo` is an utility class for `GridBagLayout` layout manager.
GridLayout
The `GridLayout` class is a layout manager that lays out a container's components in a rectangular grid.
HeadlessException
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
Signals that an AWT component is not in an appropriate state for the requested operation.
Image
The abstract class `Image` is the superclass of all classes that represent graphical images.
ImageCapabilities
Capabilities and properties of images.
Insets
An `Insets` object is a representation of the borders of a container.
ItemSelectable
The interface for objects which contain a set of items for which zero or more can be selected.
JobAttributes
A set of attributes which control a print job.
JobAttributes.DefaultSelectionType
A type-safe enumeration of possible default selection states.
JobAttributes.DestinationType
A type-safe enumeration of possible job destinations.
JobAttributes.DialogType
A type-safe enumeration of possible dialogs to display to the user.
JobAttributes.MultipleDocumentHandlingType
A type-safe enumeration of possible multiple copy handling states.
JobAttributes.SidesType
A type-safe enumeration of possible multi-page impositions.
KeyboardFocusManager
The KeyboardFocusManager is responsible for managing the active and focused Windows, and the current focus owner.
KeyEventDispatcher
A KeyEventDispatcher cooperates with the current KeyboardFocusManager in the targeting and dispatching of all KeyEvents.
KeyEventPostProcessor
A KeyEventPostProcessor cooperates with the current KeyboardFocusManager in the final resolution of all unconsumed KeyEvents.
Label
A `Label` object is a component for placing text in a container.
LayoutManager
Defines the interface for classes that know how to lay out `Container`s.
LayoutManager2
Defines an interface for classes that know how to layout `Container`s based on a layout constraints object.
LinearGradientPaint
The `LinearGradientPaint` class provides a way to fill a `Shape` with a linear color gradient pattern.
List
The `List` component presents the user with a scrolling list of text items.
MediaTracker
The `MediaTracker` class is a utility class to track the status of a number of media objects.
Menu
A `Menu` object is a pull-down menu component that is deployed from a menu bar.
MenuBar
The `MenuBar` class encapsulates the platform's concept of a menu bar bound to a frame.
MenuComponent
The abstract class `MenuComponent` is the superclass of all menu-related components.
MenuContainer
The super class of all menu related containers.
MenuItem
All items in a menu must belong to the class `MenuItem`, or one of its subclasses.
MenuShortcut
The `MenuShortcut` class represents a keyboard accelerator for a MenuItem.
MouseInfo
`MouseInfo` provides methods for getting information about the mouse, such as mouse pointer location and the number of mouse buttons.
MultipleGradientPaint
This is the superclass for Paints which use a multiple color gradient to fill in their raster.
MultipleGradientPaint.ColorSpaceType
The color space in which to perform the gradient interpolation.
MultipleGradientPaint.CycleMethod
The method to use when painting outside the gradient bounds.
PageAttributes
A set of attributes which control the output of a printed page.
PageAttributes.ColorType
A type-safe enumeration of possible color states.
PageAttributes.MediaType
A type-safe enumeration of possible paper sizes.
PageAttributes.OrientationRequestedType
A type-safe enumeration of possible orientations.
PageAttributes.OriginType
A type-safe enumeration of possible origins.
PageAttributes.PrintQualityType
A type-safe enumeration of possible print qualities.
Paint
This `Paint` interface defines how color patterns can be generated for `Graphics2D` operations.
PaintContext
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
`Panel` is the simplest container class.
Point
A point representing a location in `(x,y)` coordinate space, specified in integer precision.
PointerInfo
A class that describes the pointer position.
Polygon
The `Polygon` class encapsulates a description of a closed, two-dimensional region within a coordinate space.
PopupMenu
A class that implements a menu which can be dynamically popped up at a specified position within a component.
PrintGraphics
An abstract class which provides a print graphics context for a page.
PrintJob
An abstract class which initiates and executes a print job.
RadialGradientPaint
The `RadialGradientPaint` class provides a way to fill a shape with a circular radial color gradient pattern.
Rectangle
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
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.
RenderingHints.Key
Defines the base type of all keys used along with the `RenderingHints` class to control various algorithm choices in the rendering and imaging pipelines.
Robot
This class is used to generate native system input events for the purposes of test automation, self-running demos, and other applications where control of the mouse and keyboard is needed.
Scrollbar
The `Scrollbar` class embodies a scroll bar, a familiar user-interface object.
ScrollPane
A container class which implements automatic horizontal and/or vertical scrolling for a single child component.
ScrollPaneAdjustable
This class represents the state of a horizontal or vertical scrollbar of a `ScrollPane`.
SecondaryLoop
A helper interface to run the nested event loop.
Shape
The `Shape` interface provides definitions for objects that represent some form of geometric shape.
SplashScreen
The splash screen can be displayed at application startup, before the Java Virtual Machine (JVM) starts.
Stroke
The `Stroke` interface allows a `Graphics2D` object to obtain a `Shape` that is the decorated outline, or stylistic representation of the outline, of the specified `Shape`.
SystemColor
A class to encapsulate symbolic colors representing the color of native GUI objects on a system.
SystemTray
The `SystemTray` class represents the system tray for a desktop.
Taskbar
The `Taskbar` class allows a Java application to interact with the system task area (taskbar, Dock, etc.).
Taskbar.Feature
List of provided features.
Taskbar.State
Kinds of available window progress states.
TextArea
A `TextArea` object is a multi-line region that displays text.
TextComponent
The `TextComponent` class is the superclass of any component that allows the editing of some text.
TextField
A `TextField` object is a text component that allows for the editing of a single line of text.
TexturePaint
The `TexturePaint` class provides a way to fill a `Shape` with a texture that is specified as a `BufferedImage`.
Toolkit
This class is the abstract superclass of all actual implementations of the Abstract Window Toolkit.
Transparency
The `Transparency` interface defines the common transparency modes for implementing classes.
TrayIcon
A `TrayIcon` object represents a tray icon that can be added to the `system tray`.
TrayIcon.MessageType
The message type determines which icon will be displayed in the caption of the message, and a possible system sound a message may generate upon showing.
Window
A `Window` object is a top-level window with no borders and no menubar.
Window.Type
Enumeration of available window types.