Class GraphicUtils
java.lang.Object
org.jivesoftware.openfire.launcher.GraphicUtils
GraphicsUtils class defines common user-interface related utility
functions.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Componentstatic final Colorstatic final Colorprotected static final MediaTracker -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcenterWindowOnComponent(Window window, Component over) Centers the window over a component (usually another window).static voidcenterWindowOnScreen(Window window) Sets the location of the specified window so that it is centered on screen.static ImageIconcreateImageIcon(Image image) static final StringcreateToolTip(String text) static final StringcreateToolTip(String text, int width) static voiddrawHighlightBorder(Graphics g, int x, int y, int width, int height, boolean raised, Color shadow, Color highlight) Draws a single-line highlight border rectangle.static ComponentPuts the focus on the first component in the tree ofcthat can accept the focus.static ComponentfocusComponentOrChild(Component c, boolean deepest) Puts the focus on the first component in the tree ofcthat can accept the focus.static ComponentgetFocusableComponentOrChild(Component c, boolean deepest) Returns the first component in the tree ofcthat can accept the focus.static InsetsReturn the amount of space taken up by a highlight border drawn bydrawHighlightBorder().static PointgetPopupMenuShowPoint(JPopupMenu popup, int x, int y) Returns a point where the given popup menu should be shown.static PointgetPopupMenuShowPoint(JPopupMenu popup, MouseEvent event) Returns a point where the given popup menu should be shown.static Rectangle[]static booleanstatic ImageloadFromResource(String imageName, Class cls) static final voidmakeSameSize(JComponent[] comps) static final StringtoHTMLColor(Color c) Return the hexadecimal color from a java.awt.Color
-
Field Details
-
SELECTION_COLOR
-
TOOLTIP_COLOR
-
component
-
tracker
-
-
Method Details
-
centerWindowOnScreen
Sets the location of the specified window so that it is centered on screen.- Parameters:
window- The window to be centered.
-
drawHighlightBorder
public static void drawHighlightBorder(Graphics g, int x, int y, int width, int height, boolean raised, Color shadow, Color highlight) Draws a single-line highlight border rectangle.- Parameters:
g- The graphics context to use for drawing.x- The left edge of the border.y- The top edge of the border.width- The width of the border.height- The height of the border.raised-trueif the border is to be drawn raised,falseif lowered.shadow- The shadow color for the border.highlight- The highlight color for the border.- See Also:
-
getHighlightBorderInsets
Return the amount of space taken up by a highlight border drawn bydrawHighlightBorder().- Returns:
- The
Insetsneeded for the highlight border. - See Also:
-
createImageIcon
-
getPopupMenuShowPoint
Returns a point where the given popup menu should be shown. The point is calculated by adjusting the X and Y coordinates from the given mouse event so that the popup menu will not be clipped by the screen boundaries.- Parameters:
popup- the popup menuevent- the mouse event- Returns:
- the point where the popup menu should be shown
-
getPopupMenuShowPoint
Returns a point where the given popup menu should be shown. The point is calculated by adjusting the X and Y coordinates so that the popup menu will not be clipped by the screen boundaries.- Parameters:
popup- the popup menux- the x position in screen coordinatey- the y position in screen coordinates- Returns:
- the point where the popup menu should be shown in screen coordinates
-
centerWindowOnComponent
Centers the window over a component (usually another window). The window must already have been sized.- Parameters:
window- the window to centerover- the component over which to center it
-
isAncestorOfFocusedComponent
- Parameters:
c- the component- Returns:
- returns true if the component of one of its child has the focus
-
getFocusableComponentOrChild
Returns the first component in the tree ofcthat can accept the focus.- Parameters:
c- the root of the component hierarchy to searchdeepest- ifdeepestis true the method will return the first and deepest component that can accept the focus. For example, if both a child and its parent are focusable anddeepestis true, the child is returned.- Returns:
- the first component that can accept focus
- See Also:
-
focusComponentOrChild
Puts the focus on the first component in the tree ofcthat can accept the focus.- Parameters:
c- the component- Returns:
- the first component that can accept focus
- See Also:
-
focusComponentOrChild
Puts the focus on the first component in the tree ofcthat can accept the focus.- Parameters:
c- the root of the component hierarchy to searchdeepest- ifdeepestis true the method will focus the first and deepest component that can accept the focus. For example, if both a child and its parent are focusable anddeepestis true, the child is focused.- Returns:
- the component which has focus
- See Also:
-
loadFromResource
Loads anImagenamedimageNameas a resource relative to the Classcls. If theImagecan not be loaded, thennullis returned. Images loaded here will be added to an internal cache based upon the fullURLto their location.This method replaces legacy code from JDeveloper 3.x and earlier.
- Parameters:
imageName- the name of the imagecls- the class relative to the which the image resource should be obtained- Returns:
- the image
- See Also:
-
getScreenBounds
-
makeSameSize
-
toHTMLColor
Return the hexadecimal color from a java.awt.Color- Parameters:
c- the colour- Returns:
- hexadecimal string
-
createToolTip
-
createToolTip
-