JavaTM 2 Platform
Standard Ed. 6

javax.swing.plaf.synth
类 Region

java.lang.Object
  继承者 javax.swing.plaf.synth.Region

public class Region
extends Object

Swing 组件的独特呈现区域。一个组件可以支持一个或多个 region。特定组件 region 由此类中的类型安全枚举定义。

通常使用 region 作为标识将应用特殊样式的 Component 和区域的方法。Synth 的文件格式允许基于 Region 的名称来绑定样式。该名称源自常量的字段名称:

  1. 将所有字符映射为小写字母。
  2. 将第一个字符映射为大写字母。
  3. 将第一个字符加下划线后映射为大写字母。
  4. 移除所有下划线。
例如,要标识 SPLIT_PANE Region,应该使用 SplitPane。以下展示了一个自定义 SynthStyleFactory,它为分隔窗格返回一个特定样式:
    public SynthStyle getStyle(JComponent c, Region id) {
        if (id == Region.SPLIT_PANE) {
            return splitPaneStyle;
        }
        ...
    }
 
以下 xml 实现了相同的目标:
 <style id="splitPaneStyle">
   ...
 </style>
 <bind style="splitPaneStyle" type="region" key="SplitPane"/>
 

从以下版本开始:
1.5

字段摘要
static Region ARROW_BUTTON
          ArrowButton 是特殊类型的按钮,也呈现了一个方向指示器(通常是一个箭头)。
static Region BUTTON
          Button 的 region。
static Region CHECK_BOX
          CheckBox 的 region。
static Region CHECK_BOX_MENU_ITEM
          CheckBoxMenuItem 的 region。
static Region COLOR_CHOOSER
          ColorChooser 的 region。
static Region COMBO_BOX
          ComboBox 的 region。
static Region DESKTOP_ICON
          DesktopIcon 的 region。
static Region DESKTOP_PANE
          DesktopPane 的 region。
static Region EDITOR_PANE
          EditorPane 的 region。
static Region FILE_CHOOSER
          FileChooser 的 region。
static Region FORMATTED_TEXT_FIELD
          FormattedTextField 的 region。
static Region INTERNAL_FRAME
          InternalFrame 的 region。
static Region INTERNAL_FRAME_TITLE_PANE
          InternalFrame 的 TitlePane。
static Region LABEL
          Label 的 region。
static Region LIST
          List 的 region。
static Region MENU
          Menu 的 region。
static Region MENU_BAR
          MenuBar 的 region。
static Region MENU_ITEM
          MenuItem 的 region。
static Region MENU_ITEM_ACCELERATOR
          MenuItem 的加速器 region。
static Region OPTION_PANE
          OptionPane 的 region。
static Region PANEL
          Panel 的 region。
static Region PASSWORD_FIELD
          PasswordField 的 region。
static Region POPUP_MENU
          PopupMenu 的 region。
static Region POPUP_MENU_SEPARATOR
          PopupMenuSeparator 的 region。
static Region PROGRESS_BAR
          ProgressBar 的 region。
static Region RADIO_BUTTON
          RadioButton 的 region。
static Region RADIO_BUTTON_MENU_ITEM
          RegionButtonMenuItem 的 region。
static Region ROOT_PANE
          RootPane 的 region。
static Region SCROLL_BAR
          ScrollBar 的 region。
static Region SCROLL_BAR_THUMB
          ScrollBar 的 thumb。
static Region SCROLL_BAR_TRACK
          ScrollBar 的滑道。
static Region SCROLL_PANE
          ScrollPane 的 region。
static Region SEPARATOR
          Separator 的 region。
static Region SLIDER
          Slider 的 region。
static Region SLIDER_THUMB
          滑块的 thumb。
static Region SLIDER_TRACK
          Slider 的滑道。
static Region SPINNER
          Spinner 的 region。
static Region SPLIT_PANE
          SplitPane 的 region。
static Region SPLIT_PANE_DIVIDER
          SplitPane 的分隔器。
static Region TABBED_PANE
          TabbedPane 的 region。
static Region TABBED_PANE_CONTENT
          包含内容的 TabbedPane 的 region。
static Region TABBED_PANE_TAB
          某一选项卡的 TabbedPane 的 region。
static Region TABBED_PANE_TAB_AREA
          包含选项卡的 TabbedPane 的 region。
static Region TABLE
          Table 的 region。
static Region TABLE_HEADER
          TableHeader 的 region。
static Region TEXT_AREA
          TextArea 的 region。
static Region TEXT_FIELD
          TextField 的 region。
static Region TEXT_PANE
          TextPane 的 region。
static Region TOGGLE_BUTTON
          ToggleButton 的 region。
static Region TOOL_BAR
          ToolBar 的 region。
static Region TOOL_BAR_CONTENT
          包含内容的 ToolBar 的 region。
static Region TOOL_BAR_DRAG_WINDOW
          包含 ToolBar 的 Window 的 region。
static Region TOOL_BAR_SEPARATOR
          ToolBar 分隔器的 region。
static Region TOOL_TIP
          ToolTip 的 region。
static Region TREE
          Tree 的 region。
static Region TREE_CELL
          用于某一单元格的 Tree 的 region。
static Region VIEWPORT
          Viewport 的 region。
 
构造方法摘要
protected Region(String name, String ui, boolean subregion)
          创建具有指定名称的 Region。
 
方法摘要
 String getName()
          返回 region 的名称。
 boolean isSubregion()
          如果 Region 是 Component 的子 region,则返回 true,否则返回 false。
 String toString()
          返回 Region 的名称。
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

字段详细信息

ARROW_BUTTON

public static final Region ARROW_BUTTON
ArrowButton 是特殊类型的按钮,也呈现了一个方向指示器(通常是一个箭头)。ArrowButton 由复合组件使用,例如 ScrollBar 的某些 ArrowButton。要将某一样式绑定到此 Region,使用名称 ArrowButton


BUTTON

public static final Region BUTTON
Button 的 region。要将某一样式绑定到此 Region,使用名称 Button


CHECK_BOX

public static final Region CHECK_BOX
CheckBox 的 region。要将某一样式绑定到此 Region,使用名称 CheckBox


CHECK_BOX_MENU_ITEM

public static final Region CHECK_BOX_MENU_ITEM
CheckBoxMenuItem 的 region。要将某一样式绑定到此 Region,使用名称 CheckBoxMenuItem


COLOR_CHOOSER

public static final Region COLOR_CHOOSER
ColorChooser 的 region。要将某一样式绑定到此 Region,使用名称 ColorChooser


COMBO_BOX

public static final Region COMBO_BOX
ComboBox 的 region。要将某一样式绑定到此 Region,使用名称 ComboBox


DESKTOP_PANE

public static final Region DESKTOP_PANE
DesktopPane 的 region。要将某一样式绑定到此 Region,使用名称 DesktopPane


DESKTOP_ICON

public static final Region DESKTOP_ICON
DesktopIcon 的 region。要将某一样式绑定到此 Region,使用名称 DesktopIcon


EDITOR_PANE

public static final Region EDITOR_PANE
EditorPane 的 region。要将某一样式绑定到此 Region,使用名称 EditorPane


FILE_CHOOSER

public static final Region FILE_CHOOSER
FileChooser 的 region。要将某一样式绑定到此 Region,使用名称 FileChooser


FORMATTED_TEXT_FIELD

public static final Region FORMATTED_TEXT_FIELD
FormattedTextField 的 region。要将某一样式绑定到此 Region,使用名称 FormattedTextField


INTERNAL_FRAME

public static final Region INTERNAL_FRAME
InternalFrame 的 region。要将某一样式绑定到此 Region,使用名称 InternalFrame


INTERNAL_FRAME_TITLE_PANE

public static final Region INTERNAL_FRAME_TITLE_PANE
InternalFrame 的 TitlePane。TitlePane 通常显示操作内部窗体的菜单、标题和窗口小部件。要将某一样式绑定到此 Region,使用名称 InternalFrameTitlePane


LABEL

public static final Region LABEL
Label 的 region。要将某一样式绑定到此 Region,使用名称 Label


LIST

public static final Region LIST
List 的 region。要将某一样式绑定到此 Region,使用名称 List


MENU

public static final Region MENU
Menu 的 region。要将某一样式绑定到此 Region,使用名称 Menu


MENU_BAR

public static final Region MENU_BAR
MenuBar 的 region。要将某一样式绑定到此 Region,使用名称 MenuBar


MENU_ITEM

public static final Region MENU_ITEM
MenuItem 的 region。要将某一样式绑定到此 Region,使用名称 MenuItem


MENU_ITEM_ACCELERATOR

public static final Region MENU_ITEM_ACCELERATOR
MenuItem 的加速器 region。要将某一样式绑定到此 Region,使用名称 MenuItemAccelerator


OPTION_PANE

public static final Region OPTION_PANE
OptionPane 的 region。要将某一样式绑定到此 Region,使用名称 OptionPane


PANEL

public static final Region PANEL
Panel 的 region。要将某一样式绑定到此 Region,使用名称 Panel


PASSWORD_FIELD

public static final Region PASSWORD_FIELD
PasswordField 的 region。要将某一样式绑定到此 Region,使用名称 PasswordField


POPUP_MENU

public static final Region POPUP_MENU
PopupMenu 的 region。要将某一样式绑定到此 Region,使用名称 PopupMenu


POPUP_MENU_SEPARATOR

public static final Region POPUP_MENU_SEPARATOR
PopupMenuSeparator 的 region。要将某一样式绑定到此 Region,使用名称 PopupMenuSeparator


PROGRESS_BAR

public static final Region PROGRESS_BAR
ProgressBar 的 region。要将某一样式绑定到此 Region,使用名称 ProgressBar


RADIO_BUTTON

public static final Region RADIO_BUTTON
RadioButton 的 region。要将某一样式绑定到此 Region,使用名称 RadioButton


RADIO_BUTTON_MENU_ITEM

public static final Region RADIO_BUTTON_MENU_ITEM
RegionButtonMenuItem 的 region。要将某一样式绑定到此 Region,使用名称 RadioButtonMenuItem


ROOT_PANE

public static final Region ROOT_PANE
RootPane 的 region。要将某一样式绑定到此 Region,使用名称 RootPane


SCROLL_BAR

public static final Region SCROLL_BAR
ScrollBar 的 region。要将某一样式绑定到此 Region,使用名称 ScrollBar


SCROLL_BAR_TRACK

public static final Region SCROLL_BAR_TRACK
ScrollBar 的滑道。要将某一样式绑定到此 Region,使用名称 ScrollBarTrack


SCROLL_BAR_THUMB

public static final Region SCROLL_BAR_THUMB
ScrollBar 的 thumb。Thumb 是 ScrollBar 的一个 region,它给出了 View 当前可见百分比的图形描述。要将某一样式绑定到此 Region,使用名称 ScrollBarThumb


SCROLL_PANE

public static final Region SCROLL_PANE
ScrollPane 的 region。要将某一样式绑定到此 Region,使用名称 ScrollPane


SEPARATOR

public static final Region SEPARATOR
Separator 的 region。要将某一样式绑定到此 Region,使用名称 Separator


SLIDER

public static final Region SLIDER
Slider 的 region。要将某一样式绑定到此 Region,使用名称 Slider


SLIDER_TRACK

public static final Region SLIDER_TRACK
Slider 的滑道。要将某一样式绑定到此 Region,使用名称 SliderTrack


SLIDER_THUMB

public static final Region SLIDER_THUMB
滑块的 thumb。滑块的 thumb 标识当前值。要将某一样式绑定到此 Region,使用名称 SliderThumb


SPINNER

public static final Region SPINNER
Spinner 的 region。要将某一样式绑定到此 Region,使用名称 Spinner


SPLIT_PANE

public static final Region SPLIT_PANE
SplitPane 的 region。要将某一样式绑定到此 Region,使用名称 SplitPane


SPLIT_PANE_DIVIDER

public static final Region SPLIT_PANE_DIVIDER
SplitPane 的分隔器。要将某一样式绑定到此 Region,使用名称 SplitPaneDivider


TABBED_PANE

public static final Region TABBED_PANE
TabbedPane 的 region。要将某一样式绑定到此 Region,使用名称 TabbedPane


TABBED_PANE_TAB

public static final Region TABBED_PANE_TAB
某一选项卡的 TabbedPane 的 region。要将某一样式绑定到此 Region,使用名称 TabbedPaneTab


TABBED_PANE_TAB_AREA

public static final Region TABBED_PANE_TAB_AREA
包含选项卡的 TabbedPane 的 region。要将某一样式绑定到此 Region,使用名称 TabbedPaneTabArea


TABBED_PANE_CONTENT

public static final Region TABBED_PANE_CONTENT
包含内容的 TabbedPane 的 region。要将某一样式绑定到此 Region,使用名称 TabbedPaneContent


TABLE

public static final Region TABLE
Table 的 region。要将某一样式绑定到此 Region,使用名称 Table


TABLE_HEADER

public static final Region TABLE_HEADER
TableHeader 的 region。要将某一样式绑定到此 Region,使用名称 TableHeader


TEXT_AREA

public static final Region TEXT_AREA
TextArea 的 region。要将某一样式绑定到此 Region,使用名称 TextArea


TEXT_FIELD

public static final Region TEXT_FIELD
TextField 的 region。要将某一样式绑定到此 Region,使用名称 TextField


TEXT_PANE

public static final Region TEXT_PANE
TextPane 的 region。要将某一样式绑定到此 Region,使用名称 TextPane


TOGGLE_BUTTON

public static final Region TOGGLE_BUTTON
ToggleButton 的 region。要将某一样式绑定到此 Region,使用名称 ToggleButton


TOOL_BAR

public static final Region TOOL_BAR
ToolBar 的 region。要将某一样式绑定到此 Region,使用名称 ToolBar


TOOL_BAR_CONTENT

public static final Region TOOL_BAR_CONTENT
包含内容的 ToolBar 的 region。要将某一样式绑定到此 Region,使用名称 ToolBarContent


TOOL_BAR_DRAG_WINDOW

public static final Region TOOL_BAR_DRAG_WINDOW
包含 ToolBar 的 Window 的 region。要将某一样式绑定到此 Region,使用名称 ToolBarDragWindow


TOOL_TIP

public static final Region TOOL_TIP
ToolTip 的 region。要将某一样式绑定到此 Region,使用名称 ToolTip


TOOL_BAR_SEPARATOR

public static final Region TOOL_BAR_SEPARATOR
ToolBar 分隔器的 region。要将某一样式绑定到此 Region,使用名称 ToolBarSeparator


TREE

public static final Region TREE
Tree 的 region。要将某一样式绑定到此 Region,使用名称 Tree


TREE_CELL

public static final Region TREE_CELL
用于某一单元格的 Tree 的 region。要将某一样式绑定到此 Region,使用名称 TreeCell


VIEWPORT

public static final Region VIEWPORT
Viewport 的 region。要将某一样式绑定到此 Region,使用名称 Viewport

构造方法详细信息

Region

protected Region(String name,
                 String ui,
                 boolean subregion)
创建具有指定名称的 Region。应该只在想使用自定义 ComponentUI 类创建自己的 JComponent 子类时使用此方法。

参数:
name - region 的名称
ui - 将从 component.getUIClassID 中返回的字符串。如果是一个子 region,则该参数将为 null。
subregion - 判断是否是一个子 region。
方法详细信息

isSubregion

public boolean isSubregion()
如果 Region 是 Component 的子 region,则返回 true,否则返回 false。例如,Region.BUTTON 对应于某个 Component,因此 Region.BUTTON.isSubregion() 返回 false。

返回:
如果 Region 是 Component 的子 region,则返回 true。

getName

public String getName()
返回 region 的名称。

返回:
Region 的名称。

toString

public String toString()
返回 Region 的名称。

覆盖:
Object 中的 toString
返回:
Region 的名称。

JavaTM 2 Platform
Standard Ed. 6

提交错误或意见

版权所有 2008 Sun Microsystems, Inc. 保留所有权利。请遵守GNU General Public License, version 2 only