📄 region.java
字号:
/* * @(#)Region.java 1.32 08/05/29 * * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */package javax.swing.plaf.synth;import javax.swing.*;import java.util.*;/** * 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. * <p> * Regions are typically used as a way to identify the <code>Component</code>s * and areas a particular style is to apply to. Synth's file format allows you * to bind styles based on the name of a <code>Region</code>. * The name is derived from the field name of the constant: * <ol> * <li>Map all characters to lowercase. * <li>Map the first character to uppercase. * <li>Map the first character after underscores to uppercase. * <li>Remove all underscores. * </ol> * For example, to identify the <code>SPLIT_PANE</code> * <code>Region</code> you would use <code>SplitPane</code>. * The following shows a custom <code>SynthStyleFactory</code> * that returns a specific style for split panes: * <pre> * public SynthStyle getStyle(JComponent c, Region id) { * if (id == Region.SPLIT_PANE) { * return splitPaneStyle; * } * ... * } * </pre> * The following <a href="doc-files/synthFileFormat.html">xml</a> * accomplishes the same thing: * <pre> * <style id="splitPaneStyle"> * ... * </style> * <bind style="splitPaneStyle" type="region" key="SplitPane"/> * </pre> * * @version 1.32, 05/29/08 * @since 1.5 * @author Scott Violet */public class Region { private static final Map uiToRegionMap = new HashMap(); private static final Map lowerCaseNameMap = new HashMap(); /** * 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 <code>Region</code> use the name * <code>ArrowButton</code>. */ public static final Region ARROW_BUTTON = new Region("ArrowButton", "ArrowButtonUI"); /** * Button region. To bind a style to this <code>Region</code> use the name * <code>Button</code>. */ public static final Region BUTTON = new Region("Button", "ButtonUI"); /** * CheckBox region. To bind a style to this <code>Region</code> use the name * <code>CheckBox</code>. */ public static final Region CHECK_BOX = new Region("CheckBox", "CheckBoxUI"); /** * CheckBoxMenuItem region. To bind a style to this <code>Region</code> use * the name <code>CheckBoxMenuItem</code>. */ public static final Region CHECK_BOX_MENU_ITEM = new Region( "CheckBoxMenuItem", "CheckBoxMenuItemUI"); /** * ColorChooser region. To bind a style to this <code>Region</code> use * the name <code>ColorChooser</code>. */ public static final Region COLOR_CHOOSER = new Region( "ColorChooser", "ColorChooserUI"); /** * ComboBox region. To bind a style to this <code>Region</code> use * the name <code>ComboBox</code>. */ public static final Region COMBO_BOX = new Region( "ComboBox", "ComboBoxUI"); /** * DesktopPane region. To bind a style to this <code>Region</code> use * the name <code>DesktopPane</code>. */ public static final Region DESKTOP_PANE = new Region("DesktopPane", "DesktopPaneUI"); /** * DesktopIcon region. To bind a style to this <code>Region</code> use * the name <code>DesktopIcon</code>. */ public static final Region DESKTOP_ICON = new Region("DesktopIcon", "DesktopIconUI"); /** * EditorPane region. To bind a style to this <code>Region</code> use * the name <code>EditorPane</code>. */ public static final Region EDITOR_PANE = new Region("EditorPane", "EditorPaneUI"); /** * FileChooser region. To bind a style to this <code>Region</code> use * the name <code>FileChooser</code>. */ public static final Region FILE_CHOOSER = new Region("FileChooser", "FileChooserUI"); /** * FormattedTextField region. To bind a style to this <code>Region</code> use * the name <code>FormattedTextField</code>. */ public static final Region FORMATTED_TEXT_FIELD = new Region( "FormattedTextField", "FormattedTextFieldUI"); /** * InternalFrame region. To bind a style to this <code>Region</code> use * the name <code>InternalFrame</code>. */ public static final Region INTERNAL_FRAME = new Region("InternalFrame", "InternalFrameUI"); /** * TitlePane of an InternalFrame. The TitlePane typically * shows a menu, title, widgets to manipulate the internal frame. * To bind a style to this <code>Region</code> use the name * <code>InternalFrameTitlePane</code>. */ public static final Region INTERNAL_FRAME_TITLE_PANE = new Region("InternalFrameTitlePane", "InternalFrameTitlePaneUI"); /** * Label region. To bind a style to this <code>Region</code> use the name * <code>Label</code>. */ public static final Region LABEL = new Region("Label", "LabelUI"); /** * List region. To bind a style to this <code>Region</code> use the name * <code>List</code>. */ public static final Region LIST = new Region("List", "ListUI"); /** * Menu region. To bind a style to this <code>Region</code> use the name * <code>Menu</code>. */ public static final Region MENU = new Region("Menu", "MenuUI"); /** * MenuBar region. To bind a style to this <code>Region</code> use the name * <code>MenuBar</code>. */ public static final Region MENU_BAR = new Region("MenuBar", "MenuBarUI"); /** * MenuItem region. To bind a style to this <code>Region</code> use the name * <code>MenuItem</code>. */ public static final Region MENU_ITEM = new Region("MenuItem","MenuItemUI"); /** * Accelerator region of a MenuItem. To bind a style to this * <code>Region</code> use the name <code>MenuItemAccelerator</code>. */ public static final Region MENU_ITEM_ACCELERATOR = new Region( "MenuItemAccelerator"); /** * OptionPane region. To bind a style to this <code>Region</code> use * the name <code>OptionPane</code>. */ public static final Region OPTION_PANE = new Region("OptionPane", "OptionPaneUI"); /** * Panel region. To bind a style to this <code>Region</code> use the name * <code>Panel</code>. */ public static final Region PANEL = new Region("Panel", "PanelUI"); /** * PasswordField region. To bind a style to this <code>Region</code> use * the name <code>PasswordField</code>. */ public static final Region PASSWORD_FIELD = new Region("PasswordField", "PasswordFieldUI"); /** * PopupMenu region. To bind a style to this <code>Region</code> use * the name <code>PopupMenu</code>. */ public static final Region POPUP_MENU = new Region("PopupMenu", "PopupMenuUI"); /** * PopupMenuSeparator region. To bind a style to this <code>Region</code> * use the name <code>PopupMenuSeparator</code>. */ public static final Region POPUP_MENU_SEPARATOR = new Region( "PopupMenuSeparator", "PopupMenuSeparatorUI"); /** * ProgressBar region. To bind a style to this <code>Region</code> * use the name <code>ProgressBar</code>. */ public static final Region PROGRESS_BAR = new Region("ProgressBar", "ProgressBarUI"); /** * RadioButton region. To bind a style to this <code>Region</code> * use the name <code>RadioButton</code>. */ public static final Region RADIO_BUTTON = new Region( "RadioButton", "RadioButtonUI"); /** * RegionButtonMenuItem region. To bind a style to this <code>Region</code> * use the name <code>RadioButtonMenuItem</code>. */ public static final Region RADIO_BUTTON_MENU_ITEM = new Region( "RadioButtonMenuItem", "RadioButtonMenuItemUI"); /** * RootPane region. To bind a style to this <code>Region</code> use * the name <code>RootPane</code>. */ public static final Region ROOT_PANE = new Region("RootPane", "RootPaneUI"); /** * ScrollBar region. To bind a style to this <code>Region</code> use * the name <code>ScrollBar</code>. */ public static final Region SCROLL_BAR = new Region("ScrollBar", "ScrollBarUI"); /** * Track of the ScrollBar. To bind a style to this <code>Region</code> use * the name <code>ScrollBarTrack</code>. */ public static final Region SCROLL_BAR_TRACK = new Region("ScrollBarTrack"); /**
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -