Module java.desktop
Package java.awt

Class Toolkit


public abstract class Toolkit extends Object
This class is the abstract superclass of all actual implementations of the Abstract Window Toolkit. Subclasses of the Toolkit class are used to bind the various components to particular native toolkit implementations.

Many GUI events may be delivered to user asynchronously, if the opposite is not specified explicitly. As well as many GUI operations may be performed asynchronously. This fact means that if the state of a component is set, and then the state immediately queried, the returned value may not yet reflect the requested change. This behavior includes, but is not limited to:

  • Scrolling to a specified position.
    For example, calling ScrollPane.setScrollPosition and then getScrollPosition may return an incorrect value if the original request has not yet been processed.
  • Moving the focus from one component to another.
    For more information, see Timing Focus Transfers, a section in The Swing Tutorial.
  • Making a top-level container visible.
    Calling setVisible(true) on a Window, Frame or Dialog may occur asynchronously.
  • Setting the size or location of a top-level container.
    Calls to setSize, setBounds or setLocation on a Window, Frame or Dialog are forwarded to the underlying window management system and may be ignored or modified. See Window for more information.

Most applications should not call any of the methods in this class directly. The methods defined by Toolkit are the "glue" that joins the platform-independent classes in the java.awt package with their counterparts in java.awt.peer. Some methods defined by Toolkit query the native operating system directly.