Sweet Home 3D 3.4

com.eteks.sweethome3d.swing
Class SwingTools

java.lang.Object
  extended by com.eteks.sweethome3d.swing.SwingTools

public class SwingTools
extends java.lang.Object

Gathers some useful tools for Swing.

Author:
Emmanuel Puybaret

Method Summary
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 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 javax.swing.JComponent>
java.util.List<T>
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 current Locale.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

installFocusBorder

public 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. If the component component is the child of a JViewPort instance this border will be installed on its scroll pane parent.


updateSwingResourceLanguage

public static void updateSwingResourceLanguage()
Updates the Swing resource bundles in use from the current Locale.


getLocalizedLabelText

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


addAutoSelectionOnFocusGain

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


deselectAllRadioButtons

public static void deselectAllRadioButtons(javax.swing.JRadioButton... radioButtons)
Forces radio buttons to be deselected even if they belong to a button group.


showConfirmDialog

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


showMessageDialog

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


getPatternImage

public static java.awt.image.BufferedImage getPatternImage(TextureImage pattern,
                                                           java.awt.Color backgroundColor,
                                                           java.awt.Color foregroundColor)
Returns the image matching a given pattern.


getDropableComponentBorder

public static javax.swing.border.Border getDropableComponentBorder()
Returns the border of a component where a user may drop objects.


showSplashScreenWindow

public 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. If the imageUrl is incorrect, nothing happens.


createTitledPanel

public static javax.swing.JPanel createTitledPanel(java.lang.String title)
Returns a new panel with a border and the given title


hideDisabledMenuItems

public static void hideDisabledMenuItems(javax.swing.JPopupMenu popupMenu)
Adds a listener that will update the given popup menu to hide disabled menu items.


showDocumentInBrowser

public static boolean showDocumentInBrowser(java.net.URL url)
Attempts to display the given url in a browser and returns true if it was done successfully.


findChildren

public static <T extends javax.swing.JComponent> java.util.List<T> findChildren(javax.swing.JComponent parent,
                                                                                java.lang.Class<T> childrenClass)
Returns the children of a component of the given class.


isRectangleVisibleAtScreen

public static boolean isRectangleVisibleAtScreen(java.awt.Rectangle rectangle)
Returns true if the given rectangle is fully visible at screen.


Sweet Home 3D 3.4

? Copyrights 2006-2011 eTeks - All rights reserved
Distributed under GNU General Public License