public class SwingTools
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static void |
addAutoSelectionOnFocusGain(javax.swing.text.JTextComponent textComponent)
Adds focus and mouse listeners to the given
textComponent that will
select all its text when it gains focus by transfer. |
static java.awt.Cursor |
createCustomCursor(java.net.URL smallCursorImageUrl,
java.net.URL largeCursorImageUrl,
float xCursorHotSpot,
float yCursorHotSpot,
java.lang.String cursorName,
java.awt.Cursor defaultCursor)
Returns a new custom cursor.
|
static javax.swing.JScrollPane |
createScrollPane(javax.swing.JComponent component)
Returns a scroll pane containing the given
component
that always displays scroll bars under Mac OS X. |
static javax.swing.JPanel |
createTitledPanel(java.lang.String title)
Returns a new panel with a border and the given
title |
static void |
deselectAllRadioButtons(javax.swing.JRadioButton... radioButtons)
Forces radio buttons to be deselected even if they belong to a button group.
|
static <T extends java.awt.Component> |
findChildren(javax.swing.JComponent parent,
java.lang.Class<T> childrenClass)
Returns the children of a component of the given class.
|
static javax.swing.border.Border |
getDropableComponentBorder()
Returns the border of a component where a user may drop objects.
|
static java.lang.String |
getLocalizedLabelText(UserPreferences preferences,
java.lang.Class<?> resourceClass,
java.lang.String resourceKey,
java.lang.Object... resourceParameters)
Returns a localized text for menus items and labels depending on the system.
|
static java.awt.image.BufferedImage |
getPatternImage(TextureImage pattern,
java.awt.Color backgroundColor,
java.awt.Color foregroundColor)
Returns the image matching a given pattern.
|
static void |
hideDisabledMenuItems(javax.swing.JPopupMenu popupMenu)
Adds a listener that will update the given popup menu to hide disabled menu items.
|
static void |
installFocusBorder(javax.swing.JComponent component)
Updates the border of
component with an empty border
changed to a colored border when it will gain focus. |
static boolean |
isRectangleVisibleAtScreen(java.awt.Rectangle rectangle)
Returns
true if the given rectangle is fully visible at screen. |
static int |
showConfirmDialog(javax.swing.JComponent parentComponent,
javax.swing.JComponent messageComponent,
java.lang.String title,
javax.swing.JComponent focusedComponent)
Displays
messageComponent in a modal dialog box, giving focus to one of its components. |
static boolean |
showDocumentInBrowser(java.net.URL url)
Attempts to display the given
url in a browser and returns true
if it was done successfully. |
static void |
showMessageDialog(javax.swing.JComponent parentComponent,
javax.swing.JComponent messageComponent,
java.lang.String title,
int messageType,
javax.swing.JComponent focusedComponent)
Displays
messageComponent in a modal dialog box, giving focus to one of its components. |
static void |
showSplashScreenWindow(java.net.URL imageUrl)
Displays the image referenced by
imageUrl in an AWT window
disposed once an other AWT frame is created. |
static void |
updateSwingResourceLanguage()
Updates the Swing resource bundles in use from the default Locale and class loader.
|
static void |
updateSwingResourceLanguage(UserPreferences preferences)
Updates the Swing resource bundles in use from the preferences Locale and the class loaders of preferences.
|
public static void installFocusBorder(javax.swing.JComponent component)
component
with an empty border
changed to a colored border when it will gain focus.
If the component
component is the child of a JViewPort
instance this border will be installed on its scroll pane parent.public static void updateSwingResourceLanguage()
public static void updateSwingResourceLanguage(UserPreferences preferences)
public static java.lang.String getLocalizedLabelText(UserPreferences preferences, java.lang.Class<?> resourceClass, java.lang.String resourceKey, java.lang.Object... resourceParameters)
public static void addAutoSelectionOnFocusGain(javax.swing.text.JTextComponent textComponent)
textComponent
that will
select all its text when it gains focus by transfer.public static void deselectAllRadioButtons(javax.swing.JRadioButton... radioButtons)
public static int showConfirmDialog(javax.swing.JComponent parentComponent, javax.swing.JComponent messageComponent, java.lang.String title, javax.swing.JComponent focusedComponent)
messageComponent
in a modal dialog box, giving focus to one of its components.public static void showMessageDialog(javax.swing.JComponent parentComponent, javax.swing.JComponent messageComponent, java.lang.String title, int messageType, javax.swing.JComponent focusedComponent)
messageComponent
in a modal dialog box, giving focus to one of its components.public static java.awt.image.BufferedImage getPatternImage(TextureImage pattern, java.awt.Color backgroundColor, java.awt.Color foregroundColor)
public static javax.swing.border.Border getDropableComponentBorder()
public static void showSplashScreenWindow(java.net.URL imageUrl)
imageUrl
in an AWT window
disposed once an other AWT frame is created.
If the imageUrl
is incorrect, nothing happens.public static javax.swing.JPanel createTitledPanel(java.lang.String title)
title
public static javax.swing.JScrollPane createScrollPane(javax.swing.JComponent component)
component
that always displays scroll bars under Mac OS X.public static void hideDisabledMenuItems(javax.swing.JPopupMenu popupMenu)
public static boolean showDocumentInBrowser(java.net.URL url)
url
in a browser and returns true
if it was done successfully.public static <T extends java.awt.Component> java.util.List<T> findChildren(javax.swing.JComponent parent, java.lang.Class<T> childrenClass)
public static boolean isRectangleVisibleAtScreen(java.awt.Rectangle rectangle)
true
if the given rectangle is fully visible at screen.public static java.awt.Cursor createCustomCursor(java.net.URL smallCursorImageUrl, java.net.URL largeCursorImageUrl, float xCursorHotSpot, float yCursorHotSpot, java.lang.String cursorName, java.awt.Cursor defaultCursor)
© Copyrights 2006-2014 eTeks - All rights reserved
Distributed under GNU General Public License