de.javasoft.plaf.synthetica
Class SyntheticaLookAndFeel

java.lang.Object
  extended by javax.swing.LookAndFeel
      extended by javax.swing.plaf.basic.BasicLookAndFeel
          extended by javax.swing.plaf.synth.SynthLookAndFeel
              extended by de.javasoft.plaf.synthetica.SyntheticaLookAndFeel
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
SyntheticaStandardLookAndFeel

public abstract class SyntheticaLookAndFeel
extends javax.swing.plaf.synth.SynthLookAndFeel

Synthetica's base Look and Feel.

Version:
3.70, 28.11.2013
See Also:
Serialized Form

Nested Class Summary
static class SyntheticaLookAndFeel.JVMCompatibilityMode
           
 
Field Summary
static java.util.logging.Logger logger
           
 
Constructor Summary
SyntheticaLookAndFeel()
          Constructor.
SyntheticaLookAndFeel(java.lang.String fileName)
          Constructor.
 
Method Summary
static javax.swing.plaf.synth.SynthContext createContext(javax.swing.JComponent c, javax.swing.plaf.synth.Region region, int state)
           
static java.awt.Paint createLinearGradientPaint(float startX, float startY, float endX, float endY, float[] fractions, java.awt.Color[] colors)
          Convenient method to create a LinearGradientPaint for Java 1.5 and Java 6.
static java.awt.Component findComponent(java.lang.Class<?> childClass, java.awt.Container container)
          Convenient method to find a child component within the specified container.
static java.awt.Component findComponent(java.lang.String name, java.awt.Container container)
          Convenient method to find a child component within the specified container.
static
<T extends java.awt.Component>
java.util.List<T>
findComponents(java.lang.Class<T> childClass, java.awt.Container container, java.util.List<T> components)
          Convenient method to find all child components within the specified container.
static
<T extends java.awt.Component>
java.util.List<T>
findComponents(java.lang.String name, java.awt.Container container, java.util.List<T> components)
          Convenient method to find all child components within the specified container.
static javax.swing.border.Border findDefaultBorder(javax.swing.border.Border b)
          Convenient method to check if a border contains a default (UIResource) border.
static
<T extends javax.swing.JComponent>
T
findOpaqueParentOfClass(java.lang.Class<T> clazz, java.awt.Container c, boolean respectOpacity)
          Returns the first opaque ancestor of the given type.
static java.lang.Object get(java.lang.String key, java.awt.Component c)
          Returns an object from the defaults table with respect to components name.
static java.lang.Object get(java.lang.String key, java.lang.String name)
          Returns an object from the defaults table with respect to component name.
static java.lang.Object get(java.lang.String propertyKey, java.lang.String propertyName, java.lang.String componentName, boolean fallback)
          Checks UIManager for the created DefaultsProperty.
static boolean getAntiAliasEnabled()
          Getter for anti-alias.
static boolean getBoolean(java.lang.String key, java.awt.Component c)
          Returns a boolean value from the defaults table in respect of the component name.
static boolean getBoolean(java.lang.String key, java.awt.Component c, boolean defaultValue)
          Returns a boolean value from the defaults table in respect of the component name.
static
<T> T
getClientProperty(java.lang.String key, javax.swing.JComponent c, T defaultValue)
          Returns client property value of the specified component.
static java.awt.Color getColor(java.lang.String key, java.awt.Component c)
          Returns a color object from the defaults table in respect of the component name.
static java.awt.Color getColor(java.lang.String key, java.awt.Component c, java.awt.Color defaultColor)
          Returns a color object from the defaults table in respect of the component name.
 java.lang.String getConfigFileName()
          Returns the XML file name which was used to initialize this LAF.
 javax.swing.UIDefaults getDefaults()
          Overwrites the LAF#getDefaults method to set the metal FileChooserUI for Synthetica.
static boolean getDefaultsCompatibilityMode()
          Getter for defaultsCompatibilityMode option.
 java.lang.String getDescription()
           
static java.awt.Dimension getDim(java.lang.String key, java.awt.Component c)
          Returns Dimension from the defaults table in respect of the component name.
static java.awt.Dimension getDim(java.lang.String key, java.awt.Component c, java.awt.Dimension defaultValue)
          Returns Dimension from the defaults table in respect of the component name.
 javax.swing.Icon getDisabledIcon(javax.swing.JComponent c, javax.swing.Icon icon)
           
static boolean getExtendedFileChooserEnabled()
          Getter for extendedFileChooser option.
static java.awt.Font getFont()
          Getter for default font.
static java.lang.String getFontName()
          Getter for fontName.
static int getFontSize()
          Getter for fontSize.
static javax.swing.Icon getIcon(java.lang.String key, java.awt.Component c)
          Returns an icon object from the defaults table in respect of the component name.
abstract  java.lang.String getID()
           
static java.awt.Insets getInsets(java.lang.String key, java.awt.Component c)
          Returns an insets object from the defaults table in respect of the component name.
static java.awt.Insets getInsets(java.lang.String key, java.awt.Component c, boolean nullAllowed)
          Returns an insets object from the defaults table in respect of the component name.
static java.awt.Insets getInsets(java.lang.String key, java.awt.Component c, java.awt.Insets defaultValue)
          Returns an insets object from the defaults table in respect of the component name.
static java.awt.Insets getInsets(java.lang.String propertyKey, java.lang.String propertyName, java.lang.String componentName, boolean fallback)
           
static int getInt(java.lang.String key, java.awt.Component c)
          Returns an int value from the defaults table in respect of the component name.
static int getInt(java.lang.String key, java.awt.Component c, int defaultValue)
          Returns an int value from the defaults table in respect of the component name.
static int getInt(java.lang.String propertyKey, java.lang.String propertyName, java.lang.String componentName, boolean fallback, int defaultValue)
           
static SyntheticaLookAndFeel.JVMCompatibilityMode getJVMCompatibilityMode()
          Returns the active JVM compatibility mode used by Synthetica.
abstract  java.lang.String getName()
           
static boolean getRememberFileChooserPreferences()
          Getter for rememberFileChooserPreferences option.
static java.lang.String getString(java.lang.String key, java.awt.Component c)
          Returns a string object from the defaults table in respect of the component name.
static java.lang.String getString(java.lang.String propertyKey, java.lang.String propertyName, java.lang.String componentName, boolean fallback)
           
static java.lang.String getStyleName(java.awt.Component c)
          Static utility methods.
 boolean getSupportsWindowDecorations()
           
 IVersion getSyntheticaVersion()
          Returns Synthetica's core version information.
static java.awt.Dimension getToolbarSeparatorDimension()
          Getter for toolbar separator dimension.
static boolean getUseSystemFileIcons()
          Getter for useSystemFileIcons.
 IVersion getVersion()
          Returns version info of the currently active Synthetica theme.
 void initialize()
          Overwrites the LAF#initialize method to install Synthetica's styleFactory and popupFactory.
protected  void installCompatibilityDefaults()
          Some applications need certain DefaultProperties to initialize their own components.
protected  void installSyntheticaDefaults()
           
static boolean isOpaque(javax.swing.JComponent c)
          Convenient method to check Synthetica component opacity ("Synthetica.opaque" key) with respect of "Synthetica.textComponents.useSwingOpaqueness".
static boolean isSystemPropertySet(java.lang.String systemPropertyName)
           
static boolean isSystemPropertySet(java.lang.String systemPropertyName, java.lang.String value)
           
static boolean isToplevelPopupMenu(javax.swing.JPopupMenu popup)
          Returns true if toplevel popup menu handling is enabled and the invoker is a toplevel JMenu (or marked by client property "Synthetica.menu.toplevel") or popup is marked as toplevel popup by client property "Synthetica.popupMenu.toplevel".
static boolean isWindowOpacityEnabled(java.awt.Window w)
          Helper method to check if window opacity support "Synthetica.window.opaque" is enabled/disabled.
static boolean isWindowShapeEnabled(java.awt.Window w)
          Helper method to check if window shape "Synthetica.window.shape" is enabled/disabled.
static boolean isWindowShapeSupported(java.awt.Window w)
          Helper method to check if window shape support is provided by the JVM.
protected  void loadAddonsXMLConfig(java.lang.String path)
          Load addons XML configuration files.
protected  void loadCustomXML()
          Override to load custom config files via loadXMLConfig(String)
static javax.swing.Icon loadIcon(java.lang.String key)
          Loads an icon by UI property key.
static javax.swing.Icon loadIcon(java.lang.String key, java.awt.Component c)
          Loads an icon by UI property key.
protected  void loadXMLConfig(java.lang.String fileName)
          Loads XML configuration file.
static boolean popupHasCheckRadio(javax.swing.JPopupMenu popup)
          Convenient method to check if a popupMenu contains checkBox or radioButton menuItems.
static boolean popupHasCheckRadioWithIcon(javax.swing.JPopupMenu popup)
          Convenient method to check if a popupMenu contains checkBox or radioButton menuItems with icon.
static boolean popupHasIcons(javax.swing.JPopupMenu popup)
          Convenient method to check if a popupMenu contains menuItems with icons.
static boolean preservePopupIconSpace(javax.swing.JPopupMenu popup)
          Retruns true if a popup requires some extra space because of icon usage.
static float scaleFontSize(float fontSize)
          Calculates environment dependent font size - i. e. to respect current screen resolution.
static void setAntiAliasEnabled(boolean value)
          Setter for anti-alias.
static void setChildrenName(java.awt.Container container, java.lang.String oldName, java.lang.String newName)
          Convenient method to change the style names of child components within the specified container.
static void setChildrenOpaque(java.awt.Container container, boolean opaque)
          Convenient method to change opaqueness for a component child components.
static void setDefaultsCompatibilityMode(boolean value)
          Setter for defaultsCompatibilityMode.
static void setExtendedFileChooserEnabled(boolean value)
          Setter for extendedFileChooser option.
static void setFont(java.awt.Font font)
          Setter for default font - respects scale factor UI-property.
static void setFont(java.awt.Font font, boolean respectScaleFactor)
          Setter for default font.
static void setFont(java.lang.String name, int size)
          Override the xml default font with the specified.
static void setLookAndFeel(java.lang.String lookAndFeelClassName)
          Convenient method for setting a look and feel.
static void setLookAndFeel(java.lang.String lookAndFeelClassName, boolean antiAlias, boolean useScreenMenuBar)
          Convenient method for setting a look and feel.
static void setRememberFileChooserPreferences(boolean value)
          Setter for rememberFileChooserPreferences option.
static void setToolbarSeparatorDimension(java.awt.Dimension dim)
          Setter for toolbar separator dimension.
static void setUseSystemFileIcons(boolean value)
          Setter for useSystemFileIcons.
static void setWindowOpaque(java.awt.Window w, boolean opaque)
          Helper method to modify window opacity.
static void setWindowsDecorated(boolean decorated)
          Setter for decorated windows.
protected  boolean shouldUpdateStyleOnEvent(java.beans.PropertyChangeEvent evt)
           
 void uninitialize()
          Override the LAF#uninitialize method to uninstall Synthetica's component settings and defaults.
static void updateWindowShape(java.awt.Window w)
          Helper method to modify window shape.
static java.awt.Rectangle validateWindowBounds(java.awt.Rectangle windowBounds)
          Checks if the specified window bounds are valid for the current environment (i.e. multi-screen).
static boolean windowIsFullScreen(java.awt.Window w)
           
 
Methods inherited from class javax.swing.plaf.synth.SynthLookAndFeel
createUI, getRegion, getStyle, getStyleFactory, isNativeLookAndFeel, isSupportedLookAndFeel, load, load, setStyleFactory, shouldUpdateStyleOnAncestorChanged, updateStyles
 
Methods inherited from class javax.swing.plaf.basic.BasicLookAndFeel
createAudioAction, getAudioActionMap, initClassDefaults, initComponentDefaults, initSystemColorDefaults, loadSystemColors, playSound
 
Methods inherited from class javax.swing.LookAndFeel
getDesktopPropertyValue, getDisabledSelectedIcon, getLayoutStyle, installBorder, installColors, installColorsAndFont, installProperty, loadKeyBindings, makeComponentInputMap, makeIcon, makeInputMap, makeKeyBindings, provideErrorFeedback, toString, uninstallBorder
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

logger

public static final java.util.logging.Logger logger
Constructor Detail

SyntheticaLookAndFeel

public SyntheticaLookAndFeel()
                      throws java.text.ParseException
Constructor.

Throws:
java.text.ParseException

SyntheticaLookAndFeel

public SyntheticaLookAndFeel(java.lang.String fileName)
                      throws java.text.ParseException
Constructor.

Parameters:
fileName - Name of XML file with relative path to this package, or absolute path.
Throws:
java.text.ParseException
Method Detail

getConfigFileName

public java.lang.String getConfigFileName()
Returns the XML file name which was used to initialize this LAF.


loadCustomXML

protected void loadCustomXML()
                      throws java.text.ParseException
Override to load custom config files via loadXMLConfig(String)

Throws:
java.text.ParseException

loadAddonsXMLConfig

protected void loadAddonsXMLConfig(java.lang.String path)
                            throws java.text.ParseException
Load addons XML configuration files.

Throws:
java.text.ParseException

loadXMLConfig

protected void loadXMLConfig(java.lang.String fileName)
                      throws java.text.ParseException
Loads XML configuration file. In case that file name is a path/package all XML files from the path/package will be loaded.

Parameters:
fileName - Name of XML file with relative path to this package, or absolute path.
Throws:
java.text.ParseException

getID

public abstract java.lang.String getID()
Overrides:
getID in class javax.swing.plaf.synth.SynthLookAndFeel

getName

public abstract java.lang.String getName()
Overrides:
getName in class javax.swing.plaf.synth.SynthLookAndFeel

getDescription

public java.lang.String getDescription()
Overrides:
getDescription in class javax.swing.plaf.synth.SynthLookAndFeel

getVersion

public IVersion getVersion()
Returns version info of the currently active Synthetica theme.

See Also:
getSyntheticaVersion()

getSupportsWindowDecorations

public boolean getSupportsWindowDecorations()
Overrides:
getSupportsWindowDecorations in class javax.swing.LookAndFeel

getDefaults

public javax.swing.UIDefaults getDefaults()
Overwrites the LAF#getDefaults method to set the metal FileChooserUI for Synthetica.

Overrides:
getDefaults in class javax.swing.plaf.synth.SynthLookAndFeel

initialize

public void initialize()
Overwrites the LAF#initialize method to install Synthetica's styleFactory and popupFactory.

Overrides:
initialize in class javax.swing.plaf.synth.SynthLookAndFeel

installSyntheticaDefaults

protected void installSyntheticaDefaults()

installCompatibilityDefaults

protected void installCompatibilityDefaults()
Some applications need certain DefaultProperties to initialize their own components. For compatiblity use most properties from the BasicLookAndFeel.


uninitialize

public void uninitialize()
Override the LAF#uninitialize method to uninstall Synthetica's component settings and defaults.

Overrides:
uninitialize in class javax.swing.plaf.synth.SynthLookAndFeel

shouldUpdateStyleOnEvent

protected boolean shouldUpdateStyleOnEvent(java.beans.PropertyChangeEvent evt)

createContext

public static javax.swing.plaf.synth.SynthContext createContext(javax.swing.JComponent c,
                                                                javax.swing.plaf.synth.Region region,
                                                                int state)

setFont

public static void setFont(java.lang.String name,
                           int size)
Override the xml default font with the specified.

Parameters:
name - the font name
size - the font size

setFont

public static void setFont(java.awt.Font font)
Setter for default font - respects scale factor UI-property.

Since:
V2.10
See Also:
setFont(Font, boolean)

setFont

public static void setFont(java.awt.Font font,
                           boolean respectScaleFactor)
Setter for default font.

Since:
V2.12.1

getFont

public static java.awt.Font getFont()
Getter for default font.

Since:
V2.10

getFontName

public static java.lang.String getFontName()
Getter for fontName.


getFontSize

public static int getFontSize()
Getter for fontSize.


getAntiAliasEnabled

public static boolean getAntiAliasEnabled()
Getter for anti-alias.


setAntiAliasEnabled

public static void setAntiAliasEnabled(boolean value)
Setter for anti-alias. Can be used to force anti-alias for text painting. Note: Does not work for text components (JTextField, JEditorPane, JTextPane). In most cases it's better to use setLookAndFeel(String, boolean, boolean) instead.

See Also:
setLookAndFeel(String, boolean, boolean)

setWindowsDecorated

public static void setWindowsDecorated(boolean decorated)
Setter for decorated windows.


getExtendedFileChooserEnabled

public static boolean getExtendedFileChooserEnabled()
Getter for extendedFileChooser option.


setExtendedFileChooserEnabled

public static void setExtendedFileChooserEnabled(boolean value)
Setter for extendedFileChooser option.


getDisabledIcon

public javax.swing.Icon getDisabledIcon(javax.swing.JComponent c,
                                        javax.swing.Icon icon)
Overrides:
getDisabledIcon in class javax.swing.LookAndFeel

getRememberFileChooserPreferences

public static boolean getRememberFileChooserPreferences()
Getter for rememberFileChooserPreferences option.


setRememberFileChooserPreferences

public static void setRememberFileChooserPreferences(boolean value)
Setter for rememberFileChooserPreferences option.


getUseSystemFileIcons

public static boolean getUseSystemFileIcons()
Getter for useSystemFileIcons.


setUseSystemFileIcons

public static void setUseSystemFileIcons(boolean value)
Setter for useSystemFileIcons.


setDefaultsCompatibilityMode

public static void setDefaultsCompatibilityMode(boolean value)
Setter for defaultsCompatibilityMode.


getDefaultsCompatibilityMode

public static boolean getDefaultsCompatibilityMode()
Getter for defaultsCompatibilityMode option.


setToolbarSeparatorDimension

public static void setToolbarSeparatorDimension(java.awt.Dimension dim)
Setter for toolbar separator dimension.


getToolbarSeparatorDimension

public static java.awt.Dimension getToolbarSeparatorDimension()
Getter for toolbar separator dimension.


getSyntheticaVersion

public IVersion getSyntheticaVersion()
Returns Synthetica's core version information.

See Also:
getVersion()

getStyleName

public static java.lang.String getStyleName(java.awt.Component c)
Static utility methods.


getJVMCompatibilityMode

public static SyntheticaLookAndFeel.JVMCompatibilityMode getJVMCompatibilityMode()
Returns the active JVM compatibility mode used by Synthetica. If no mode is set JVMCompatibilityMode.SUN is used by default.

Returns:
The current mode.

getClientProperty

public static <T> T getClientProperty(java.lang.String key,
                                      javax.swing.JComponent c,
                                      T defaultValue)
Returns client property value of the specified component.

Parameters:
key - Client property key.
c - The component.
defaultValue - Default value if key does not exist.
See Also:
JComponent.getClientProperty(Object)

loadIcon

public static javax.swing.Icon loadIcon(java.lang.String key)
Loads an icon by UI property key. The related object can be a path to the image icon resource or an icon classname.

Parameters:
key - The UI-key.
Returns:
The icon.

loadIcon

public static javax.swing.Icon loadIcon(java.lang.String key,
                                        java.awt.Component c)
Loads an icon by UI property key. The related object can be a path to the image icon resource or an icon classname.

Parameters:
key - The UI-key.
c - The relevant component.
Returns:
The icon.

get

public static java.lang.Object get(java.lang.String propertyKey,
                                   java.lang.String propertyName,
                                   java.lang.String componentName,
                                   boolean fallback)
Checks UIManager for the created DefaultsProperty. The created DefaultsProperty key has the following syntax: Synthetica.propertyKey.[propertyName].[componentName] PropertyName and componentName are optional values and can be null. The propertyKey should not include the "Synthetica." prefix and can contain multiple dot-delimited subregions which will be checked for configured values until a valid value is found. This fallback-mechanism is helpful to keep configuration files small.
Example for propertyKey "focus.tabbedPaneTab.top" and propertyName "insets": First of all the method tries to get the DefaultsProperty for the key "Synthetica.focus.tabbedPaneTab.top.insets" - if no Value is configured "Synthetica.focus.tabbedPaneTab.insets" is tried - if this key also fails "Synthetica.focus.insets" is tried. After trying all hirarchies of the propertyKey without finding a value the method will return null.

Parameters:
propertyKey - Component specific property key without "Synthetica." prefix, e.g. "button", "checkBox", "focus.button".
propertyName - Name of the wanted property e.g. "insets", "animation.delay". Can be null.
componentName - Name of the component. Can be null.
fallback - Check propertyKey hierarchy for valid values.
See Also:
UIManager.get(Object key)

getString

public static java.lang.String getString(java.lang.String propertyKey,
                                         java.lang.String propertyName,
                                         java.lang.String componentName,
                                         boolean fallback)

getInsets

public static java.awt.Insets getInsets(java.lang.String propertyKey,
                                        java.lang.String propertyName,
                                        java.lang.String componentName,
                                        boolean fallback)

getInt

public static int getInt(java.lang.String propertyKey,
                         java.lang.String propertyName,
                         java.lang.String componentName,
                         boolean fallback,
                         int defaultValue)

get

public static java.lang.Object get(java.lang.String key,
                                   java.awt.Component c)
Returns an object from the defaults table with respect to components name. The key which will be used for lookup is {key}.{componentName}
If component is null, component has no name or the component has a name and no value is assigned, the value of the unnamed key will be returned (same as UIManager#get()).

See Also:
UIManager.get(Object key), get(String propertyKey, String propertyName, String componentName, boolean fallback)

get

public static java.lang.Object get(java.lang.String key,
                                   java.lang.String name)
Returns an object from the defaults table with respect to component name. The key which will be used for lookup is {key}.{componentName}
If name is null or no value is assigned, the value of the unnamed key will be returned (same as UIManager#get()).

See Also:
UIManager.get(Object key), get(String, Component), get(String propertyKey, String propertyName, String componentName, boolean fallback)

getBoolean

public static boolean getBoolean(java.lang.String key,
                                 java.awt.Component c)
Returns a boolean value from the defaults table in respect of the component name.

See Also:
get(String, Component)

getBoolean

public static boolean getBoolean(java.lang.String key,
                                 java.awt.Component c,
                                 boolean defaultValue)
Returns a boolean value from the defaults table in respect of the component name.

Parameters:
key - Key.
c - Component (name) used for lookup.
defaultValue - Default value if key does not exist.
See Also:
get(String, Component)

getInt

public static int getInt(java.lang.String key,
                         java.awt.Component c)
Returns an int value from the defaults table in respect of the component name.

See Also:
get(String, Component)

getInt

public static int getInt(java.lang.String key,
                         java.awt.Component c,
                         int defaultValue)
Returns an int value from the defaults table in respect of the component name.

Parameters:
key - Key.
c - Component (name) used for lookup.
defaultValue - Default value if key does not exist.
See Also:
get(String, Component)

getDim

public static java.awt.Dimension getDim(java.lang.String key,
                                        java.awt.Component c)
Returns Dimension from the defaults table in respect of the component name.

See Also:
get(String, Component)

getDim

public static java.awt.Dimension getDim(java.lang.String key,
                                        java.awt.Component c,
                                        java.awt.Dimension defaultValue)
Returns Dimension from the defaults table in respect of the component name.

Parameters:
key - Key.
c - Component (name) used for lookup.
defaultValue - Default value if key does not exist.
See Also:
get(String, Component)

getInsets

public static java.awt.Insets getInsets(java.lang.String key,
                                        java.awt.Component c)
Returns an insets object from the defaults table in respect of the component name.

See Also:
get(String, Component)

getInsets

public static java.awt.Insets getInsets(java.lang.String key,
                                        java.awt.Component c,
                                        boolean nullAllowed)
Returns an insets object from the defaults table in respect of the component name.

Parameters:
key - Key.
c - Component (name) used for lookup.
nullAllowed - False means do not return null if corresponding key object doesn't exist - instead a new Insets object (0,0,0,0) will be returned.
See Also:
get(String, Component)

getInsets

public static java.awt.Insets getInsets(java.lang.String key,
                                        java.awt.Component c,
                                        java.awt.Insets defaultValue)
Returns an insets object from the defaults table in respect of the component name.

Parameters:
key - Key.
c - Component (name) used for lookup.
defaultValue - Default value if key does not exist.

getString

public static java.lang.String getString(java.lang.String key,
                                         java.awt.Component c)
Returns a string object from the defaults table in respect of the component name.

See Also:
get(String, Component)

getColor

public static java.awt.Color getColor(java.lang.String key,
                                      java.awt.Component c)
Returns a color object from the defaults table in respect of the component name.

See Also:
get(String, Component)

getColor

public static java.awt.Color getColor(java.lang.String key,
                                      java.awt.Component c,
                                      java.awt.Color defaultColor)
Returns a color object from the defaults table in respect of the component name.

Parameters:
key - Key.
c - Component (name) used for lookup.
defaultColor - Default value if key does not exist.
See Also:
get(String, Component)

getIcon

public static javax.swing.Icon getIcon(java.lang.String key,
                                       java.awt.Component c)
Returns an icon object from the defaults table in respect of the component name.

See Also:
get(String, Component)

isToplevelPopupMenu

public static boolean isToplevelPopupMenu(javax.swing.JPopupMenu popup)
Returns true if toplevel popup menu handling is enabled and the invoker is a toplevel JMenu (or marked by client property "Synthetica.menu.toplevel") or popup is marked as toplevel popup by client property "Synthetica.popupMenu.toplevel".

Parameters:
popup - The popup menu.
Returns:
True - means, is toplevel popup menu.

findOpaqueParentOfClass

public static <T extends javax.swing.JComponent> T findOpaqueParentOfClass(java.lang.Class<T> clazz,
                                                                           java.awt.Container c,
                                                                           boolean respectOpacity)
Returns the first opaque ancestor of the given type. The method checks Synthetica's paint opacity and additionally Swing opacity if the repectOpacity parameter is true. The method returns null, if ancestor is opauqe

Parameters:
clazz - The requested parent class type
c - The container
respectOpacity - Additionally check Swing opacity
Returns:
The first found opaque ancestor.

isOpaque

public static boolean isOpaque(javax.swing.JComponent c)
Convenient method to check Synthetica component opacity ("Synthetica.opaque" key) with respect of "Synthetica.textComponents.useSwingOpaqueness". If none of the keys is set or c is null, true will be returned as default.

Parameters:
c - JComponent to check for opacity.
Returns:
true - Treat component as opaque.

setChildrenOpaque

public static void setChildrenOpaque(java.awt.Container container,
                                     boolean opaque)
Convenient method to change opaqueness for a component child components.

Parameters:
container - Used container or JComponent.
opaque - true - set child components to opaque.

validateWindowBounds

public static java.awt.Rectangle validateWindowBounds(java.awt.Rectangle windowBounds)
Checks if the specified window bounds are valid for the current environment (i.e. multi-screen). In case that specified bounds are out of the screen, the corrected bounds will be returned.

Parameters:
windowBounds - bounds to validate
Returns:
Validated window bounds
Since:
V2.13.0

isWindowOpacityEnabled

public static boolean isWindowOpacityEnabled(java.awt.Window w)
Helper method to check if window opacity support "Synthetica.window.opaque" is enabled/disabled.

Parameters:
w - Window to check for opacity.
Returns:
true - means opaque

setWindowOpaque

public static void setWindowOpaque(java.awt.Window w,
                                   boolean opaque)
Helper method to modify window opacity.

Parameters:
w - Window.
opaque - False means translucent.

isWindowShapeEnabled

public static boolean isWindowShapeEnabled(java.awt.Window w)
Helper method to check if window shape "Synthetica.window.shape" is enabled/disabled.

Parameters:
w - Window to check for shape.
Returns:
true - means shape usage is enabled

isWindowShapeSupported

public static boolean isWindowShapeSupported(java.awt.Window w)
Helper method to check if window shape support is provided by the JVM.

Parameters:
w - Window to check for shape.
Returns:
true - means shape support is enabled

updateWindowShape

public static void updateWindowShape(java.awt.Window w)
Helper method to modify window shape.

Parameters:
w - Window.

windowIsFullScreen

public static boolean windowIsFullScreen(java.awt.Window w)

isSystemPropertySet

public static boolean isSystemPropertySet(java.lang.String systemPropertyName)

isSystemPropertySet

public static boolean isSystemPropertySet(java.lang.String systemPropertyName,
                                          java.lang.String value)

scaleFontSize

public static float scaleFontSize(float fontSize)
Calculates environment dependent font size - i. e. to respect current screen resolution.

Parameters:
fontSize - The regular font size.
Returns:
Screen resolution related font size.

setChildrenName

public static void setChildrenName(java.awt.Container container,
                                   java.lang.String oldName,
                                   java.lang.String newName)
Convenient method to change the style names of child components within the specified container. This method can only be used for components with an already existing component name.

Parameters:
container - Used container or JComponent.
oldName - Current name of the component.
newName - New component name.

findComponent

public static java.awt.Component findComponent(java.lang.String name,
                                               java.awt.Container container)
Convenient method to find a child component within the specified container.

Parameters:
name - Style name of the component.
container - Used container or JComponent.
Returns:
The first found compononent or null if nothing could be found.

findComponent

public static java.awt.Component findComponent(java.lang.Class<?> childClass,
                                               java.awt.Container container)
Convenient method to find a child component within the specified container.

Parameters:
childClass - Class of the searched child component.
container - Used container or JComponent.
Returns:
The first found compononent or null if no child could be found.

findComponents

public static <T extends java.awt.Component> java.util.List<T> findComponents(java.lang.String name,
                                                                              java.awt.Container container,
                                                                              java.util.List<T> components)
Convenient method to find all child components within the specified container.

Parameters:
name - Style name of the components to search for.
container - Used container or JComponent.
components - Resultlist used to return found components.

findComponents

public static <T extends java.awt.Component> java.util.List<T> findComponents(java.lang.Class<T> childClass,
                                                                              java.awt.Container container,
                                                                              java.util.List<T> components)
Convenient method to find all child components within the specified container.

Parameters:
childClass - Class of the searched child component.
container - Used container or JComponent.
components - Resultlist used to return found components.
Since:
V2.7.0

findDefaultBorder

public static javax.swing.border.Border findDefaultBorder(javax.swing.border.Border b)
Convenient method to check if a border contains a default (UIResource) border.

Parameters:
b - Border to check for SynthBorder existance.
Returns:
synth border or null if no synth border exists
Since:
V2.7.0

preservePopupIconSpace

public static boolean preservePopupIconSpace(javax.swing.JPopupMenu popup)
Retruns true if a popup requires some extra space because of icon usage. If UI-property "Synthetica.popupMenu.forceIconSpace" is set to true this method will always return true.

Parameters:
popup - Popup menu.
Returns:
True - popup contains items with icons.
Since:
V2.15.0

popupHasIcons

public static boolean popupHasIcons(javax.swing.JPopupMenu popup)
Convenient method to check if a popupMenu contains menuItems with icons.

Parameters:
popup - Popup menu.
Returns:
True - popup contains items with icons.

popupHasCheckRadio

public static boolean popupHasCheckRadio(javax.swing.JPopupMenu popup)
Convenient method to check if a popupMenu contains checkBox or radioButton menuItems.

Parameters:
popup - Popup menu.
Returns:
True - popup contains checkBox or radioButton menuItems.

popupHasCheckRadioWithIcon

public static boolean popupHasCheckRadioWithIcon(javax.swing.JPopupMenu popup)
Convenient method to check if a popupMenu contains checkBox or radioButton menuItems with icon.

Parameters:
popup - Popup menu.
Returns:
True - popup contains checkBox or radioButton menuItems with icon.

createLinearGradientPaint

public static java.awt.Paint createLinearGradientPaint(float startX,
                                                       float startY,
                                                       float endX,
                                                       float endY,
                                                       float[] fractions,
                                                       java.awt.Color[] colors)
Convenient method to create a LinearGradientPaint for Java 1.5 and Java 6. Makes use of the synthetica-batik.jar library - Java 1.5 only.

Since:
V2.8.0

setLookAndFeel

public static void setLookAndFeel(java.lang.String lookAndFeelClassName)
Convenient method for setting a look and feel. Anti-alias for text rendering (Java 1.5) and usage of screenMenuBar on Max OSX 10.5 is enabled by default. This method can be used instead of UIManager.setLookAndFeel(String).

Parameters:
lookAndFeelClassName - Class name of the look and feel to be set.
Since:
V2.7.0
See Also:
setLookAndFeel(String, boolean, boolean)

setLookAndFeel

public static void setLookAndFeel(java.lang.String lookAndFeelClassName,
                                  boolean antiAlias,
                                  boolean useScreenMenuBar)
Convenient method for setting a look and feel. This method can be used instead of UIManager.setLookAndFeel(String).

Parameters:
lookAndFeelClassName - Class name of the look and feel to be set.
antiAlias - True means enable anti-alias by System property "swing.aatext". Note: this works only with Java 1.5 with Java 6 the Desktop settings will be used to enable anti-aliasing.
useScreenMenuBar - Enables usage of the screenMenuBar on Mac OSX 10.5 (Leopard). Note: the screenMenuBar feature does not work on Mac OSX 10.4.
Since:
V2.7.0


Copyright © 2004-2011 Jyloo Software. All Rights Reserved.