|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jidesoft.swing.JideSwingUtilities
public class JideSwingUtilities
A utilities class for Swing.
Nested Class Summary | |
---|---|
static interface |
JideSwingUtilities.ConditionHandler
A simple handler used by setRecursively. |
static interface |
JideSwingUtilities.GetHandler
A simple handler used by getRecursively. |
static interface |
JideSwingUtilities.Handler
A simple handler used by setRecursively. |
static class |
JideSwingUtilities.TraceDebugBorder
|
Field Summary | |
---|---|
static Object |
AA_TEXT_PROPERTY_KEY
Key used in client properties to indicate whether or not the component should use aa text. |
static String |
SET_OPAQUE_RECURSIVELY_EXCLUDED
setOpaqueRecursively method will make all child components opaque true or false. |
protected static boolean |
tracingFocus
|
Fields inherited from interface javax.swing.SwingConstants |
---|
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
Constructor Summary | |
---|---|
JideSwingUtilities()
|
Method Summary | |
---|---|
static void |
addSeparatorIfNecessary(JPopupMenu popup)
Adds a separator to the popup menu if there are menu items on it already. |
static Dimension |
adjustPreferredScrollableViewportSize(JList list,
Dimension defaultViewportSize)
This method can be used to fix two JDK bugs. |
static int |
binarySearch(int[] a,
int key)
Perform a binary search over a sorted array for the given key. |
static int |
binarySearch(int[] a,
int key,
int start,
int end)
Perform a binary search over a sorted array for the given key. |
static int |
binarySearch(List<Object> a,
Object key)
Perform a binary search over a sorted list for the given key. |
static int |
binarySearch(Object[] a,
Object key)
Perform a binary search over a sorted array for the given key. |
static void |
centerWindow(Window childToCenter)
Center the component to it's parent window. |
static boolean |
charsEqualIgnoreCase(char a,
char b)
|
static void |
clearGradientCache()
Clears the gradient cache used for fast gradient painting |
static boolean |
componentIsPermanentFocusOwner(Component comp)
|
static boolean |
compositeRequestFocus(Component component)
Copied from BasicLookAndFeel as the method is package local. |
static boolean |
containerContainsFocus(Container cont)
containerContainsFocus, does the specified container contain the current focusOwner? |
static Vector |
convertDefaultComboBoxModelToVector(DefaultComboBoxModel model)
|
static JPanel |
createBottomPanel(Component object)
Create a Panel around a component so that component aligns to bottom. |
static JPanel |
createCenterPanel(Component object)
Create a Panel around a component so that component is right in the middle. |
static JPanel |
createLabeledComponent(JLabel title,
Component component,
Object constraint)
Creates a container which a label for the component. |
static JPanel |
createLeftPanel(Component object)
Create a Panel around a component so that component aligns to left. |
static JPanel |
createRightPanel(Component object)
Create a Panel around a component so that component aligns to right. |
static JPanel |
createTableModelModifier(DefaultTableModel tableModel)
For internal usage only. |
static JPanel |
createTopPanel(Component object)
Create a Panel around a component so that component aligns to top. |
static Map<Component,Boolean> |
disableDoubleBuffered(Component c)
Disables the double buffered flag of the component and its children. |
static void |
drawGrip(Graphics g,
Rectangle rectangle,
int maxLength,
int maxThickness)
|
static void |
drawGrip(Graphics g,
Rectangle rectangle,
int maxLength,
int maxThickness,
boolean isSelected)
|
static void |
drawImageBorder(Graphics g,
ImageIcon img,
Rectangle rect,
Insets ins,
boolean drawCenter)
Draws a border based on an image. |
static void |
drawShadow(Graphics g,
Component c,
int x,
int y,
int w,
int h)
|
static void |
drawString(JComponent c,
Graphics g,
String text,
int x,
int y)
|
static void |
drawStringUnderlineCharAt(JComponent c,
Graphics g,
String text,
int underlinedIndex,
int x,
int y)
|
static boolean |
drawTextAntialiased(boolean aaText)
Returns whether or not text should be drawn anti-aliased. |
static Map<Component,Boolean> |
enableDoubleBuffered(Component c)
Enables the double buffered flag of the component and its children. |
static void |
ensureRowVisible(JTable table,
int row)
To make sure the row is visible. |
static boolean |
equals(CharSequence s1,
CharSequence s2,
boolean caseSensitive)
|
static boolean |
equals(Object o1,
Object o2)
Checks if the two objects equal. |
static boolean |
equals(Object o1,
Object o2,
boolean considerArrayOrList)
Checks if the two objects equal. |
static void |
fillGradient(Graphics2D g2d,
Shape s,
Color startColor,
Color endColor,
boolean isVertical)
Fills a gradient using the startColor and endColor specified. |
static void |
fillGradient(Graphics g,
Rectangle rect,
int orientation)
|
static void |
fillNormalGradient(Graphics2D g2d,
Shape s,
Color startColor,
Color endColor,
boolean isVertical)
|
static void |
fillSingleGradient(Graphics g,
Rectangle rect,
int orientation)
|
static void |
fillSingleGradient(Graphics g,
Rectangle rect,
int orientation,
int level)
|
static int |
findDisplayedMnemonicIndex(String text,
int mnemonic)
|
static Component |
findFirstComponentByClass(Container c,
Class<?> clazz)
Gets the first component inside the specified container that has the specified class. |
static Component |
findFirstComponentByName(Container c,
String name)
Gets the first component inside the specified container that has the specified name. |
static Component |
findSomethingFocusable(Container container)
Find some subcomponent of the specified container that will accept focus. |
static Object |
getBoldFont(Toolkit toolkit,
UIDefaults table)
|
static int |
getButtonState(AbstractButton b)
|
static int[] |
getButtonState(JideSplitButton b)
|
static String |
getCancelString(Locale locale)
Gets the string representing Cancel button. |
static int |
getComponentIndex(Container container,
Component c)
Get the index of the component in the container. |
static Object |
getControlFont(Toolkit toolkit,
UIDefaults table)
|
static float |
getDefaultFontSize()
|
static Component |
getDescendantOfClass(Class c,
Container container)
Gets the first occurrence of the component with specified type in the container. |
static BufferedImage |
getFasterScaledInstance(BufferedImage img,
int targetWidth,
int targetHeight,
Object hint,
boolean progressiveBilinear)
Convenience method that returns a scaled instance of the provided BufferedImage. |
static Component |
getFirstChildOf(Class<?> clazz,
Component c)
Gets the first child of the component that is the specified type. |
static JComponent |
getFirstJComponent(RootPaneContainer rootPaneContainer)
Gets the first JComponent from the RootPaneContainer. |
static int |
getFocusAcceleratorKeyMask()
|
static Frame |
getFrame(Component component)
Gets the top level Frame of the component. |
static Paint |
getLinearGradientPaint(float startX,
float startY,
float endX,
float endY,
float[] fractions,
Color[] colors)
Gets the LinearGradientPaint. |
static int |
getLineHeight(Component c,
int defaultHeight)
Gets the line height for the font for the component |
static Object |
getMenuFont(Toolkit toolkit,
UIDefaults table)
|
static String |
getNoString(Locale locale)
Gets the string representing No button. |
static String |
getOKString(Locale locale)
Gets the string representing OK button. |
static int |
getOrientationOf(Component component)
|
static JRootPane |
getOutermostRootPane(Component c)
If c is a JRootPane descendant return its outermost JRootPane ancestor. |
static Dimension |
getPreferredButtonSize(AbstractButton b,
int textIconGap,
boolean isHorizontal)
|
static Paint |
getRadialGradientPaint(float cx,
float cy,
float radius,
float[] fractions,
Color[] colors)
Gets the RadialGradientPaint. |
static Paint |
getRadialGradientPaint(Point2D point,
float radius,
float[] fractions,
Color[] colors)
Gets the RadialGradientPaint. |
static Component |
getRecursively(Component c,
JideSwingUtilities.GetHandler handler)
Gets to a child of a component recursively based on certain condition. |
static Component |
getScrollPane(Component innerComponent)
Gets the scroll pane around the component. |
static Window |
getTopModalDialog(Window w)
Gets the top modal dialog of current window. |
static ChangeListener |
getViewportSynchronizationChangeListener()
|
static Window |
getWindowForComponent(Component parentComponent)
Gets the top level Window of the component. |
static String |
getYesString(Locale locale)
Gets the string representing Yes button. |
static void |
globalCenterWindow(Window childToCenter)
Center the window to the whole screen. |
static void |
ignoreException(Exception e)
Ignore the exception. |
static void |
insertKeyListener(Component component,
KeyListener l,
int index)
Inserts the key listener at the particular index in the listeners' chain. |
static void |
insertMouseListener(Component component,
MouseListener l,
int index)
Inserts the mouse listener at the particular index in the listeners' chain. |
static void |
insertMouseMotionListener(Component component,
MouseMotionListener l,
int index)
Inserts the mouse motion listener at the particular index in the listeners' chain. |
static void |
insertTableModelListener(TableModel model,
TableModelListener l,
int index)
Inserts the table model listener at the particular index in the listeners' chain. |
static void |
installBorder(JComponent c,
Border defaultBorder)
|
static void |
installColors(Component c,
Color background,
Color foreground)
|
static void |
installColorsAndFont(Component c,
Color background,
Color foreground,
Font font)
|
static void |
installFont(Component c,
Font font)
|
static void |
invalidateRecursively(Component c)
Invalidate and doLayout on the component and all its child components if any. |
static boolean |
isAncestorOfFocusOwner(Component component)
|
static boolean |
isFixedWidthFont(String fontName,
Component component)
Checks if the font specified by the font name is fixed width font. |
static boolean |
isKeyListenerRegistered(Component component,
KeyListener l)
Checks if the key listener is already registered on the component. |
static boolean |
isListenerRegistered(Component component,
Class t,
EventListener l)
Checks if the listener is always registered to the Component to avoid duplicated registration of the same listener |
static boolean |
isListenerRegistered(EventListenerList list,
Class t,
EventListener l)
Checks if the listener is always registered to the EventListenerList to avoid duplicated registration of the same listener |
static boolean |
isMenuShortcutKeyDown(ActionEvent event)
Checks if the ctrl key is pressed. |
static boolean |
isMenuShortcutKeyDown(InputEvent event)
Checks if the ctrl key is pressed. |
static boolean |
isMouseListenerRegistered(Component component,
MouseListener l)
Checks if the mouse listener is already registered on the component. |
static boolean |
isMouseMotionListenerRegistered(Component component,
MouseMotionListener l)
Checks if the mouse motion listener is already registered on the component. |
static boolean |
isPropertyChangeListenerRegistered(Component component,
PropertyChangeListener l)
Checks if the property change listener is already registered on the component. |
static boolean |
isPropertyChangeListenerRegistered(Component component,
String propertyName,
PropertyChangeListener l)
Checks if the property change listener is already registered on the component. |
static String |
layoutCompoundLabel(FontMetrics fm,
String text,
Icon icon,
boolean isHorizontal,
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 String |
layoutCompoundLabel(JComponent c,
FontMetrics fm,
String text,
Icon icon,
boolean isHorizontal,
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 void |
paintArrow(Graphics g,
Color color,
int startX,
int startY,
int width,
int orientation)
Paints an arrow shape. |
static void |
paintArrow(JComponent c,
Graphics g,
Color color,
int startX,
int startY,
int width,
int orientation)
Paints an arrow shape. |
static void |
paintBackground(Graphics2D g2d,
Rectangle rect,
Color border,
Paint paint)
|
static void |
paintBackground(Graphics g,
Rectangle rect,
Color border,
Color bk)
|
static void |
paintCross(Graphics g,
Color color,
int centerX,
int centerY,
int size,
int width)
Paints a cross shape. |
static boolean |
passesFocusabilityTest(Component comp)
There are four standard tests which determine if Swing will be able to request focus for a component. |
static void |
printException(Exception e)
Prints out the message of the exception. |
static void |
printUIDefaults()
|
static void |
putClientPropertyRecursively(Component c,
String clientProperty,
Object value)
Calls putClientProperty method recursively on component and its child components as long as it is JComponent. |
static void |
registerTabKey(Container container)
Register the tab key with the container. |
static void |
removeExtraSeparators(JPopupMenu popup)
Removes extra separators, if any. |
static void |
removeFromParentWithFocusTransfer(Component component)
The semantics in AWT of hiding a component, removing a component, and reparenting a component are inconsistent with respect to focus. |
static void |
restoreAntialiasing(Component c,
Graphics g,
Object oldHints)
Restores the old setting for text anti-alias. |
static void |
restoreDoubleBuffered(Component c,
Map<Component,Boolean> map)
Restores the double buffered flag of the component and its children. |
static void |
restoreShapeAntialiasing(Graphics g,
Object oldHints)
Restores the old setting for shape anti-alias. |
static void |
retargetMouseEvent(int id,
MouseEvent e,
Component target)
|
static void |
runGCAndPrintFreeMemory()
|
static void |
setBounds(Container container,
Component component,
int x,
int y,
int width,
int height)
Sets the bounds. |
static void |
setBounds(Container container,
Component component,
Rectangle bounds)
Sets the bounds. |
static void |
setChildrenOrientationOf(Container c,
int orientation)
|
static void |
setComponentTransparent(JComponent component)
Sets the text component transparent. |
static void |
setEnabledRecursively(Component c,
boolean enabled)
Calls setEnabled method recursively on component. |
static void |
setLocaleRecursively(Component c,
Locale locale)
Sets the locale recursively on the component and all its child components if any. |
static void |
setOpaqueRecursively(Component c,
boolean opaque)
Calls setOpaque method recursively on each component except for JButton, JComboBox and JTextComponent. |
static void |
setOrientationOf(Component component,
int orientation)
|
static void |
setRecursively(Component c,
JideSwingUtilities.Handler handler)
Calls the handler recursively on a component. |
static void |
setRequestFocusEnabledRecursively(Component c,
boolean enabled)
Calls setRequestFocusEnabled method recursively on component. |
static void |
setTextComponentTransparent(JComponent component)
Deprecated. replaced by setComponentTransparent(javax.swing.JComponent) . |
static Object |
setupAntialiasing(Component c,
Graphics g)
Setups the graphics to draw text using anti-alias. |
static Object |
setupShapeAntialiasing(Graphics g)
Setups the graphics to draw shape using anti-alias. |
static void |
setWindowOpacity(Window window,
float opacity)
Sets the Window opacity using AWTUtilities.setWindowOpacity on JDK6u10 and later. |
static void |
setWindowOpaque(Window window,
boolean opaque)
Sets the Window opaque using AWTUtilities.setWindowOpaque on JDK6u10 and later. |
static void |
setWindowShape(Window window,
Shape shape)
Sets the Window shape using AWTUtilities.setWindowOpacity on JDK6u10 and later. |
static boolean |
shouldUseSystemFont()
In JDK1.4, it uses a wrong font for Swing component in Windows L&F which is actually one big reason for people to think Swing application ugly. |
static void |
synchronizeKeyboardActions(JComponent sourceComponent,
JComponent targetComponent,
KeyStroke[] keyStrokes,
int condition)
Registers all actions registered on the source component and registered them on the target component at the specified condition. |
static void |
synchronizeView(JViewport masterViewport,
JViewport slaveViewport,
int orientation)
Synchronizes the two viewports. |
static void |
throwException(Exception e)
Throws the exception. |
static void |
throwInvocationTargetException(InvocationTargetException e)
Throws the InvocationTargetException. |
static void |
toggleRTLnLTR(Component topContainer)
Toggles between RTL and LTR. |
static char |
toLowerCase(char a)
|
static char |
toUpperCase(char a)
|
static void |
traceFocus()
For internal usage only. |
static void |
traceFocus(boolean useBorders)
For internal usage only. |
static void |
unsynchronizeView(JViewport masterViewport,
JViewport slaveViewport)
Un-synchronizes the two viewport. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final Object AA_TEXT_PROPERTY_KEY
public static final String SET_OPAQUE_RECURSIVELY_EXCLUDED
protected static boolean tracingFocus
Constructor Detail |
---|
public JideSwingUtilities()
Method Detail |
---|
public static JPanel createLeftPanel(Component object)
object
- the component
public static JPanel createRightPanel(Component object)
object
- the component
public static JPanel createTopPanel(Component object)
object
- the component
public static JPanel createBottomPanel(Component object)
object
- the component
public static JPanel createCenterPanel(Component object)
object
- the component
public static JPanel createLabeledComponent(JLabel title, Component component, Object constraint)
title
- the labelcomponent
- the componentconstraint
- the constraint as in BorderLayout. You can use all the constraints as in BorderLayout except
CENTER.
public static void centerWindow(Window childToCenter)
childToCenter
- the parent windowpublic static void globalCenterWindow(Window childToCenter)
childToCenter
- the parent windowpublic static void paintArrow(Graphics g, Color color, int startX, int startY, int width, int orientation)
g
- the graphics instancecolor
- colorstartX
- start XstartY
- start Ywidth
- widthorientation
- horizontal or verticalpublic static void paintArrow(JComponent c, Graphics g, Color color, int startX, int startY, int width, int orientation)
c
- the componentg
- the graphics instancecolor
- colorstartX
- start XstartY
- start Ywidth
- widthorientation
- horizontal or verticalpublic static void paintCross(Graphics g, Color color, int centerX, int centerY, int size, int width)
g
- the graphics instancecolor
- colorcenterX
- center XcenterY
- center Ysize
- sizewidth
- widthpublic static Frame getFrame(Component component)
component
- the component
public static void toggleRTLnLTR(Component topContainer)
topContainer
- the componentpublic static void synchronizeView(JViewport masterViewport, JViewport slaveViewport, int orientation)
masterViewport
- the master viewportslaveViewport
- the slave viewportorientation
- the orientation. It could be either SwingConstants.HORIZONTAL or SwingConstants.VERTICAL.public static void unsynchronizeView(JViewport masterViewport, JViewport slaveViewport)
masterViewport
- the master viewportslaveViewport
- the slave viewportpublic static int getButtonState(AbstractButton b)
public static int[] getButtonState(JideSplitButton b)
public static boolean equals(Object o1, Object o2)
o1.equals(o2)
to compare. If none of
the above conditions match, we return false.
o1
- the first object to compareo2
- the second object to compare
public static boolean equals(Object o1, Object o2, boolean considerArrayOrList)
o1.equals(o2)
to compare. If none of the above conditions match, we return false.
o1
- the first object to compareo2
- the second object to compareconsiderArrayOrList
- If true, and if o1 and o2 are both array, we will compare each element in the array
instead of just compare the two array objects.
public static boolean equals(CharSequence s1, CharSequence s2, boolean caseSensitive)
public static boolean charsEqualIgnoreCase(char a, char b)
public static char toUpperCase(char a)
public static char toLowerCase(char a)
public static BufferedImage getFasterScaledInstance(BufferedImage img, int targetWidth, int targetHeight, Object hint, boolean progressiveBilinear)
img
- the original image to be scaledtargetWidth
- the desired width of the scaled instance, in pixelstargetHeight
- the desired height of the scaled instance, in pixelshint
- one of the rendering hints that corresponds to RenderingHints.KEY_INTERPOLATION (e.g.
RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR, RenderingHints.VALUE_INTERPOLATION_BILINEAR,
RenderingHints.VALUE_INTERPOLATION_BICUBIC)progressiveBilinear
- if true, this method will use a multi-step scaling technique that provides higher
quality than the usual one-step technique (only useful in down-scaling cases, where
targetWidth or targetHeight is smaller than the original dimensions)
public static int getFocusAcceleratorKeyMask()
public static boolean shouldUseSystemFont()
SystemInfo.isCJKLocale()
, we shouldn't use Tahoma. If you are on JDK 1.5
and above, you shouldn't force to use Tahoma either because JDK fixed it in 1.5 and above.
There are also a few system properties you can set to control if system font should be used.
"swing.useSystemFontSettings" is the one for all Swing applications. "Application.useSystemFontSettings" is the
one for a particular Swing application.
This method considers all the cases above. If JDK is 1.5 and above, this method will return true. If you are on
Chinese, Japanese or Korean locale, it will return true. If "swing.useSystemFontSettings" property us true, it
will return true. If "Application.useSystemFontSettings" property is true, it will return true. Otherwise, it
will return false. All JIDE L&F considered the returned value and decide if Tahoma font should be used or not.
Last but the least, we also add system property "jide.useSystemfont" which has the highest priority. If you set
it to "true" or "false", this method will just check that value and return true or false respectively without
looking at any other settings.
public static void printUIDefaults()
public static void setRecursively(Component c, JideSwingUtilities.Handler handler)
c
- componenthandler
- handler to be calledpublic static Component findFirstComponentByName(Container c, String name)
c
- the containername
- the name of the component
public static Component findFirstComponentByClass(Container c, Class<?> clazz)
c
- the containerclazz
- the class of the component
public static Component getRecursively(Component c, JideSwingUtilities.GetHandler handler)
c
- componenthandler
- handler to be called
public static void setEnabledRecursively(Component c, boolean enabled)
Component
c is usually a Container
c
- componentenabled
- true if enable; false otherwisepublic static void putClientPropertyRecursively(Component c, String clientProperty, Object value)
c
- componentclientProperty
- the client property namevalue
- the value for the client propertypublic static void setRequestFocusEnabledRecursively(Component c, boolean enabled)
Component
c is usually a
Container
c
- componentenabled
- true if setRequestFocusEnabled to true; false otherwisepublic static void setOpaqueRecursively(Component c, boolean opaque)
Component
c is usually a Container
. If you would like certain child component not
affected by this call, you can call jcomponent.putClientProperty(SET_OPAQUE_RECURSIVELY_EXCLUDED, Boolean.TRUE)
before calling this method.
c
- componentopaque
- true if setOpaque to true; false otherwisepublic static Dimension getPreferredButtonSize(AbstractButton b, int textIconGap, boolean isHorizontal)
public static String layoutCompoundLabel(JComponent c, FontMetrics fm, String text, Icon icon, boolean isHorizontal, int verticalAlignment, int horizontalAlignment, int verticalTextPosition, int horizontalTextPosition, Rectangle viewR, Rectangle iconR, Rectangle textR, int textIconGap)
c
- the componentfm
- the font metricstext
- the texticon
- the iconisHorizontal
- the flag indicating horizontal or verticalverticalAlignment
- vertical alignment modelhorizontalAlignment
- horizontal alignment modelverticalTextPosition
- vertical text positionhorizontalTextPosition
- horizontal text positionviewR
- view rectangleiconR
- icon rectangletextR
- text rectangletextIconGap
- the gap between the text and the gap
public static String layoutCompoundLabel(FontMetrics fm, String text, Icon icon, boolean isHorizontal, int verticalAlignment, int horizontalAlignment, int verticalTextPosition, int horizontalTextPosition, Rectangle viewR, Rectangle iconR, Rectangle textR, int textIconGap)
fm
- the font metricstext
- the text to layouticon
- the icon to layoutisHorizontal
- if the layout is horizontalverticalAlignment
- the vertical alignmenthorizontalAlignment
- the horizontal alignmentverticalTextPosition
- the vertical text positionhorizontalTextPosition
- the horizontal text positionviewR
- the view rectangleiconR
- the icon rectangletextR
- the text rectangletextIconGap
- the gap between the text and the icon
public static int getOrientationOf(Component component)
public static void setOrientationOf(Component component, int orientation)
public static void setChildrenOrientationOf(Container c, int orientation)
public static Map<Component,Boolean> disableDoubleBuffered(Component c)
restoreDoubleBuffered(java.awt.Component, java.util.Map)
using the map that is returned from this method.
c
- the parent container.
public static Map<Component,Boolean> enableDoubleBuffered(Component c)
restoreDoubleBuffered(java.awt.Component, java.util.Map)
using the map that is returned from this method.
c
- the parent container.
public static void restoreDoubleBuffered(Component c, Map<Component,Boolean> map)
c
- the parent container.map
- a map maps from component to a boolean. If the boolean is true, it means the component was double
buffered bore. Otherwise, not double buffered.public static void paintBackground(Graphics g, Rectangle rect, Color border, Color bk)
public static void paintBackground(Graphics2D g2d, Rectangle rect, Color border, Paint paint)
public static boolean drawTextAntialiased(boolean aaText)
aaText
- Whether or not aa text has been turned on for the component.
public static void drawStringUnderlineCharAt(JComponent c, Graphics g, String text, int underlinedIndex, int x, int y)
public static void drawString(JComponent c, Graphics g, String text, int x, int y)
public static Object setupAntialiasing(Component c, Graphics g)
c
- the componentg
- the Graphics instance
restoreAntialiasing(java.awt.Component, java.awt.Graphics, Object)
.public static void restoreAntialiasing(Component c, Graphics g, Object oldHints)
c
- g
- oldHints
- the value returned from setupAntialiasing(java.awt.Component, java.awt.Graphics)
.public static Object setupShapeAntialiasing(Graphics g)
g
-
restoreShapeAntialiasing(java.awt.Graphics, Object)
.public static void restoreShapeAntialiasing(Graphics g, Object oldHints)
g
- oldHints
- the value returned from setupShapeAntialiasing(java.awt.Graphics)
.public static void drawGrip(Graphics g, Rectangle rectangle, int maxLength, int maxThickness)
public static void drawGrip(Graphics g, Rectangle rectangle, int maxLength, int maxThickness, boolean isSelected)
public static void registerTabKey(Container container)
container
- public static void fillGradient(Graphics g, Rectangle rect, int orientation)
public static void fillSingleGradient(Graphics g, Rectangle rect, int orientation)
public static void fillSingleGradient(Graphics g, Rectangle rect, int orientation, int level)
public static Paint getRadialGradientPaint(Point2D point, float radius, float[] fractions, Color[] colors)
public static Paint getRadialGradientPaint(float cx, float cy, float radius, float[] fractions, Color[] colors)
public static Paint getLinearGradientPaint(float startX, float startY, float endX, float endY, float[] fractions, Color[] colors)
public static boolean containerContainsFocus(Container cont)
cont
- the specified container
public static boolean componentIsPermanentFocusOwner(Component comp)
public static void installColorsAndFont(Component c, Color background, Color foreground, Font font)
public static void installFont(Component c, Font font)
public static void installColors(Component c, Color background, Color foreground)
public static void installBorder(JComponent c, Border defaultBorder)
public static void fillNormalGradient(Graphics2D g2d, Shape s, Color startColor, Color endColor, boolean isVertical)
public static void fillGradient(Graphics2D g2d, Shape s, Color startColor, Color endColor, boolean isVertical)
g2d
- s
- startColor
- endColor
- isVertical
- public static void clearGradientCache()
public static Window getTopModalDialog(Window w)
w
-
public static void traceFocus()
public static void traceFocus(boolean useBorders)
public static void runGCAndPrintFreeMemory()
public static JPanel createTableModelModifier(DefaultTableModel tableModel)
public static Component findSomethingFocusable(Container container)
container
-
public static boolean passesFocusabilityTest(Component comp)
comp
-
public static void ignoreException(Exception e)
e
- public static void printException(Exception e)
e
- public static void throwException(Exception e)
e
- public static void throwInvocationTargetException(InvocationTargetException e)
e
- public static int findDisplayedMnemonicIndex(String text, int mnemonic)
public static Component getDescendantOfClass(Class c, Container container)
c
- container
-
public static float getDefaultFontSize()
public static Object getMenuFont(Toolkit toolkit, UIDefaults table)
public static Object getControlFont(Toolkit toolkit, UIDefaults table)
public static Object getBoldFont(Toolkit toolkit, UIDefaults table)
public static void drawShadow(Graphics g, Component c, int x, int y, int w, int h)
public static void drawImageBorder(Graphics g, ImageIcon img, Rectangle rect, Insets ins, boolean drawCenter)
public static boolean compositeRequestFocus(Component component)
component
-
public static boolean isAncestorOfFocusOwner(Component component)
public static Window getWindowForComponent(Component parentComponent) throws HeadlessException
parentComponent
-
HeadlessException
public static boolean isKeyListenerRegistered(Component component, KeyListener l)
component
- the componentl
- the listener
public static void insertKeyListener(Component component, KeyListener l, int index)
component
- l
- index
- public static void insertTableModelListener(TableModel model, TableModelListener l, int index)
model
- the AbstractTableModell
- the TableModelListener to be insertedindex
- the index.public static boolean isPropertyChangeListenerRegistered(Component component, PropertyChangeListener l)
component
- the componentl
- the listener
public static boolean isPropertyChangeListenerRegistered(Component component, String propertyName, PropertyChangeListener l)
component
- the componentpropertyName
- the property namel
- the listener
public static boolean isMouseListenerRegistered(Component component, MouseListener l)
component
- the componentl
- the listener
public static void insertMouseListener(Component component, MouseListener l, int index)
component
- l
- index
- public static boolean isMouseMotionListenerRegistered(Component component, MouseMotionListener l)
component
- the componentl
- the listener
public static void insertMouseMotionListener(Component component, MouseMotionListener l, int index)
component
- l
- index
- public static Component getScrollPane(Component innerComponent)
innerComponent
-
public static boolean isListenerRegistered(EventListenerList list, Class t, EventListener l)
list
- the EventListenerList to register the listener.t
- the type of the EventListener.l
- the listener.
public static boolean isListenerRegistered(Component component, Class t, EventListener l)
component
- the component that you want to register the listener.t
- the type of the EventListener.l
- the listener.
public static Component getFirstChildOf(Class<?> clazz, Component c)
clazz
- the type of the component to look forc
- the component
public static int getComponentIndex(Container container, Component c)
container
- the containerc
- the component
public static Vector convertDefaultComboBoxModelToVector(DefaultComboBoxModel model)
public static void ensureRowVisible(JTable table, int row)
table
- row
- public static void retargetMouseEvent(int id, MouseEvent e, Component target)
public static JRootPane getOutermostRootPane(Component c)
c
- the component.
null
.public static boolean isFixedWidthFont(String fontName, Component component)
fontName
- the font namecomponent
- the component where the font will be displayed.
public static void setLocaleRecursively(Component c, Locale locale)
c
- the componentlocale
- the new locales.public static void setBounds(Container container, Component component, Rectangle bounds)
container
- the container. It is usually the parent of the component.component
- the component to set boundsbounds
- the bounds.public static void setBounds(Container container, Component component, int x, int y, int width, int height)
container
- the container. It is usually the parent of the component.component
- the component to set boundsx
- the x of the boundsy
- the y of the boundswidth
- the the height of the bounds. of the bounds.height
- the height of the bounds.public static void invalidateRecursively(Component c)
c
- the componentpublic static void synchronizeKeyboardActions(JComponent sourceComponent, JComponent targetComponent, KeyStroke[] keyStrokes, int condition)
sourceComponent
- the source component.targetComponent
- the target component.keyStrokes
- the keystrokescondition
- the condition which will be used in JComponent.registerKeyboardAction(java.awt.event.ActionListener,
javax.swing.KeyStroke, int)
as the last parameter.public static JComponent getFirstJComponent(RootPaneContainer rootPaneContainer)
rootPaneContainer
- a rootPaneContainer
public static Dimension adjustPreferredScrollableViewportSize(JList list, Dimension defaultViewportSize)
public Dimension getPreferredScrollableViewportSize() {
return JideSwingUtilities.adjustPreferredScrollableViewportSize(this, super.getPreferredScrollableViewportSize());
}
list
- the JListdefaultViewportSize
- the default viewport size from JList#getPreferredScrollableViewportSize().
public static void removeFromParentWithFocusTransfer(Component component)
component
- public static int getLineHeight(Component c, int defaultHeight)
c
- the componentdefaultHeight
- the default height if the font on the specified component is null
public static void addSeparatorIfNecessary(JPopupMenu popup)
popup
- the popup menu.public static void removeExtraSeparators(JPopupMenu popup)
popup
- the popup menu.@Deprecated public static void setTextComponentTransparent(JComponent component)
setComponentTransparent(javax.swing.JComponent)
.
component
- the text component to be set to transparent.public static void setComponentTransparent(JComponent component)
component
- the text component to be set to transparent.public static int binarySearch(List<Object> a, Object key)
a
- the array to searchkey
- the key to search for
public static int binarySearch(Object[] a, Object key)
a
- the array to searchkey
- the key to search for
public static int binarySearch(int[] a, int key)
a
- the array to searchkey
- the key to search for
public static int binarySearch(int[] a, int key, int start, int end)
a
- the array to searchkey
- the key to search forstart
- the start index to search inclusiveend
- the end index to search exclusive
public static boolean isMenuShortcutKeyDown(InputEvent event)
event
- the InputEvent.
public static boolean isMenuShortcutKeyDown(ActionEvent event)
event
- the InputEvent.
public static ChangeListener getViewportSynchronizationChangeListener()
public static void setWindowOpaque(Window window, boolean opaque)
window
- the Windowopaque
- true or falsepublic static void setWindowOpacity(Window window, float opacity)
window
- the Windowopacity
- the opacitypublic static void setWindowShape(Window window, Shape shape)
window
- the Windowshape
- the shapepublic static String getOKString(Locale locale)
locale
- the locale
public static String getCancelString(Locale locale)
locale
- the locale
public static String getYesString(Locale locale)
locale
- the locale
public static String getNoString(Locale locale)
locale
- the locale
|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |