| java.lang.Object javax.swing.SwingUtilities
SwingUtilities | public class SwingUtilities implements SwingConstants(Code) | | A collection of utility methods for Swing.
version: 1.154 05/05/07 author: unknown |
Method Summary | |
static Object | appContextGet(Object key) | static void | appContextPut(Object key, Object value) | static void | appContextRemove(Object key) | public static 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 . | public static Rectangle[] | computeDifference(Rectangle rectA, Rectangle rectB) Convenience returning an array of rect representing the regions within
rectA that do not overlap with rectB . | public static 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. | public static int | computeStringWidth(FontMetrics fm, String str) Compute the width of the string using a font with the specified
"metrics" (sizes). | public static 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. | public static 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. | public static Point | convertPoint(Component source, Point aPoint, Component destination) Convert a aPoint in source coordinate system to
destination coordinate system. | public static Point | convertPoint(Component source, int x, int y, Component destination) Convert the point (x,y) in source coordinate system to
destination coordinate system. | public static void | convertPointFromScreen(Point p, Component c) | public static void | convertPointToScreen(Point p, Component c) Convert a point from a component's coordinate system to
screen coordinates. | public static Rectangle | convertRectangle(Component source, Rectangle aRectangle, Component destination) Convert the rectangle aRectangle in source coordinate system to
destination coordinate system. | static Point | convertScreenLocationToParent(Container parent, int x, int y) Converts the location x y to the
parents coordinate system, returning the location. | static 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 . | static int | findDisplayedMnemonicIndex(String text, int mnemonic) Returns index of the first occurrence of mnemonic
within string text . | public static Component | findFocusOwner(Component c) Return the child Component of the specified
Component that is the focus owner, if any. | public static Accessible | getAccessibleAt(Component c, Point p) Returns the Accessible child contained at the
local coordinate Point , if one exists. | public static Accessible | getAccessibleChild(Component c, int i) Return the nth Accessible child of the object. | public static int | getAccessibleChildrenCount(Component c) Returns the number of accessible children in the object. | public static int | getAccessibleIndexInParent(Component c) Get the index of this object in its accessible parent.
Note: as of the Java 2 platform v1.3, it is recommended that developers call
Component.AccessibleAWTComponent.getAccessibleIndexInParent() instead
of using this method. | public static AccessibleStateSet | getAccessibleStateSet(Component c) Get the state of this object. | public static 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. | public static Container | getAncestorOfClass(Class> c, Component comp) Convenience method for searching above comp in the
component hierarchy and returns the first object of class c it
finds. | public static Component | getDeepestComponentAt(Component parent, int x, int y) Returns the deepest visible descendent Component of parent
that contains the location x , y . | public static Rectangle | getLocalBounds(Component aComponent) | public static Component | getRoot(Component c) Returns the root component for the current component tree. | public static JRootPane | getRootPane(Component c) If c is a JRootPane descendant return its JRootPane ancestor. | static Frame | getSharedOwnerFrame() Returns a toolkit-private, shared, invisible Frame
to be the owner for JDialogs and JWindows created with
null owners. | static WindowListener | getSharedOwnerFrameShutdownListener() Returns a SharedOwnerFrame's shutdown listener to dispose the SharedOwnerFrame
if it has no more displayable children. | public static ActionMap | getUIActionMap(JComponent component) Returns the ActionMap provided by the UI
in component component . | public static InputMap | getUIInputMap(JComponent component, int condition) Returns the InputMap provided by the UI for condition
condition in component component . | public static Window | getWindowAncestor(Component c) Returns the first Window ancestor of c , or
null if c is not contained inside a Window .
Parameters: c - Component to get Window ancestorof. | static void | installSwingDropTargetAsNecessary(Component c, TransferHandler t) Installs a
DropTarget on the component as necessary for a
TransferHandler change. | public static void | invokeAndWait(Runnable doRun) Causes doRun.run() to be executed synchronously on the
AWT event dispatching thread. | public static void | invokeLater(Runnable doRun) Causes doRun.run() to be executed asynchronously on the
AWT event dispatching thread. | public static boolean | isDescendingFrom(Component a, Component b) | public static boolean | isEventDispatchThread() Returns true if the current thread is an AWT event dispatching thread. | public static boolean | isLeftMouseButton(MouseEvent anEvent) Returns true if the mouse event specifies the left mouse button. | static boolean | isLeftToRight(Component c) | public static boolean | isMiddleMouseButton(MouseEvent anEvent) Returns true if the mouse event specifies the middle mouse button. | final public static boolean | isRectangleContainingRectangle(Rectangle a, Rectangle b) | public static boolean | isRightMouseButton(MouseEvent anEvent) Returns true if the mouse event specifies the right mouse button. | static boolean | isValidKeyEventForKeyBindings(KeyEvent e) Returns true if the e is a valid KeyEvent to use in
processing the key bindings associated with JComponents. | public static 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. | public static 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. | static Class | loadSystemClass(String className) | public static boolean | notifyAction(Action action, KeyStroke ks, KeyEvent event, Object sender, int modifiers) Invokes actionPerformed on action if
action is enabled (and non-
null ). | public static void | paintComponent(Graphics g, Component c, Container p, int x, int y, int w, int h) Paints a component to the specified Graphics .
This method is primarily useful to render
Component s that don't exist as part of the visible
containment hierarchy, but are used for rendering. | public static void | paintComponent(Graphics g, Component c, Container p, Rectangle r) Paints a component to the specified Graphics . | public static boolean | processKeyBindings(KeyEvent event) Process the key bindings for the Component associated with
event . | public static void | replaceUIActionMap(JComponent component, ActionMap uiActionMap) Convenience method to change the UI ActionMap for component
to uiActionMap . | public static void | replaceUIInputMap(JComponent component, int type, InputMap uiInputMap) Convenience method to change the UI InputMap for component
to uiInputMap . | public static 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. | static void | updateRendererOrEditorUI(Object rendererOrEditor) | public static Window | windowForComponent(Component c) Returns the first Window ancestor of c , or
null if c is not contained inside a Window .
Note: This method provides the same functionality as
getWindowAncestor .
Parameters: c - Component to get Window ancestorof. |
appContextRemove | static void appContextRemove(Object key)(Code) | | |
calculateInnerArea | public static Rectangle calculateInnerArea(JComponent c, Rectangle r)(Code) | | Stores the position and size of
the inner painting area of the specified component
in r and returns r .
The position and size specify the bounds of the component,
adjusted so as not to include the border area (the insets).
This method is useful for classes
that implement painting code.
Parameters: c - the JComponent in question; if null , this method returns null Parameters: r - the Rectangle instance to be modified;may be null null if the Component is null ;otherwise, returns the passed-in rectangle (if non- null )or a new rectangle specifying position and size information since: 1.4 |
computeDifference | public static Rectangle[] computeDifference(Rectangle rectA, Rectangle rectB)(Code) | | Convenience returning an array of rect representing the regions within
rectA that do not overlap with rectB . If the
two Rects do not overlap, returns an empty array
|
computeIntersection | public static Rectangle computeIntersection(int x, int y, int width, int height, Rectangle dest)(Code) | | Convenience to calculate the intersection of two rectangles
without allocating a new rectangle.
If the two rectangles don't intersect,
then the returned rectangle begins at (0,0)
and has zero width and height.
Parameters: x - the X coordinate of the first rectangle's top-left point Parameters: y - the Y coordinate of the first rectangle's top-left point Parameters: width - the width of the first rectangle Parameters: height - the height of the first rectangle Parameters: dest - the second rectangle dest , modified to specify the intersection |
computeStringWidth | public static int computeStringWidth(FontMetrics fm, String str)(Code) | | Compute the width of the string using a font with the specified
"metrics" (sizes).
Parameters: fm - a FontMetrics object to compute with Parameters: str - the String to compute an int containing the string width |
computeUnion | public static Rectangle computeUnion(int x, int y, int width, int height, Rectangle dest)(Code) | | Convenience method that calculates the union of two rectangles
without allocating a new rectangle.
Parameters: x - the x-coordinate of the first rectangle Parameters: y - the y-coordinate of the first rectangle Parameters: width - the width of the first rectangle Parameters: height - the height of the first rectangle Parameters: dest - the coordinates of the second rectangle; the unionof the two rectangles is returned in this rectangle the dest Rectangle |
convertMouseEvent | public static MouseEvent convertMouseEvent(Component source, MouseEvent sourceEvent, Component destination)(Code) | | Returns a MouseEvent similar to sourceEvent except that its x
and y members have been converted to destination 's coordinate
system. If source is
null , sourceEvent x and y members
are assumed to be into destination 's root component coordinate system.
If destination is null , the
returned MouseEvent will be in source 's coordinate system.
sourceEvent will not be changed. A new event is returned.
the source field of the returned event will be set
to destination if destination is non-
null use the translateMouseEvent() method to translate a mouse event from
one component to another without changing the source.
|
convertPoint | public static Point convertPoint(Component source, Point aPoint, Component destination)(Code) | | Convert a aPoint in source coordinate system to
destination coordinate system.
If source is
null , aPoint is assumed to be in destination 's
root component coordinate system.
If destination is
null , aPoint will be converted to source 's
root component coordinate system.
If both source and destination are
null , return aPoint
without any conversion.
|
convertPoint | public static Point convertPoint(Component source, int x, int y, Component destination)(Code) | | Convert the point (x,y) in source coordinate system to
destination coordinate system.
If source is
null , (x,y) is assumed to be in destination 's
root component coordinate system.
If destination is
null , (x,y) will be converted to source 's
root component coordinate system.
If both source and destination are
null , return (x,y)
without any conversion.
|
convertPointFromScreen | public static void convertPointFromScreen(Point p, Component c)(Code) | | Convert a point from a screen coordinates to a component's
coordinate system
Parameters: p - a Point object (converted to the new coordinate system) Parameters: c - a Component object |
convertPointToScreen | public static void convertPointToScreen(Point p, Component c)(Code) | | Convert a point from a component's coordinate system to
screen coordinates.
Parameters: p - a Point object (converted to the new coordinate system) Parameters: c - a Component object |
convertRectangle | public static Rectangle convertRectangle(Component source, Rectangle aRectangle, Component destination)(Code) | | Convert the rectangle aRectangle in source coordinate system to
destination coordinate system.
If source is
null , aRectangle is assumed to be in destination 's
root component coordinate system.
If destination is
null , aRectangle will be converted to source 's
root component coordinate system.
If both source and destination are
null , return aRectangle
without any conversion.
|
convertScreenLocationToParent | static Point convertScreenLocationToParent(Container parent, int x, int y)(Code) | | Converts the location x y to the
parents coordinate system, returning the location.
|
doesIconReferenceImage | static boolean doesIconReferenceImage(Icon icon, Image image)(Code) | | Returns true if the Icon icon is an instance of
ImageIcon, and the image it contains is the same as image .
|
findDisplayedMnemonicIndex | static int findDisplayedMnemonicIndex(String text, int mnemonic)(Code) | | Returns index of the first occurrence of mnemonic
within string text . Matching algorithm is not
case-sensitive.
Parameters: text - The text to search through, may be null Parameters: mnemonic - The mnemonic to find the character for. index into the string if exists, otherwise -1 |
findFocusOwner | public static Component findFocusOwner(Component c)(Code) | | Return the child Component of the specified
Component that is the focus owner, if any.
Parameters: c - the root of the Component hierarchy tosearch for the focus owner the focus owner, or null if there is no focusowner, or if the focus owner is not comp , or adescendant of comp See Also: java.awt.KeyboardFocusManager.getFocusOwner |
getAccessibleAt | public static Accessible getAccessibleAt(Component c, Point p)(Code) | | Returns the Accessible child contained at the
local coordinate Point , if one exists.
Otherwise returns null .
the Accessible at the specified location,if it exists; otherwise null |
getAccessibleChild | public static Accessible getAccessibleChild(Component c, int i)(Code) | | Return the nth Accessible child of the object.
Note: as of the Java 2 platform v1.3, it is recommended that developers call
Component.AccessibleAWTComponent.getAccessibleIndexInParent() instead
of using this method.
Parameters: i - zero-based index of child the nth Accessible child of the object |
getAccessibleChildrenCount | public static int getAccessibleChildrenCount(Component c)(Code) | | Returns the number of accessible children in the object. If all
of the children of this object implement Accessible, than this
method should return the number of children of this object.
Note: as of the Java 2 platform v1.3, it is recommended that developers call
Component.AccessibleAWTComponent.getAccessibleIndexInParent() instead
of using this method.
the number of accessible children in the object. |
getAccessibleIndexInParent | public static int getAccessibleIndexInParent(Component c)(Code) | | Get the index of this object in its accessible parent.
Note: as of the Java 2 platform v1.3, it is recommended that developers call
Component.AccessibleAWTComponent.getAccessibleIndexInParent() instead
of using this method.
-1 of this object does not have an accessible parent.Otherwise, the index of the child in its accessible parent. |
getAccessibleStateSet | public static AccessibleStateSet getAccessibleStateSet(Component c)(Code) | | Get the state of this object.
Note: as of the Java 2 platform v1.3, it is recommended that developers call
Component.AccessibleAWTComponent.getAccessibleIndexInParent() instead
of using this method.
an instance of AccessibleStateSet containing the current stateset of the object See Also: AccessibleState |
getAncestorNamed | public static Container getAncestorNamed(String name, Component comp)(Code) | | Convenience method for searching above comp in the
component hierarchy and returns the first object of name it
finds. Can return
null , if name cannot be found.
|
getAncestorOfClass | public static Container getAncestorOfClass(Class> c, Component comp)(Code) | | Convenience method for searching above comp in the
component hierarchy and returns the first object of class c it
finds. Can return
null , if a class c cannot be found.
|
getDeepestComponentAt | public static Component getDeepestComponentAt(Component parent, int x, int y)(Code) | | Returns the deepest visible descendent Component of parent
that contains the location x , y .
If parent does not contain the specified location,
then null is returned. If parent is not a
container, or none of parent 's visible descendents
contain the specified location, parent is returned.
Parameters: parent - the root component to begin the search Parameters: x - the x target location Parameters: y - the y target location |
getLocalBounds | public static Rectangle getLocalBounds(Component aComponent)(Code) | | Return the rectangle (0,0,bounds.width,bounds.height) for the component aComponent
|
getRoot | public static Component getRoot(Component c)(Code) | | Returns the root component for the current component tree.
the first ancestor of c that's a Window or the last Applet ancestor |
getRootPane | public static JRootPane getRootPane(Component c)(Code) | | If c is a JRootPane descendant return its JRootPane ancestor.
If c is a RootPaneContainer then return its JRootPane.
the JRootPane for Component c or null . |
getUIActionMap | public static ActionMap getUIActionMap(JComponent component)(Code) | | Returns the ActionMap provided by the UI
in component component .
This will return
null if the UI has not installed an ActionMap.
since: 1.3 |
getUIInputMap | public static InputMap getUIInputMap(JComponent component, int condition)(Code) | | Returns the InputMap provided by the UI for condition
condition in component component .
This will return
null if the UI has not installed a InputMap
of the specified type.
since: 1.3 |
getWindowAncestor | public static Window getWindowAncestor(Component c)(Code) | | Returns the first Window ancestor of c , or
null if c is not contained inside a Window .
Parameters: c - Component to get Window ancestorof. the first Window ancestor of c , or null if c is not contained inside aWindow . since: 1.3 |
installSwingDropTargetAsNecessary | static void installSwingDropTargetAsNecessary(Component c, TransferHandler t)(Code) | | Installs a
DropTarget on the component as necessary for a
TransferHandler change.
|
invokeAndWait | public static void invokeAndWait(Runnable doRun) throws InterruptedException, InvocationTargetException(Code) | | Causes doRun.run() to be executed synchronously on the
AWT event dispatching thread. This call blocks until
all pending AWT events have been processed and (then)
doRun.run() returns. This method should
be used when an application thread needs to update the GUI.
It shouldn't be called from the event dispatching thread.
Here's an example that creates a new application thread
that uses invokeAndWait to print a string from the event
dispatching thread and then, when that's finished, print
a string from the application thread.
final Runnable doHelloWorld = new Runnable() {
public void run() {
System.out.println("Hello World on " + Thread.currentThread());
}
};
Thread appThread = new Thread() {
public void run() {
try {
SwingUtilities.invokeAndWait(doHelloWorld);
}
catch (Exception e) {
e.printStackTrace();
}
System.out.println("Finished on " + Thread.currentThread());
}
};
appThread.start();
Note that if the Runnable.run method throws an
uncaught exception
(on the event dispatching thread) it's caught and rethrown, as
an InvocationTargetException , on the caller's thread.
Additional documentation and examples for this method can be
found in
How to Use Threads,
in The Java Tutorial.
As of 1.3 this method is just a cover for
java.awt.EventQueue.invokeAndWait() .
exception: InterruptedException - if we're interrupted while waiting forthe event dispatching thread to finish excecutingdoRun.run() exception: InvocationTargetException - if an exception is thrownwhile running doRun See Also: SwingUtilities.invokeLater |
invokeLater | public static void invokeLater(Runnable doRun)(Code) | | Causes doRun.run() to be executed asynchronously on the
AWT event dispatching thread. This will happen after all
pending AWT events have been processed. This method should
be used when an application thread needs to update the GUI.
In the following example the invokeLater call queues
the Runnable object doHelloWorld
on the event dispatching thread and
then prints a message.
Runnable doHelloWorld = new Runnable() {
public void run() {
System.out.println("Hello World on " + Thread.currentThread());
}
};
SwingUtilities.invokeLater(doHelloWorld);
System.out.println("This might well be displayed before the other message.");
If invokeLater is called from the event dispatching thread --
for example, from a JButton's ActionListener -- the doRun.run() will
still be deferred until all pending events have been processed.
Note that if the doRun.run() throws an uncaught exception
the event dispatching thread will unwind (not the current thread).
Additional documentation and examples for this method can be
found in
How to Use Threads,
in The Java Tutorial.
As of 1.3 this method is just a cover for java.awt.EventQueue.invokeLater() .
Unlike the rest of Swing, this method can be invoked from any thread.
See Also: SwingUtilities.invokeAndWait |
isDescendingFrom | public static boolean isDescendingFrom(Component a, Component b)(Code) | | Return true if a component a descends from a component b
|
isEventDispatchThread | public static boolean isEventDispatchThread()(Code) | | Returns true if the current thread is an AWT event dispatching thread.
As of 1.3 this method is just a cover for
java.awt.EventQueue.isDispatchThread() .
true if the current thread is an AWT event dispatching thread |
isLeftMouseButton | public static boolean isLeftMouseButton(MouseEvent anEvent)(Code) | | Returns true if the mouse event specifies the left mouse button.
Parameters: anEvent - a MouseEvent object true if the left mouse button was active |
isMiddleMouseButton | public static boolean isMiddleMouseButton(MouseEvent anEvent)(Code) | | Returns true if the mouse event specifies the middle mouse button.
Parameters: anEvent - a MouseEvent object true if the middle mouse button was active |
isRectangleContainingRectangle | final public static boolean isRectangleContainingRectangle(Rectangle a, Rectangle b)(Code) | | Return true if a contains b
|
isRightMouseButton | public static boolean isRightMouseButton(MouseEvent anEvent)(Code) | | Returns true if the mouse event specifies the right mouse button.
Parameters: anEvent - a MouseEvent object true if the right mouse button was active |
isValidKeyEventForKeyBindings | static boolean isValidKeyEventForKeyBindings(KeyEvent e)(Code) | | Returns true if the e is a valid KeyEvent to use in
processing the key bindings associated with JComponents.
|
layoutCompoundLabel | public static 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)(Code) | | 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. Locations are computed
relative to the viewR rectangle.
The JComponents orientation (LEADING/TRAILING) will also be taken
into account and translated into LEFT/RIGHT values accordingly.
|
layoutCompoundLabel | public static String layoutCompoundLabel(FontMetrics fm, String text, Icon icon, int verticalAlignment, int horizontalAlignment, int verticalTextPosition, int horizontalTextPosition, Rectangle viewR, Rectangle iconR, Rectangle textR, int textIconGap)(Code) | | 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. Locations are computed
relative to the viewR rectangle.
This layoutCompoundLabel() does not know how to handle LEADING/TRAILING
values in horizontalTextPosition (they will default to RIGHT) and in
horizontalAlignment (they will default to CENTER).
Use the other version of layoutCompoundLabel() instead.
|
notifyAction | public static boolean notifyAction(Action action, KeyStroke ks, KeyEvent event, Object sender, int modifiers)(Code) | | Invokes actionPerformed on action if
action is enabled (and non-
null ). The command for the
ActionEvent is determined by:
- If the action was registered via
registerKeyboardAction , then the command string
passed in (
null will be used if
null was passed in).
- Action value with name Action.ACTION_COMMAND_KEY, unless
null .
- String value of the KeyEvent, unless
getKeyChar
returns KeyEvent.CHAR_UNDEFINED..
This will return true if action is non-
null and
actionPerformed is invoked on it.
since: 1.3 |
paintComponent | public static void paintComponent(Graphics g, Component c, Container p, int x, int y, int w, int h)(Code) | | Paints a component to the specified Graphics .
This method is primarily useful to render
Component s that don't exist as part of the visible
containment hierarchy, but are used for rendering. For
example, if you are doing your own rendering and want to render
some text (or even HTML), you could make use of
JLabel 's text rendering support and have it paint
directly by way of this method, without adding the label to the
visible containment hierarchy.
This method makes use of CellRendererPane to handle
the actual painting, and is only recommended if you use one
component for rendering. If you make use of multiple components
to handle the rendering, as JTable does, use
CellRendererPane directly. Otherwise, as described
below, you could end up with a CellRendererPane
per Component .
If c 's parent is not a CellRendererPane ,
a new CellRendererPane is created, c is
added to it, and the CellRendererPane is added to
p . If c 's parent is a
CellRendererPane and the CellRendererPane s
parent is not p , it is added to p .
The component should either descend from JComponent
or be another kind of lightweight component.
A lightweight component is one whose "lightweight" property
(returned by the Component
isLightweight method)
is true. If the Component is not lightweight, bad things map happen:
crashes, exceptions, painting problems...
Parameters: g - the Graphics object to draw on Parameters: c - the Component to draw Parameters: p - the intermediate Container Parameters: x - an int specifying the left side of the area draw in, in pixels,measured from the left edge of the graphics context Parameters: y - an int specifying the top of the area to draw in, in pixelsmeasured down from the top edge of the graphics context Parameters: w - an int specifying the width of the area draw in, in pixels Parameters: h - an int specifying the height of the area draw in, in pixels See Also: CellRendererPane See Also: java.awt.Component.isLightweight |
paintComponent | public static void paintComponent(Graphics g, Component c, Container p, Rectangle r)(Code) | | Paints a component to the specified Graphics . This
is a cover method for
SwingUtilities.paintComponent(Graphics,Component,Container,int,int,int,int) .
Refer to it for more information.
Parameters: g - the Graphics object to draw on Parameters: c - the Component to draw Parameters: p - the intermediate Container Parameters: r - the Rectangle to draw in See Also: SwingUtilities.paintComponent(Graphics,Component,Container,int,int,int,int) See Also: CellRendererPane |
processKeyBindings | public static boolean processKeyBindings(KeyEvent event)(Code) | | Process the key bindings for the Component associated with
event . This method is only useful if
event.getComponent() does not descend from
JComponent , or your are not invoking
super.processKeyEvent from within your
JComponent subclass. JComponent
automatically processes bindings from within its
processKeyEvent method, hence you rarely need
to directly invoke this method.
Parameters: event - KeyEvent used to identify which bindings to process, aswell as which Component has focus. true if a binding has found and processed since: 1.4 |
replaceUIActionMap | public static void replaceUIActionMap(JComponent component, ActionMap uiActionMap)(Code) | | Convenience method to change the UI ActionMap for component
to uiActionMap . If uiActionMap is
null ,
this removes any previously installed UI ActionMap.
since: 1.3 |
replaceUIInputMap | public static void replaceUIInputMap(JComponent component, int type, InputMap uiInputMap)(Code) | | Convenience method to change the UI InputMap for component
to uiInputMap . If uiInputMap is
null ,
this removes any previously installed UI InputMap.
since: 1.3 |
updateComponentTreeUI | public static void updateComponentTreeUI(Component c)(Code) | | 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.
|
updateRendererOrEditorUI | static void updateRendererOrEditorUI(Object rendererOrEditor)(Code) | | |
windowForComponent | public static Window windowForComponent(Component c)(Code) | | Returns the first Window ancestor of c , or
null if c is not contained inside a Window .
Note: This method provides the same functionality as
getWindowAncestor .
Parameters: c - Component to get Window ancestorof. the first Window ancestor of c , or null if c is not contained inside aWindow . |
|
|