JIDE 3.5.15

com.jidesoft.swing
Class JideSwingUtilities

java.lang.Object
  extended by com.jidesoft.swing.JideSwingUtilities
All Implemented Interfaces:
SwingConstants

public class JideSwingUtilities
extends Object
implements SwingConstants

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

AA_TEXT_PROPERTY_KEY

public static final Object AA_TEXT_PROPERTY_KEY
Key used in client properties to indicate whether or not the component should use aa text.


SET_OPAQUE_RECURSIVELY_EXCLUDED

public static final String SET_OPAQUE_RECURSIVELY_EXCLUDED
setOpaqueRecursively method will make all child components opaque true or false. But if you call jcomponent.putClientProperty(SET_OPAQUE_RECURSIVELY_EXCLUDED, Boolean.TRUE), we will not touch this particular component when setOpaqueRecursively.

See Also:
Constant Field Values

tracingFocus

protected static boolean tracingFocus
Constructor Detail

JideSwingUtilities

public JideSwingUtilities()
Method Detail

createLeftPanel

public static JPanel createLeftPanel(Component object)
Create a Panel around a component so that component aligns to left.

Parameters:
object - the component
Returns:
a Panel

createRightPanel

public static JPanel createRightPanel(Component object)
Create a Panel around a component so that component aligns to right.

Parameters:
object - the component
Returns:
a Panel

createTopPanel

public static JPanel createTopPanel(Component object)
Create a Panel around a component so that component aligns to top.

Parameters:
object - the component
Returns:
a Panel

createBottomPanel

public static JPanel createBottomPanel(Component object)
Create a Panel around a component so that component aligns to bottom.

Parameters:
object - the component
Returns:
a Panel

createCenterPanel

public static JPanel createCenterPanel(Component object)
Create a Panel around a component so that component is right in the middle.

Parameters:
object - the component
Returns:
a Panel

createLabeledComponent

public static JPanel createLabeledComponent(JLabel title,
                                            Component component,
                                            Object constraint)
Creates a container which a label for the component.

Parameters:
title - the label
component - the component
constraint - the constraint as in BorderLayout. You can use all the constraints as in BorderLayout except CENTER.
Returns:
the container which has both the label and the component.

centerWindow

public static void centerWindow(Window childToCenter)
Center the component to it's parent window.

Parameters:
childToCenter - the parent window

globalCenterWindow

public static void globalCenterWindow(Window childToCenter)
Center the window to the whole screen.

Parameters:
childToCenter - the parent window

paintArrow

public static void paintArrow(Graphics g,
                              Color color,
                              int startX,
                              int startY,
                              int width,
                              int orientation)
Paints an arrow shape.

Parameters:
g - the graphics instance
color - color
startX - start X
startY - start Y
width - width
orientation - horizontal or vertical

paintArrow

public static void paintArrow(JComponent c,
                              Graphics g,
                              Color color,
                              int startX,
                              int startY,
                              int width,
                              int orientation)
Paints an arrow shape.

Parameters:
c - the component
g - the graphics instance
color - color
startX - start X
startY - start Y
width - width
orientation - horizontal or vertical

paintCross

public static void paintCross(Graphics g,
                              Color color,
                              int centerX,
                              int centerY,
                              int size,
                              int width)
Paints a cross shape.

Parameters:
g - the graphics instance
color - color
centerX - center X
centerY - center Y
size - size
width - width

getFrame

public static Frame getFrame(Component component)
Gets the top level Frame of the component.

Parameters:
component - the component
Returns:
the top level Frame. Null if we didn't find an ancestor which is instance of Frame.

toggleRTLnLTR

public static void toggleRTLnLTR(Component topContainer)
Toggles between RTL and LTR.

Parameters:
topContainer - the component

synchronizeView

public static void synchronizeView(JViewport masterViewport,
                                   JViewport slaveViewport,
                                   int orientation)
Synchronizes the two viewports. The view position changes in the master view, the slave view's view position will change too. Generally speaking, if you want the two viewports to synchronize vertically, they should have the same height. If horizontally, the same width.

It's OK if you call this method with the same master viewport and slave viewport duplicate times. It won't cause multiple events fired.

Parameters:
masterViewport - the master viewport
slaveViewport - the slave viewport
orientation - the orientation. It could be either SwingConstants.HORIZONTAL or SwingConstants.VERTICAL.

unsynchronizeView

public static void unsynchronizeView(JViewport masterViewport,
                                     JViewport slaveViewport)
Un-synchronizes the two viewport.

Parameters:
masterViewport - the master viewport
slaveViewport - the slave viewport

getButtonState

public static int getButtonState(AbstractButton b)

getButtonState

public static int[] getButtonState(JideSplitButton b)

equals

public static boolean equals(Object o1,
                             Object o2)
Checks if the two objects equal. If both are null, they are equal. If o1 and o2 both are Comparable, we will use compareTo method to see if it equals 0. At last, we will use o1.equals(o2) to compare. If none of the above conditions match, we return false.

Parameters:
o1 - the first object to compare
o2 - the second object to compare
Returns:
true if the two objects are equal. Otherwise false.

equals

public static boolean equals(Object o1,
                             Object o2,
                             boolean considerArrayOrList)
Checks if the two objects equal. If both are the same instance, they are equal. If both are null, they are equal. If o1 and o2 both are Comparable, we will use compareTo method to see if it equals 0. If considerArrayOrList is true and o1 and o2 are both array, we will compare each element in the array. At last, we will use o1.equals(o2) to compare. If none of the above conditions match, we return false.

Parameters:
o1 - the first object to compare
o2 - the second object to compare
considerArrayOrList - 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.
Returns:
true if the two objects are equal. Otherwise false.

equals

public static boolean equals(CharSequence s1,
                             CharSequence s2,
                             boolean caseSensitive)

charsEqualIgnoreCase

public static boolean charsEqualIgnoreCase(char a,
                                           char b)

toUpperCase

public static char toUpperCase(char a)

toLowerCase

public static char toLowerCase(char a)

getFasterScaledInstance

public static BufferedImage getFasterScaledInstance(BufferedImage img,
                                                    int targetWidth,
                                                    int targetHeight,
                                                    Object hint,
                                                    boolean progressiveBilinear)
Convenience method that returns a scaled instance of the provided BufferedImage.

Parameters:
img - the original image to be scaled
targetWidth - the desired width of the scaled instance, in pixels
targetHeight - the desired height of the scaled instance, in pixels
hint - 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)
Returns:
a scaled version of the original BufferedImage

getFocusAcceleratorKeyMask

public static int getFocusAcceleratorKeyMask()

shouldUseSystemFont

public 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. To address this issue, we changed the code to force to use Tahoma font for all the fonts in L&F instead of using the system font.

However this is a downside to this. Tahoma cannot display Unicode characters such as Chinese, Japanese and Korean. So if the locale is CJK (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.

Returns:
true if the L&F should use system font.

printUIDefaults

public static void printUIDefaults()

setRecursively

public static void setRecursively(Component c,
                                  JideSwingUtilities.Handler handler)
Calls the handler recursively on a component.

Parameters:
c - component
handler - handler to be called

findFirstComponentByName

public static Component findFirstComponentByName(Container c,
                                                 String name)
Gets the first component inside the specified container that has the specified name.

Parameters:
c - the container
name - the name of the component
Returns:
the component. Null if not found.

findFirstComponentByClass

public static Component findFirstComponentByClass(Container c,
                                                  Class<?> clazz)
Gets the first component inside the specified container that has the specified class.

Parameters:
c - the container
clazz - the class of the component
Returns:
the component. Null if not found.

getRecursively

public static Component getRecursively(Component c,
                                       JideSwingUtilities.GetHandler handler)
Gets to a child of a component recursively based on certain condition.

Parameters:
c - component
handler - handler to be called
Returns:
the component that matches the condition specified in GetHandler.

setEnabledRecursively

public static void setEnabledRecursively(Component c,
                                         boolean enabled)
Calls setEnabled method recursively on component. Component c is usually a Container

Parameters:
c - component
enabled - true if enable; false otherwise

putClientPropertyRecursively

public 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.

Parameters:
c - component
clientProperty - the client property name
value - the value for the client property

setRequestFocusEnabledRecursively

public static void setRequestFocusEnabledRecursively(Component c,
                                                     boolean enabled)
Calls setRequestFocusEnabled method recursively on component. Component c is usually a Container

Parameters:
c - component
enabled - true if setRequestFocusEnabled to true; false otherwise

setOpaqueRecursively

public static void setOpaqueRecursively(Component c,
                                        boolean opaque)
Calls setOpaque method recursively on each component except for JButton, JComboBox and JTextComponent. 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.

Parameters:
c - component
opaque - true if setOpaque to true; false otherwise

getPreferredButtonSize

public static Dimension getPreferredButtonSize(AbstractButton b,
                                               int textIconGap,
                                               boolean isHorizontal)

layoutCompoundLabel

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)
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.

Parameters:
c - the component
fm - the font metrics
text - the text
icon - the icon
isHorizontal - the flag indicating horizontal or vertical
verticalAlignment - vertical alignment model
horizontalAlignment - horizontal alignment model
verticalTextPosition - vertical text position
horizontalTextPosition - horizontal text position
viewR - view rectangle
iconR - icon rectangle
textR - text rectangle
textIconGap - the gap between the text and the gap
Returns:
the string after layout.

layoutCompoundLabel

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)
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.

Parameters:
fm - the font metrics
text - the text to layout
icon - the icon to layout
isHorizontal - if the layout is horizontal
verticalAlignment - the vertical alignment
horizontalAlignment - the horizontal alignment
verticalTextPosition - the vertical text position
horizontalTextPosition - the horizontal text position
viewR - the view rectangle
iconR - the icon rectangle
textR - the text rectangle
textIconGap - the gap between the text and the icon
Returns:
the string after layout.

getOrientationOf

public static int getOrientationOf(Component component)

setOrientationOf

public static void setOrientationOf(Component component,
                                    int orientation)

setChildrenOrientationOf

public static void setChildrenOrientationOf(Container c,
                                            int orientation)

disableDoubleBuffered

public static Map<Component,Boolean> disableDoubleBuffered(Component c)
Disables the double buffered flag of the component and its children. The return map contains the components that were double buffered. After this call, you can then restore the double buffered flag using restoreDoubleBuffered(java.awt.Component, java.util.Map) using the map that is returned from this method.

Parameters:
c - the parent container.
Returns:
the map that contains all components that were double buffered.

enableDoubleBuffered

public static Map<Component,Boolean> enableDoubleBuffered(Component c)
Enables the double buffered flag of the component and its children. The return map contains the components that weren't double buffered. After this call, you can then restore the double buffered flag using restoreDoubleBuffered(java.awt.Component, java.util.Map) using the map that is returned from this method.

Parameters:
c - the parent container.
Returns:
the map that contains all components that weren't double buffered.

restoreDoubleBuffered

public static void restoreDoubleBuffered(Component c,
                                         Map<Component,Boolean> map)
Restores the double buffered flag of the component and its children. Only components that are in the map will be changed.

Parameters:
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.

paintBackground

public static void paintBackground(Graphics g,
                                   Rectangle rect,
                                   Color border,
                                   Color bk)

paintBackground

public static void paintBackground(Graphics2D g2d,
                                   Rectangle rect,
                                   Color border,
                                   Paint paint)

drawTextAntialiased

public static boolean drawTextAntialiased(boolean aaText)
Returns whether or not text should be drawn anti-aliased.

Parameters:
aaText - Whether or not aa text has been turned on for the component.
Returns:
Whether or not text should be drawn anti-aliased.

drawStringUnderlineCharAt

public static void drawStringUnderlineCharAt(JComponent c,
                                             Graphics g,
                                             String text,
                                             int underlinedIndex,
                                             int x,
                                             int y)

drawString

public static void drawString(JComponent c,
                              Graphics g,
                              String text,
                              int x,
                              int y)

setupAntialiasing

public static Object setupAntialiasing(Component c,
                                       Graphics g)
Setups the graphics to draw text using anti-alias.

Under JDK1.4 and JDK5, this method will use a system property "swing.aatext" to determine if anti-alias is used. Under JDK6, we will read the system setting. For example, on Windows XP, there is a check box to turn on clear type anti-alias. We will use the same settings.

Parameters:
c - the component
g - the Graphics instance
Returns:
the old hints. You will need this value as the third parameter in restoreAntialiasing(java.awt.Component, java.awt.Graphics, Object).

restoreAntialiasing

public static void restoreAntialiasing(Component c,
                                       Graphics g,
                                       Object oldHints)
Restores the old setting for text anti-alias.

Parameters:
c -
g -
oldHints - the value returned from setupAntialiasing(java.awt.Component, java.awt.Graphics).

setupShapeAntialiasing

public static Object setupShapeAntialiasing(Graphics g)
Setups the graphics to draw shape using anti-alias.

Parameters:
g -
Returns:
the old hints. You will need this value as the third parameter in restoreShapeAntialiasing(java.awt.Graphics, Object).

restoreShapeAntialiasing

public static void restoreShapeAntialiasing(Graphics g,
                                            Object oldHints)
Restores the old setting for shape anti-alias.

Parameters:
g -
oldHints - the value returned from setupShapeAntialiasing(java.awt.Graphics).

drawGrip

public static void drawGrip(Graphics g,
                            Rectangle rectangle,
                            int maxLength,
                            int maxThickness)

drawGrip

public static void drawGrip(Graphics g,
                            Rectangle rectangle,
                            int maxLength,
                            int maxThickness,
                            boolean isSelected)

registerTabKey

public static void registerTabKey(Container container)
Register the tab key with the container.

Parameters:
container -

fillGradient

public static void fillGradient(Graphics g,
                                Rectangle rect,
                                int orientation)

fillSingleGradient

public static void fillSingleGradient(Graphics g,
                                      Rectangle rect,
                                      int orientation)

fillSingleGradient

public static void fillSingleGradient(Graphics g,
                                      Rectangle rect,
                                      int orientation,
                                      int level)

getRadialGradientPaint

public static Paint getRadialGradientPaint(Point2D point,
                                           float radius,
                                           float[] fractions,
                                           Color[] colors)
Gets the RadialGradientPaint. RadialGradientPaint is added after JDK6. If you are running JDK5 or before, you can include batik-awt-util.jar which also has a RadialGradientPaint class. This method will use reflection to determine if the RadialGradientPaint class is in the class path and use the one it can find.


getRadialGradientPaint

public static Paint getRadialGradientPaint(float cx,
                                           float cy,
                                           float radius,
                                           float[] fractions,
                                           Color[] colors)
Gets the RadialGradientPaint. RadialGradientPaint is added after JDK6. If you are running JDK5 or before, you can include batik-awt-util.jar which also has a RadialGradientPaint class. This method will use reflection to determine if the RadialGradientPaint class is in the class path and use the one it can find.


getLinearGradientPaint

public static Paint getLinearGradientPaint(float startX,
                                           float startY,
                                           float endX,
                                           float endY,
                                           float[] fractions,
                                           Color[] colors)
Gets the LinearGradientPaint. LinearGradientPaint is added after JDK6. If you are running JDK5 or before, you can include batik-awt-util.jar which also has a LinearGradientPaint class. This method will use reflection to determine if the LinearGradientPaint class is in the class path and use the one it can find.


containerContainsFocus

public static boolean containerContainsFocus(Container cont)
containerContainsFocus, does the specified container contain the current focusOwner?

Parameters:
cont - the specified container
Returns:
Is the current focusOwner a descendant of the specified container, or the container itself?

componentIsPermanentFocusOwner

public static boolean componentIsPermanentFocusOwner(Component comp)

installColorsAndFont

public static void installColorsAndFont(Component c,
                                        Color background,
                                        Color foreground,
                                        Font font)

installFont

public static void installFont(Component c,
                               Font font)

installColors

public static void installColors(Component c,
                                 Color background,
                                 Color foreground)

installBorder

public static void installBorder(JComponent c,
                                 Border defaultBorder)

fillNormalGradient

public static void fillNormalGradient(Graphics2D g2d,
                                      Shape s,
                                      Color startColor,
                                      Color endColor,
                                      boolean isVertical)

fillGradient

public static void fillGradient(Graphics2D g2d,
                                Shape s,
                                Color startColor,
                                Color endColor,
                                boolean isVertical)
Fills a gradient using the startColor and endColor specified. This is a fast version of fill gradient which will not only leverage hardware acceleration, but also cache GradientPaint and reuse it.

We also leave an option to use the normal GradientPaint to paint the gradient. To do so, just set a system property "normalGradientPaint" to "false".

Parameters:
g2d -
s -
startColor -
endColor -
isVertical -

clearGradientCache

public static void clearGradientCache()
Clears the gradient cache used for fast gradient painting


getTopModalDialog

public static Window getTopModalDialog(Window w)
Gets the top modal dialog of current window.

Parameters:
w -
Returns:
the top modal dialog of current window.

traceFocus

public static void traceFocus()
For internal usage only.


traceFocus

public static void traceFocus(boolean useBorders)
For internal usage only.


runGCAndPrintFreeMemory

public static void runGCAndPrintFreeMemory()

createTableModelModifier

public static JPanel createTableModelModifier(DefaultTableModel tableModel)
For internal usage only.


findSomethingFocusable

public static Component findSomethingFocusable(Container container)
Find some subcomponent of the specified container that will accept focus.

Note that this doesn't do something smart like trying to walk the hierarchy horizontally at each level so that the focused subcomponent is as high as possible. Rather, it drills vertically. It's just a safety valve so that focus can be requested somewhere rather than being lost.

Parameters:
container -
Returns:
a focusable subcomponent

passesFocusabilityTest

public static boolean passesFocusabilityTest(Component comp)
There are four standard tests which determine if Swing will be able to request focus for a component. Test them.

Parameters:
comp -
Returns:
does the specified component pass the four focusability tests

ignoreException

public static void ignoreException(Exception e)
Ignore the exception. This method does nothing. However it's a good practice to use this method so that we can easily find out the place that ignoring exception. In development phase, we can log a message in this method so that we can verify if it makes sense to ignore.

Parameters:
e -

printException

public static void printException(Exception e)
Prints out the message of the exception.

Parameters:
e -

throwException

public static void throwException(Exception e)
Throws the exception. If the exception is RuntimeException, just throw it. Otherwise, wrap it in RuntimeException and throw it.

Parameters:
e -

throwInvocationTargetException

public static void throwInvocationTargetException(InvocationTargetException e)
Throws the InvocationTargetException. Usually InvocationTargetException has a nested exception as target exception. If the target exception is a RuntimeException or Error, we will throw it. Otherwise, we will wrap it inside RuntimeException and throw it.

Parameters:
e -

findDisplayedMnemonicIndex

public static int findDisplayedMnemonicIndex(String text,
                                             int mnemonic)

getDescendantOfClass

public static Component getDescendantOfClass(Class c,
                                             Container container)
Gets the first occurrence of the component with specified type in the container. It used deep-first searching to find it.

Parameters:
c -
container -
Returns:
the first occurrence of the component with specified type in the container. Null if nothing is found.

getDefaultFontSize

public static float getDefaultFontSize()

getMenuFont

public static Object getMenuFont(Toolkit toolkit,
                                 UIDefaults table)

getControlFont

public static Object getControlFont(Toolkit toolkit,
                                    UIDefaults table)

getBoldFont

public static Object getBoldFont(Toolkit toolkit,
                                 UIDefaults table)

drawShadow

public static void drawShadow(Graphics g,
                              Component c,
                              int x,
                              int y,
                              int w,
                              int h)

drawImageBorder

public static void drawImageBorder(Graphics g,
                                   ImageIcon img,
                                   Rectangle rect,
                                   Insets ins,
                                   boolean drawCenter)
Draws a border based on an image. The image can be divided into nine different areas. Each area size is determined by the insets.


compositeRequestFocus

public static boolean compositeRequestFocus(Component component)
Copied from BasicLookAndFeel as the method is package local.

Parameters:
component -
Returns:
if request focus is success or not.

isAncestorOfFocusOwner

public static boolean isAncestorOfFocusOwner(Component component)

getWindowForComponent

public static Window getWindowForComponent(Component parentComponent)
                                    throws HeadlessException
Gets the top level Window of the component.

Parameters:
parentComponent -
Returns:
the top level Frame. Null if we didn't find an ancestor which is instance of Frame.
Throws:
HeadlessException

isKeyListenerRegistered

public static boolean isKeyListenerRegistered(Component component,
                                              KeyListener l)
Checks if the key listener is already registered on the component.

Parameters:
component - the component
l - the listener
Returns:
true if already registered. Otherwise false.

insertKeyListener

public static void insertKeyListener(Component component,
                                     KeyListener l,
                                     int index)
Inserts the key listener at the particular index in the listeners' chain.

Parameters:
component -
l -
index -

insertTableModelListener

public static void insertTableModelListener(TableModel model,
                                            TableModelListener l,
                                            int index)
Inserts the table model listener at the particular index in the listeners' chain. The listeners are fired in reverse order. So the listener at index 0 will be fired at last.

Parameters:
model - the AbstractTableModel
l - the TableModelListener to be inserted
index - the index.

isPropertyChangeListenerRegistered

public static boolean isPropertyChangeListenerRegistered(Component component,
                                                         PropertyChangeListener l)
Checks if the property change listener is already registered on the component.

Parameters:
component - the component
l - the listener
Returns:
true if already registered. Otherwise false.

isPropertyChangeListenerRegistered

public static boolean isPropertyChangeListenerRegistered(Component component,
                                                         String propertyName,
                                                         PropertyChangeListener l)
Checks if the property change listener is already registered on the component.

Parameters:
component - the component
propertyName - the property name
l - the listener
Returns:
true if already registered. Otherwise false.

isMouseListenerRegistered

public static boolean isMouseListenerRegistered(Component component,
                                                MouseListener l)
Checks if the mouse listener is already registered on the component.

Parameters:
component - the component
l - the listener
Returns:
true if already registered. Otherwise false.

insertMouseListener

public static void insertMouseListener(Component component,
                                       MouseListener l,
                                       int index)
Inserts the mouse listener at the particular index in the listeners' chain.

Parameters:
component -
l -
index -

isMouseMotionListenerRegistered

public static boolean isMouseMotionListenerRegistered(Component component,
                                                      MouseMotionListener l)
Checks if the mouse motion listener is already registered on the component.

Parameters:
component - the component
l - the listener
Returns:
true if already registered. Otherwise false.

insertMouseMotionListener

public static void insertMouseMotionListener(Component component,
                                             MouseMotionListener l,
                                             int index)
Inserts the mouse motion listener at the particular index in the listeners' chain.

Parameters:
component -
l -
index -

getScrollPane

public static Component getScrollPane(Component innerComponent)
Gets the scroll pane around the component.

Parameters:
innerComponent -
Returns:
the scroll pane. Null if the component is not in any JScrollPane.

isListenerRegistered

public 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

Parameters:
list - the EventListenerList to register the listener.
t - the type of the EventListener.
l - the listener.
Returns:
true if already registered. Otherwise false.

isListenerRegistered

public 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

Parameters:
component - the component that you want to register the listener.
t - the type of the EventListener.
l - the listener.
Returns:
true if already registered. Otherwise false.

getFirstChildOf

public static Component getFirstChildOf(Class<?> clazz,
                                        Component c)
Gets the first child of the component that is the specified type.

Parameters:
clazz - the type of the component to look for
c - the component
Returns:
the first child of the component that is the specified type.

getComponentIndex

public static int getComponentIndex(Container container,
                                    Component c)
Get the index of the component in the container. It will return -1 if c's parent is not container.

Parameters:
container - the container
c - the component
Returns:
the index

convertDefaultComboBoxModelToVector

public static Vector convertDefaultComboBoxModelToVector(DefaultComboBoxModel model)

ensureRowVisible

public static void ensureRowVisible(JTable table,
                                    int row)
To make sure the row is visible. If the table's horizontal scroll bar is visible, the method will not change the horizontal scroll bar's position.

Parameters:
table -
row -

retargetMouseEvent

public static void retargetMouseEvent(int id,
                                      MouseEvent e,
                                      Component target)

getOutermostRootPane

public static JRootPane getOutermostRootPane(Component c)
If c is a JRootPane descendant return its outermost JRootPane ancestor. If c is a RootPaneContainer then return its JRootPane.

Parameters:
c - the component.
Returns:
the outermost JRootPane for Component c or null.

isFixedWidthFont

public static boolean isFixedWidthFont(String fontName,
                                       Component component)
Checks if the font specified by the font name is fixed width font. Fixed width font means all chars have the exact same width.

Parameters:
fontName - the font name
component - the component where the font will be displayed.
Returns:
true if the font is fixed width. Otherwise false.

setLocaleRecursively

public static void setLocaleRecursively(Component c,
                                        Locale locale)
Sets the locale recursively on the component and all its child components if any.

Parameters:
c - the component
locale - the new locales.

setBounds

public static void setBounds(Container container,
                             Component component,
                             Rectangle bounds)
Sets the bounds. If the container orientation is from right to left, this method will adjust the x to the opposite.

Parameters:
container - the container. It is usually the parent of the component.
component - the component to set bounds
bounds - the bounds.

setBounds

public static void setBounds(Container container,
                             Component component,
                             int x,
                             int y,
                             int width,
                             int height)
Sets the bounds. If the container orientation is from right to left, this method will adjust the x to the opposite.

Parameters:
container - the container. It is usually the parent of the component.
component - the component to set bounds
x - the x of the bounds
y - the y of the bounds
width - the the height of the bounds. of the bounds.
height - the height of the bounds.

invalidateRecursively

public static void invalidateRecursively(Component c)
Invalidate and doLayout on the component and all its child components if any.

Parameters:
c - the component

synchronizeKeyboardActions

public 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.

Parameters:
sourceComponent - the source component.
targetComponent - the target component.
keyStrokes - the keystrokes
condition - the condition which will be used in JComponent.registerKeyboardAction(java.awt.event.ActionListener, javax.swing.KeyStroke, int) as the last parameter.

getFirstJComponent

public static JComponent getFirstJComponent(RootPaneContainer rootPaneContainer)
Gets the first JComponent from the RootPaneContainer.

Parameters:
rootPaneContainer - a rootPaneContainer
Returns:
the first JComponent from the rootPaneContainer's content pane.

adjustPreferredScrollableViewportSize

public static Dimension adjustPreferredScrollableViewportSize(JList list,
                                                              Dimension defaultViewportSize)
This method can be used to fix two JDK bugs. One is to fix the row height is wrong when the first element in the model is null or empty string. The second bug is only on JDK1.4.2 where the vertical scroll bar is shown even all rows are visible. To use it, you just need to override JList#getPreferredScrollableViewportSize and call this method.

 public Dimension getPreferredScrollableViewportSize() {
    return JideSwingUtilities.adjustPreferredScrollableViewportSize(this, super.getPreferredScrollableViewportSize());
 }
 

Parameters:
list - the JList
defaultViewportSize - the default viewport size from JList#getPreferredScrollableViewportSize().
Returns:
the adjusted size.

removeFromParentWithFocusTransfer

public 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. By calling this function before any of the operations above focus is guaranteed a consistent degregation.

Parameters:
component -

getLineHeight

public static int getLineHeight(Component c,
                                int defaultHeight)
Gets the line height for the font for the component

Parameters:
c - the component
defaultHeight - the default height if the font on the specified component is null
Returns:
the line height for the font for the component (or the passed in the default value if the font on the specified component is null)

addSeparatorIfNecessary

public static void addSeparatorIfNecessary(JPopupMenu popup)
Adds a separator to the popup menu if there are menu items on it already.

Parameters:
popup - the popup menu.

removeExtraSeparators

public static void removeExtraSeparators(JPopupMenu popup)
Removes extra separators, if any. This can be used when you remove some menu items and leave extra separators on the UI.

Parameters:
popup - the popup menu.

setTextComponentTransparent

@Deprecated
public static void setTextComponentTransparent(JComponent component)
Deprecated. replaced by setComponentTransparent(javax.swing.JComponent).

Sets the text component transparent. It will call setOpaque(false) and also set client property for certain L&Fs in case the L&F doesn't respect the opaque flag.

Parameters:
component - the text component to be set to transparent.

setComponentTransparent

public static void setComponentTransparent(JComponent component)
Sets the text component transparent. It will call setOpaque(false) and also set client property for certain L&Fs in case the L&F doesn't respect the opaque flag.

Parameters:
component - the text component to be set to transparent.

binarySearch

public static int binarySearch(List<Object> a,
                               Object key)
Perform a binary search over a sorted list for the given key.

Parameters:
a - the array to search
key - the key to search for
Returns:
the index of the given key if it exists in the list, otherwise -1 times the index value at the insertion point that would be used if the key were added to the list.

binarySearch

public static int binarySearch(Object[] a,
                               Object key)
Perform a binary search over a sorted array for the given key.

Parameters:
a - the array to search
key - the key to search for
Returns:
the index of the given key if it exists in the array, otherwise -1 times the index value at the insertion point that would be used if the key were added to the array.

binarySearch

public static int binarySearch(int[] a,
                               int key)
Perform a binary search over a sorted array for the given key.

Parameters:
a - the array to search
key - the key to search for
Returns:
the index of the given key if it exists in the array, otherwise -1 times the index value at the insertion point that would be used if the key were added to the array.

binarySearch

public static int binarySearch(int[] a,
                               int key,
                               int start,
                               int end)
Perform a binary search over a sorted array for the given key.

Parameters:
a - the array to search
key - the key to search for
start - the start index to search inclusive
end - the end index to search exclusive
Returns:
the index of the given key if it exists in the array, otherwise -1 times the index value at the insertion point that would be used if the key were added to the array.

isMenuShortcutKeyDown

public static boolean isMenuShortcutKeyDown(InputEvent event)
Checks if the ctrl key is pressed. On Mac oS X, it will be command key.

Parameters:
event - the InputEvent.
Returns:
true or false.

isMenuShortcutKeyDown

public static boolean isMenuShortcutKeyDown(ActionEvent event)
Checks if the ctrl key is pressed. On Mac oS X, it will be command key.

Parameters:
event - the InputEvent.
Returns:
true or false.

getViewportSynchronizationChangeListener

public static ChangeListener getViewportSynchronizationChangeListener()

setWindowOpaque

public static void setWindowOpaque(Window window,
                                   boolean opaque)
Sets the Window opaque using AWTUtilities.setWindowOpaque on JDK6u10 and later.

Parameters:
window - the Window
opaque - true or false

setWindowOpacity

public static void setWindowOpacity(Window window,
                                    float opacity)
Sets the Window opacity using AWTUtilities.setWindowOpacity on JDK6u10 and later.

Parameters:
window - the Window
opacity - the opacity

setWindowShape

public static void setWindowShape(Window window,
                                  Shape shape)
Sets the Window shape using AWTUtilities.setWindowOpacity on JDK6u10 and later.

Parameters:
window - the Window
shape - the shape

getOKString

public static String getOKString(Locale locale)
Gets the string representing OK button.

Parameters:
locale - the locale
Returns:
the string.
Since:
3.3.8

getCancelString

public static String getCancelString(Locale locale)
Gets the string representing Cancel button.

Parameters:
locale - the locale
Returns:
the string.
Since:
3.3.8

getYesString

public static String getYesString(Locale locale)
Gets the string representing Yes button.

Parameters:
locale - the locale
Returns:
the string.
Since:
3.3.8

getNoString

public static String getNoString(Locale locale)
Gets the string representing No button.

Parameters:
locale - the locale
Returns:
the string.
Since:
3.3.8

JIDE 3.5.15