Package net.sf.jaxodraw.util
Class JaxoLooknFeel
- java.lang.Object
-
- net.sf.jaxodraw.util.JaxoLooknFeel
-
public final class JaxoLooknFeel extends java.lang.Object
Responsible for switching the Look and Feel of JaxoDraw and the Locale of GUI elements (which are closely related).- Since:
- 2.0
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
applyLocale(java.util.Locale value)
Apply the given locale.static boolean
applyLookAndFeel(java.lang.String lookAndFeelClassName)
Set LookAndFeel to given value value, and update existing windows and registered components.static java.util.Locale
getLocale()
Current locale.static javax.swing.UIManager.LookAndFeelInfo
info(java.lang.String className)
Return a LookAndFeelInfo object for a given class name.static void
registerComponent(javax.swing.JComponent c)
Register a component whose look and feel/locale is to be updated automatically.static void
setLookAndFeel(java.lang.String value)
Safe wrapper aroundUIManager.setLookAndFeel(String)
: Set the LookAndFeel, temporarily adjusting the locale to fix resource bundle lookup (default locale problems), and to make JColorChooser work.static void
setLookAndFeel(javax.swing.LookAndFeel value)
Set the LookAndFeel, temporarily adjusting the locale to fix resource bundle lookup (default locale problems), and to make JColorChooser work.static void
unregisterComponent(javax.swing.JComponent c)
Unregister a component whose look and feel/locale is to be updated automatically.static void
updateLookAndFeel()
Update LookAndFeel of all windows and all registered components.
-
-
-
Method Detail
-
getLocale
public static java.util.Locale getLocale()
Current locale. By default, JComponent.getDefaultLocale().- Returns:
- The current locale.
-
applyLocale
public static void applyLocale(java.util.Locale value)
Apply the given locale.- Parameters:
value
- The locale to apply.
-
applyLookAndFeel
public static boolean applyLookAndFeel(java.lang.String lookAndFeelClassName)
Set LookAndFeel to given value value, and update existing windows and registered components. If the given value fails, use the system LookAndFeel.- Parameters:
lookAndFeelClassName
- The class name of the LAF to set.- Returns:
- True if the given L&F was set successfully.
-
info
public static javax.swing.UIManager.LookAndFeelInfo info(java.lang.String className)
Return a LookAndFeelInfo object for a given class name.- Parameters:
className
- the name of the class.- Returns:
- a LookAndFeelInfo object.
-
setLookAndFeel
public static void setLookAndFeel(java.lang.String value) throws java.lang.ClassNotFoundException, java.lang.InstantiationException, java.lang.IllegalAccessException, javax.swing.UnsupportedLookAndFeelException
Safe wrapper aroundUIManager.setLookAndFeel(String)
: Set the LookAndFeel, temporarily adjusting the locale to fix resource bundle lookup (default locale problems), and to make JColorChooser work.- Parameters:
value
- The LAF to set.- Throws:
java.lang.ClassNotFoundException
- ClassNotFoundExceptionjava.lang.InstantiationException
- InstantiationExceptionjava.lang.IllegalAccessException
- IllegalAccessExceptionjavax.swing.UnsupportedLookAndFeelException
- UnsupportedLookAndFeelException- See Also:
UIManager.setLookAndFeel(String)
-
setLookAndFeel
public static void setLookAndFeel(javax.swing.LookAndFeel value) throws javax.swing.UnsupportedLookAndFeelException
Set the LookAndFeel, temporarily adjusting the locale to fix resource bundle lookup (default locale problems), and to make JColorChooser work.- Parameters:
value
- The LAF to set.- Throws:
javax.swing.UnsupportedLookAndFeelException
- UnsupportedLookAndFeelException- See Also:
UIManager.setLookAndFeel(LookAndFeel)
-
updateLookAndFeel
public static void updateLookAndFeel()
Update LookAndFeel of all windows and all registered components.
-
registerComponent
public static void registerComponent(javax.swing.JComponent c)
Register a component whose look and feel/locale is to be updated automatically. This is useful only for components that are not permanently part of a Window (e.g., popup menus).- Parameters:
c
- The component to register.
-
unregisterComponent
public static void unregisterComponent(javax.swing.JComponent c)
Unregister a component whose look and feel/locale is to be updated automatically.- Parameters:
c
- The component to unregister.
-
-