FileDocCategorySizeDatePackage
Region.javaAPI DocJava SE 5 API19284Fri Aug 26 14:58:10 BST 2005javax.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"/>
version
1.30, 02/19/04
since
1.5
author
Scott Violet

Fields Summary
private static final Map
uiToRegionMap
private static final Map
lowerCaseNameMap
public static final Region
ARROW_BUTTON
ArrowButton's are special types of buttons that also render a directional indicator, typically an arrow. ArrowButtons are used by composite components, for example ScrollBar's contain ArrowButtons. To bind a style to this Region use the name ArrowButton.
public static final Region
BUTTON
Button region. To bind a style to this Region use the name Button.
public static final Region
CHECK_BOX
CheckBox region. To bind a style to this Region use the name CheckBox.
public static final Region
CHECK_BOX_MENU_ITEM
CheckBoxMenuItem region. To bind a style to this Region use the name CheckBoxMenuItem.
public static final Region
COLOR_CHOOSER
ColorChooser region. To bind a style to this Region use the name ColorChooser.
public static final Region
COMBO_BOX
ComboBox region. To bind a style to this Region use the name ComboBox.
public static final Region
DESKTOP_PANE
DesktopPane region. To bind a style to this Region use the name DesktopPane.
public static final Region
DESKTOP_ICON
DesktopIcon region. To bind a style to this Region use the name DesktopIcon.
public static final Region
EDITOR_PANE
EditorPane region. To bind a style to this Region use the name EditorPane.
public static final Region
FILE_CHOOSER
FileChooser region. To bind a style to this Region use the name FileChooser.
public static final Region
FORMATTED_TEXT_FIELD
FormattedTextField region. To bind a style to this Region use the name FormattedTextField.
public static final Region
INTERNAL_FRAME
InternalFrame region. To bind a style to this Region use the name InternalFrame.
public static final Region
INTERNAL_FRAME_TITLE_PANE
TitlePane of an InternalFrame. The TitlePane typically shows a menu, title, widgets to manipulate the internal frame. To bind a style to this Region use the name InternalFrameTitlePane.
public static final Region
LABEL
Label region. To bind a style to this Region use the name Label.
public static final Region
LIST
List region. To bind a style to this Region use the name List.
public static final Region
MENU
Menu region. To bind a style to this Region use the name Menu.
public static final Region
MENU_BAR
MenuBar region. To bind a style to this Region use the name MenuBar.
public static final Region
MENU_ITEM
MenuItem region. To bind a style to this Region use the name MenuItem.
public static final Region
MENU_ITEM_ACCELERATOR
Accelerator region of a MenuItem. To bind a style to this Region use the name MenuItemAccelerator.
public static final Region
OPTION_PANE
OptionPane region. To bind a style to this Region use the name OptionPane.
public static final Region
PANEL
Panel region. To bind a style to this Region use the name Panel.
public static final Region
PASSWORD_FIELD
PasswordField region. To bind a style to this Region use the name PasswordField.
public static final Region
POPUP_MENU
PopupMenu region. To bind a style to this Region use the name PopupMenu.
public static final Region
POPUP_MENU_SEPARATOR
PopupMenuSeparator region. To bind a style to this Region use the name PopupMenuSeparator.
public static final Region
PROGRESS_BAR
ProgressBar region. To bind a style to this Region use the name ProgressBar.
public static final Region
RADIO_BUTTON
RadioButton region. To bind a style to this Region use the name RadioButton.
public static final Region
RADIO_BUTTON_MENU_ITEM
RegionButtonMenuItem region. To bind a style to this Region use the name RadioButtonMenuItem.
public static final Region
ROOT_PANE
RootPane region. To bind a style to this Region use the name RootPane.
public static final Region
SCROLL_BAR
ScrollBar region. To bind a style to this Region use the name ScrollBar.
public static final Region
SCROLL_BAR_TRACK
Track of the ScrollBar. To bind a style to this Region use the name ScrollBarTrack.
public static final Region
SCROLL_BAR_THUMB
Thumb of the ScrollBar. The thumb is the region of the ScrollBar that gives a graphical depiction of what percentage of the View is currently visible. To bind a style to this Region use the name ScrollBarThumb.
public static final Region
SCROLL_PANE
ScrollPane region. To bind a style to this Region use the name ScrollPane.
public static final Region
SEPARATOR
Separator region. To bind a style to this Region use the name Separator.
public static final Region
SLIDER
Slider region. To bind a style to this Region use the name Slider.
public static final Region
SLIDER_TRACK
Track of the Slider. To bind a style to this Region use the name SliderTrack.
public static final Region
SLIDER_THUMB
Thumb of the Slider. The thumb of the Slider identifies the current value. To bind a style to this Region use the name SliderThumb.
public static final Region
SPINNER
Spinner region. To bind a style to this Region use the name Spinner.
public static final Region
SPLIT_PANE
SplitPane region. To bind a style to this Region use the name SplitPane.
public static final Region
SPLIT_PANE_DIVIDER
Divider of the SplitPane. To bind a style to this Region use the name SplitPaneDivider.
public static final Region
TABBED_PANE
TabbedPane region. To bind a style to this Region use the name TabbedPane.
public static final Region
TABBED_PANE_TAB
Region of a TabbedPane for one tab. To bind a style to this Region use the name TabbedPaneTab.
public static final Region
TABBED_PANE_TAB_AREA
Region of a TabbedPane containing the tabs. To bind a style to this Region use the name TabbedPaneTabArea.
public static final Region
TABBED_PANE_CONTENT
Region of a TabbedPane containing the content. To bind a style to this Region use the name TabbedPaneContent.
public static final Region
TABLE
Table region. To bind a style to this Region use the name Table.
public static final Region
TABLE_HEADER
TableHeader region. To bind a style to this Region use the name TableHeader.
public static final Region
TEXT_AREA
TextArea region. To bind a style to this Region use the name TextArea.
public static final Region
TEXT_FIELD
TextField region. To bind a style to this Region use the name TextField.
public static final Region
TEXT_PANE
TextPane region. To bind a style to this Region use the name TextPane.
public static final Region
TOGGLE_BUTTON
ToggleButton region. To bind a style to this Region use the name ToggleButton.
public static final Region
TOOL_BAR
ToolBar region. To bind a style to this Region use the name ToolBar.
public static final Region
TOOL_BAR_CONTENT
Region of the ToolBar containing the content. To bind a style to this Region use the name ToolBarContent.
public static final Region
TOOL_BAR_DRAG_WINDOW
Region for the Window containing the ToolBar. To bind a style to this Region use the name ToolBarDragWindow.
public static final Region
TOOL_TIP
ToolTip region. To bind a style to this Region use the name ToolTip.
public static final Region
TOOL_BAR_SEPARATOR
ToolBar separator region. To bind a style to this Region use the name ToolBarSeparator.
public static final Region
TREE
Tree region. To bind a style to this Region use the name Tree.
public static final Region
TREE_CELL
Region of the Tree for one cell. To bind a style to this Region use the name TreeCell.
public static final Region
VIEWPORT
Viewport region. To bind a style to this Region use the name Viewport.
private String
name
private boolean
subregion
Constructors Summary
Region(String name)

        this(name, null, true);
    
Region(String name, String ui)

        this(name, ui, false);
    
protected Region(String name, String ui, boolean subregion)
Creates a Region with the specified name. This should only be used if you are creating your own JComponent subclass with a custom ComponentUI class.

param
name Name of the region
param
ui String that will be returned from component.getUIClassID. This will be null if this is a subregion.
param
subregion Whether or not this is a subregion.

        if (name == null) {
            throw new NullPointerException("You must specify a non-null name");
        }
        this.name = name;
        if (ui != null) {
            uiToRegionMap.put(ui, this);
        }
        this.subregion = subregion;
    
Methods Summary
java.lang.StringgetLowerCaseName()
Returns the name, in lowercase.

        synchronized(lowerCaseNameMap) {
            String lowerCaseName = (String)lowerCaseNameMap.get(this);
            if (lowerCaseName == null) {
                lowerCaseName = getName().toLowerCase();
                lowerCaseNameMap.put(this, lowerCaseName);
            }
            return lowerCaseName;
        }
    
public java.lang.StringgetName()
Returns the name of the region.

return
name of the Region.

        return name;
    
static javax.swing.plaf.synth.RegiongetRegion(javax.swing.JComponent c)



        
        return (Region)uiToRegionMap.get(c.getUIClassID());
    
public booleanisSubregion()
Returns true if the Region is a subregion of a Component, otherwise false. For example, Region.BUTTON corresponds do a Component so that Region.BUTTON.isSubregion() returns false.

return
true if the Region is a subregion of a Component.

        return subregion;
    
static voidregisterUIs(javax.swing.UIDefaults table)

        Iterator uis = uiToRegionMap.keySet().iterator();

        while (uis.hasNext()) {
            Object key = uis.next();

            table.put(key, "javax.swing.plaf.synth.SynthLookAndFeel");
        }
    
public java.lang.StringtoString()
Returns the name of the Region.

return
name of the Region.

        return name;