API Overview API Index Package Overview Direct link to this page
JDK 1.6
  javax.swing. SwingUtilities View Source
Author(s)
unknown
Since
Version
1.147 08/08/06
Serial
Hierarchy
 Object
      SwingUtilities
Implements
 SwingConstants
Subclasses
Description
public class SwingUtilities
A collection of utility methods for Swing.
See also:   
Constructors
private SwingUtilities ()
Methods
Hide/Show inherited methods
pack-privatestatic Object appContextGet (Object key)
pack-privatestatic void appContextPut (Object key, Object value)
pack-privatestatic void appContextRemove (Object key)
publicstatic Rectangle calculateInnerArea (JComponent c, Rectangle r)
  Stores the position and size of the inner painting area of the specified component in r and returns r.
publicstatic Rectangle computeDifference (Rectangle rectA, Rectangle rectB)
  Convenience returning an array of rect representing the regions within rectA that do not overlap with rectB.
publicstatic Rectangle computeIntersection (int x, int y, int width, int height, Rectangle dest)
  Convenience to calculate the intersection of two rectangles without allocating a new rectangle.
publicstatic int computeStringWidth (FontMetrics fm, String str)
  Compute the width of the string using a font with the specified "metrics" (sizes).
publicstatic Rectangle computeUnion (int x, int y, int width, int height, Rectangle dest)
  Convenience method that calculates the union of two rectangles without allocating a new rectangle.
publicstatic MouseEvent convertMouseEvent (Component source, MouseEvent sourceEvent, Component destination)
  Returns a MouseEvent similar to sourceEvent except that its x and y members have been converted to destination's coordinate system.
publicstatic Point convertPoint (Component source, int x, int y, Component destination)
  Convert the point (x,y) in source coordinate system to destination coordinate system.
publicstatic Point convertPoint (Component source, Point aPoint, Component destination)
  Convert a aPoint in source coordinate system to destination coordinate system.
publicstatic void convertPointFromScreen (Point p, Component c)
  Convert a point from a screen coordinates to a component's coordinate system
publicstatic void convertPointToScreen (Point p, Component c)
  Convert a point from a component's coordinate system to screen coordinates.
publicstatic Rectangle convertRectangle (Component source, Rectangle aRectangle, Component destination)
  Convert the rectangle aRectangle in source coordinate system to destination coordinate system.
pack-privatestatic Point convertScreenLocationToParent (Container parent, int x, int y)
Converts the location x y to the parents coordinate system, returning the location.
pack-privatestatic boolean doesIconReferenceImage (Icon icon, Image image)
Returns true if the Icon icon is an instance of ImageIcon, and the image it contains is the same as image.
pack-privatestatic int findDisplayedMnemonicIndex (String text, int mnemonic)
  Returns index of the first occurrence of mnemonic within string text.
@Deprecated
publicstatic Component findFocusOwner (Component c)
  Return the child Component of the specified Component that is the focus owner, if any.
publicstatic Accessible getAccessibleAt (Component c, Point p)
  Returns the Accessible child contained at the local coordinate Point, if one exists.
publicstatic Accessible getAccessibleChild (Component c, int i)
  Return the nth Accessible child of the object.
publicstatic int getAccessibleChildrenCount (Component c)
  Returns the number of accessible children in the object.
publicstatic int getAccessibleIndexInParent (Component c)
  Get the index of this object in its accessible parent.
publicstatic AccessibleStateSet getAccessibleStateSet (Component c)
  Get the state of this object.
publicstatic Container getAncestorNamed (String name, Component comp)
  Convenience method for searching above comp in the component hierarchy and returns the first object of name it finds.
publicstatic Container getAncestorOfClass (Class<Object> c, Component comp)
  Convenience method for searching above comp in the component hierarchy and returns the first object of class c it finds.
publicstatic Component getDeepestComponentAt (Component parent, int x, int y)
  Returns the deepest visible descendent Component of parent that contains the location x, y.
publicstatic Rectangle getLocalBounds (Component aComponent)
Return the rectangle (0,0,bounds.width,bounds.height) for the component aComponent
publicstatic Component getRoot (Component c)
  Returns the root component for the current component tree.
publicstatic JRootPane getRootPane (Component c)
  If c is a JRootPane descendant return its JRootPane ancestor.
pack-privatestatic Frame getSharedOwnerFrame () throws HeadlessException
  Returns a toolkit-private, shared, invisible Frame to be the owner for JDialogs and JWindows created with null owners.
pack-privatestatic WindowListener getSharedOwnerFrameShutdownListener () throws HeadlessException
  Returns a SharedOwnerFrame's shutdown listener to dispose the SharedOwnerFrame if it has no more displayable children.
publicstatic ActionMap getUIActionMap (JComponent component)
  Returns the ActionMap provided by the UI in component component.
publicstatic InputMap getUIInputMap (JComponent component, int condition)
  Returns the InputMap provided by the UI for condition condition in component component.
publicstatic Window getWindowAncestor (Component c)
  Returns the first Window ancestor of c, or null if c is not contained inside a Window.
pack-privatestatic void installSwingDropTargetAsNecessary (Component c, TransferHandler t)
Installs a DropTarget on the component as necessary for a TransferHandler change.
publicstatic void invokeAndWait (Runnable doRun) throws InterruptedException InvocationTargetException
  Causes doRun.run() to be executed synchronously on the AWT event dispatching thread.
publicstatic void invokeLater (Runnable doRun)
  Causes doRun.run() to be executed asynchronously on the AWT event dispatching thread.
publicstatic boolean isDescendingFrom (Component a, Component b)
Return true if a component a descends from a component b
publicstatic boolean isEventDispatchThread ()
  Returns true if the current thread is an AWT event dispatching thread.
publicstatic boolean isLeftMouseButton (MouseEvent anEvent)
  Returns true if the mouse event specifies the left mouse button.
pack-privatestatic boolean isLeftToRight (Component c)
publicstatic boolean isMiddleMouseButton (MouseEvent anEvent)
  Returns true if the mouse event specifies the middle mouse button.
publicfinalstatic boolean isRectangleContainingRectangle (Rectangle a, Rectangle b)
Return true if a contains b
publicstatic boolean isRightMouseButton (MouseEvent anEvent)
  Returns true if the mouse event specifies the right mouse button.
pack-privatestatic boolean isValidKeyEventForKeyBindings (KeyEvent e)
Returns true if the e is a valid KeyEvent to use in processing the key bindings associated with JComponents.
publicstatic String layoutCompoundLabel (FontMetrics fm, String text, Icon icon, int verticalAlignment, int horizontalAlignment, int verticalTextPosition, int horizontalTextPosition, Rectangle viewR, Rectangle iconR, Rectangle textR, int textIconGap)
  Compute and return the location of the icons origin, the location of origin of the text baseline, and a possibly clipped version of the compound labels string.
publicstatic String layoutCompoundLabel (JComponent c, FontMetrics fm, String text, Icon icon, int verticalAlignment, int horizontalAlignment, int verticalTextPosition, int horizontalTextPosition, Rectangle viewR, Rectangle iconR, Rectangle textR, int textIconGap)
  Compute and return the location of the icons origin, the location of origin of the text baseline, and a possibly clipped version of the compound labels string.
pack-privatestatic Class loadSystemClass (String className) throws ClassNotFoundException
publicstatic boolean notifyAction (Action action, KeyStroke ks, KeyEvent event, Object sender, int modifiers)
  Invokes actionPerformed on action if action is enabled (and non-null).
publicstatic void paintComponent (Graphics g, Component c, Container p, int x, int y, int w, int h)
  Paints a component to the specified Graphics.
publicstatic void paintComponent (Graphics g, Component c, Container p, Rectangle r)
  Paints a component to the specified Graphics.
publicstatic boolean processKeyBindings (KeyEvent event)
  Process the key bindings for the Component associated with event.
publicstatic void replaceUIActionMap (JComponent component, ActionMap uiActionMap)
  Convenience method to change the UI ActionMap for component to uiActionMap.
publicstatic void replaceUIInputMap (JComponent component, int type, InputMap uiInputMap)
  Convenience method to change the UI InputMap for component to uiInputMap.
publicstatic void updateComponentTreeUI (Component c)
A simple minded look and feel change: ask each node in the tree to updateUI() -- that is, to initialize its UI property with the current look and feel.
publicstatic Window windowForComponent (Component c)
  Returns the first Window ancestor of c, or null if c is not contained inside a Window.
Fields
Hide/Show inherited fields
publicfinalstatic int BOTTOM = "3" [Inherited From SwingConstants]
Box-orientation constant used to specify the bottom of a box.
publicfinalstatic int CENTER = "0" [Inherited From SwingConstants]
  The central position in an area.
publicfinalstatic int EAST = "3" [Inherited From SwingConstants]
Compass-direction east (right).
publicfinalstatic int HORIZONTAL = "0" [Inherited From SwingConstants]
  Horizontal orientation.
publicfinalstatic int LEADING = "10" [Inherited From SwingConstants]
  Identifies the leading edge of text for use with left-to-right and right-to-left languages.
publicfinalstatic int LEFT = "2" [Inherited From SwingConstants]
Box-orientation constant used to specify the left side of a box.
publicfinalstatic int NEXT = "12" [Inherited From SwingConstants]
  Identifies the next direction in a sequence.
publicfinalstatic int NORTH = "1" [Inherited From SwingConstants]
Compass-direction North (up).
publicfinalstatic int NORTH_EAST = "2" [Inherited From SwingConstants]
Compass-direction north-east (upper right).
publicfinalstatic int NORTH_WEST = "8" [Inherited From SwingConstants]
Compass-direction north west (upper left).
publicfinalstatic int PREVIOUS = "13" [Inherited From SwingConstants]
  Identifies the previous direction in a sequence.
publicfinalstatic int RIGHT = "4" [Inherited From SwingConstants]
Box-orientation constant used to specify the right side of a box.
publicfinalstatic int SOUTH = "5" [Inherited From SwingConstants]
Compass-direction south (down).
publicfinalstatic int SOUTH_EAST = "4" [Inherited From SwingConstants]
Compass-direction south-east (lower right).
publicfinalstatic int SOUTH_WEST = "6" [Inherited From SwingConstants]
Compass-direction south-west (lower left).
publicfinalstatic int TOP = "1" [Inherited From SwingConstants]
Box-orientation constant used to specify the top of a box.
publicfinalstatic int TRAILING = "11" [Inherited From SwingConstants]
  Identifies the trailing edge of text for use with left-to-right and right-to-left languages.
publicfinalstatic int VERTICAL = "1" [Inherited From SwingConstants]
  Vertical orientation.
publicfinalstatic int WEST = "7" [Inherited From SwingConstants]
Compass-direction west (left).
Nested Classes
  SwingUtilities.SharedOwnerFrame
Generated By: JavaOnTracks Doclet 0.1.4     ©Thibaut Colar