Module java.desktop

Class Region

java.lang.Object
javax.swing.plaf.synth.Region

public class Region extends Object
A distinct rendering area of a Swing component. A component may support one or more regions. Specific component regions are defined by the typesafe enumeration in this class.

Regions are typically used as a way to identify the Components and areas a particular style is to apply to. Synth's file format allows you to bind styles based on the name of a Region. The name is derived from the field name of the constant:

  1. Map all characters to lowercase.
  2. Map the first character to uppercase.
  3. Map the first character after underscores to uppercase.
  4. Remove all underscores.
For example, to identify the SPLIT_PANE Region you would use SplitPane. The following shows a custom SynthStyleFactory that returns a specific style for split panes:
    public SynthStyle getStyle(JComponent c, Region id) {
        if (id == Region.SPLIT_PANE) {
            return splitPaneStyle;
        }
        ...
    }
 
The following xml accomplishes the same thing:
 <style id="splitPaneStyle">
   ...
 </style>
 <bind style="splitPaneStyle" type="region" key="SplitPane"/>
 

Since:
1.5