Home » openjdk-7 » javax » swing » plaf » synth » [javadoc | source]
public class: SynthLookAndFeel [javadoc | source]

All Implemented Interfaces:

Direct Known Subclasses:

SynthLookAndFeel provides the basis for creating a customized look and feel. SynthLookAndFeel does not directly provide a look, all painting is delegated. You need to either provide a configuration file, by way of the #load method, or provide your own SynthStyleFactory to #setStyleFactory . Refer to the package summary for an example of loading a file, and javax.swing.plaf.synth.SynthStyleFactory for an example of providing your own SynthStyleFactory to setStyleFactory.

Warning: This class implements Serializable as a side effect of it extending BasicLookAndFeel . It is not intended to be serialized. An attempt to serialize it will result in NotSerializableException .

Field Summary
static final  Insets EMPTY_UIRESOURCE_INSETS    Used in a handful of places where we need an empty Insets. 
static  ComponentUI selectedUI     
static  int selectedUIState     
Fields inherited from javax.swing.plaf.basic.BasicLookAndFeel:
needsEventHelper,  invocator
 public SynthLookAndFeel() 
Method from javax.swing.plaf.synth.SynthLookAndFeel Summary:
createUI,   getComponentState,   getDefaults,   getDescription,   getID,   getName,   getPaintingInsets,   getRegion,   getStyle,   getStyleFactory,   getUIOfType,   initialize,   isLeftToRight,   isNativeLookAndFeel,   isSupportedLookAndFeel,   load,   load,   resetSelectedUI,   setSelectedUI,   setStyleFactory,   shouldUpdateStyle,   shouldUpdateStyleOnAncestorChanged,   shouldUpdateStyleOnEvent,   uninitialize,   update,   updateStyle,   updateStyles,   updateSubregion
Methods from javax.swing.plaf.basic.BasicLookAndFeel:
createAudioAction,   getAudioActionMap,   getDefaults,   getUIOfType,   initClassDefaults,   initComponentDefaults,   initSystemColorDefaults,   initialize,   installAWTEventListener,   installAudioActionMap,   loadSystemColors,   playSound,   playSound,   uninitialize
Methods from javax.swing.LookAndFeel:
getDefaults,   getDescription,   getDesktopPropertyValue,   getDisabledIcon,   getDisabledSelectedIcon,   getID,   getLayoutStyle,   getName,   getSupportsWindowDecorations,   initialize,   installBorder,   installColors,   installColorsAndFont,   installProperty,   isNativeLookAndFeel,   isSupportedLookAndFeel,   loadKeyBindings,   makeComponentInputMap,   makeIcon,   makeInputMap,   makeKeyBindings,   provideErrorFeedback,   toString,   uninitialize,   uninstallBorder
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from javax.swing.plaf.synth.SynthLookAndFeel Detail:
 public static ComponentUI createUI(JComponent c) 
    Creates the Synth look and feel ComponentUI for the passed in JComponent.
 static int getComponentState(Component c) 
    Returns the component state for the specified component. This should only be used for Components that don't have any special state beyond that of ENABLED, DISABLED or FOCUSED. For example, buttons shouldn't call into this method.
 public UIDefaults getDefaults() 
    Returns the defaults for this SynthLookAndFeel.
 public String getDescription() 
    Returns a textual description of SynthLookAndFeel.
 public String getID() 
    Return a string that identifies this look and feel.
 public String getName() 
    Return a short string that identifies this look and feel.
 static Insets getPaintingInsets(SynthContext state,
    Insets insets) 
    A convenience method to return where the foreground should be painted for the Component identified by the passed in AbstractSynthContext.
 public static Region getRegion(JComponent c) 
    Returns the Region for the JComponent c.
 public static SynthStyle getStyle(JComponent c,
    Region region) 
    Gets a SynthStyle for the specified region of the specified component. This is not for general consumption, only custom UIs should call this method.
 public static SynthStyleFactory getStyleFactory() 
    Returns the current SynthStyleFactory.
 static Object getUIOfType(ComponentUI ui,
    Class klass) 
    Returns the ui that is of type klass, or null if one can not be found.
 public  void initialize() 
    Called by UIManager when this look and feel is installed.
 static boolean isLeftToRight(Component c) 
 public boolean isNativeLookAndFeel() 
    Returns false, SynthLookAndFeel is not a native look and feel.
 public boolean isSupportedLookAndFeel() 
    Returns true, SynthLookAndFeel is always supported.
 public  void load(URL url) throws ParseException, IOException 
    Loads the set of SynthStyles that will be used by this SynthLookAndFeel. Path based resources are resolved relatively to the specified URL of the style. For example an Image would be resolved by new URL(synthFile, path). Refer to Synth File Format for more information.
 public  void load(InputStream input,
    Class<?> resourceBase) throws ParseException 
    Loads the set of SynthStyles that will be used by this SynthLookAndFeel. resourceBase is used to resolve any path based resources, for example an Image would be resolved by resourceBase.getResource(path). Refer to Synth File Format for more information.
 static  void resetSelectedUI() 
    Clears out the selected UI that was last set in setSelectedUI.
 static  void setSelectedUI(ComponentUI uix,
    boolean selected,
    boolean focused,
    boolean enabled,
    boolean rollover) 
    Used by the renderers. For the most part the renderers are implemented as Labels, which is problematic in so far as they are never selected. To accomodate this SynthLabelUI checks if the current UI matches that of selectedUI (which this methods sets), if it does, then a state as set by this method is returned. This provides a way for labels to have a state other than selected.
 public static  void setStyleFactory(SynthStyleFactory cache) 
    Sets the SynthStyleFactory that the UI classes provided by synth will use to obtain a SynthStyle.
 static boolean shouldUpdateStyle(PropertyChangeEvent event) 
    Returns true if the Style should be updated in response to the specified PropertyChangeEvent. This forwards to shouldUpdateStyleOnAncestorChanged as necessary.
 public boolean shouldUpdateStyleOnAncestorChanged() 
    Returns whether or not the UIs should update their SynthStyles from the SynthStyleFactory when the ancestor of the JComponent changes. A subclass that provided a SynthStyleFactory that based the return value from getStyle off the containment hierarchy would override this method to return true.
 protected boolean shouldUpdateStyleOnEvent(PropertyChangeEvent ev) 
    Returns whether or not the UIs should update their styles when a particular event occurs.
 public  void uninitialize() 
    Called by UIManager when this look and feel is uninstalled.
 static  void update(SynthContext state,
    Graphics g) 
    A convenience method that handles painting of the background. All SynthUI implementations should override update and invoke this method.
 static SynthStyle updateStyle(SynthContext context,
    SynthUI ui) 
    A convience method that will reset the Style of StyleContext if necessary.
 public static  void updateStyles(Component c) 
    Updates the style associated with c, and all its children. This is a lighter version of SwingUtilities.updateComponentTreeUI.
 static  void updateSubregion(SynthContext state,
    Graphics g,
    Rectangle bounds) 
    A convenience method that handles painting of the background for subregions. All SynthUI's that have subregions should invoke this method, than paint the foreground.