- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JSeparator
-
- 实现的所有接口
-
ImageObserver
,MenuContainer
,Serializable
,Accessible
,SwingConstants
- 已知直接子类:
-
JPopupMenu.Separator
,JToolBar.Separator
@JavaBean(defaultProperty="UI", description="A divider between menu items.") public class JSeparator extends JComponent implements SwingConstants, Accessible
JSeparator
提供了一个用于实现分隔线的通用组件 - 最常用作菜单项之间的分隔符,将它们分解为逻辑分组。 而不是使用JSeparator
直接,你可以使用JMenu
或JPopupMenu
addSeparator
方法来创建并添加一个分隔符。JSeparator
s也可以在GUI的其他地方使用,只要有视觉分隔符。有关更多信息和示例,请参阅“Java教程”中的 How to Use Menus部分。
警告: Swing不是线程安全的。 有关更多信息,请参阅Swing's Threading Policy 。
警告:此类的序列化对象与以后的Swing版本不兼容。 当前的序列化支持适用于运行相同版本Swing的应用程序之间的短期存储或RMI。 从1.4开始,
java.beans
软件包中添加了对所有JavaBeansjava.beans
长期存储的支持。 请参阅XMLEncoder
。- 从以下版本开始:
- 1.2
- 另请参见:
- Serialized Form
-
-
嵌套类汇总
嵌套类 变量和类型 类 描述 protected class
JSeparator.AccessibleJSeparator
此类实现JSeparator
类的可访问性支持。-
嵌套类/接口声明在类 javax.swing.JComponent
JComponent.AccessibleJComponent
-
嵌套类/接口声明在类 java.awt.Container
Container.AccessibleAWTContainer
-
-
字段汇总
-
声明的属性在类 javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
-
声明的属性在类 java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
-
Fields declared in interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
Fields declared in interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
-
-
构造方法摘要
构造方法 构造器 描述 JSeparator()
创建一个新的水平分隔符。JSeparator(int orientation)
创建具有指定水平或垂直方向的新分隔符。
-
方法摘要
所有方法 实例方法 具体的方法 变量和类型 方法 描述 AccessibleContext
getAccessibleContext()
获取与此JSeparator关联的AccessibleContext。int
getOrientation()
返回此分隔符的方向。SeparatorUI
getUI()
返回呈现此组件的L&F对象。String
getUIClassID()
返回呈现此组件的L&F类的名称。protected String
paramString()
返回此JSeparator
的字符串表示JSeparator
。void
setOrientation(int orientation)
设置分隔符的方向。void
setUI(SeparatorUI ui)
设置呈现此组件的L&F对象。void
updateUI()
将UI属性重置为当前外观的值。-
声明方法的类 javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
-
声明方法的类 java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
-
声明方法的类 java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
构造方法详细信息
-
JSeparator
public JSeparator()
创建一个新的水平分隔符。
-
JSeparator
public JSeparator(int orientation)
创建具有指定水平或垂直方向的新分隔符。- 参数
-
orientation
- 一个整数,指定SwingConstants.HORIZONTAL
或SwingConstants.VERTICAL
- 异常
-
IllegalArgumentException
- 如果orientation
既不是SwingConstants.HORIZONTAL
也不是SwingConstants.VERTICAL
-
-
方法详细信息
-
getUI
public SeparatorUI getUI()
返回呈现此组件的L&F对象。- 重写:
-
getUI
在类JComponent
- 结果
- 呈现此组件的SeparatorUI对象
-
setUI
@BeanProperty(hidden=true, visualUpdate=true, description="The UI object that implements the Component\'s LookAndFeel.") public void setUI(SeparatorUI ui)
设置呈现此组件的L&F对象。- 参数
-
ui
- SeparatorUI L&F对象 - 另请参见:
-
UIDefaults.getUI(javax.swing.JComponent)
-
updateUI
public void updateUI()
将UI属性重置为当前外观的值。- 重写:
-
updateUI
在类JComponent
- 另请参见:
-
JComponent.updateUI()
-
getUIClassID
@BeanProperty(bound=false) public String getUIClassID()
返回呈现此组件的L&F类的名称。- 重写:
-
getUIClassID
在类JComponent
- 结果
- 字符串“SeparatorUI”
- 另请参见:
-
JComponent.getUIClassID()
,UIDefaults.getUI(javax.swing.JComponent)
-
getOrientation
public int getOrientation()
返回此分隔符的方向。- 结果
-
orientation属性的值,
SwingConstants
:VERTICAL
或HORIZONTAL
定义的以下常量HORIZONTAL
。 - 另请参见:
-
SwingConstants
,setOrientation(int)
-
setOrientation
@BeanProperty(preferred=true, visualUpdate=true, enumerationValues={"SwingConstants.HORIZONTAL","SwingConstants.VERTICAL"}, description="The orientation of the separator.") public void setOrientation(int orientation)
设置分隔符的方向。 此属性的默认值为HORIZONTAL。- 参数
-
orientation
-SwingConstants.HORIZONTAL
或SwingConstants.VERTICAL
- 异常
-
IllegalArgumentException
- 如果orientation
既不是SwingConstants.HORIZONTAL
也不是SwingConstants.VERTICAL
- 另请参见:
-
SwingConstants
,getOrientation()
-
paramString
protected String paramString()
返回此JSeparator
的字符串表示JSeparator
。 此方法仅用于调试目的,返回字符串的内容和格式可能因实现而异。 返回的字符串可能为空,但可能不是null
。- 重写:
-
paramString
在类JComponent
- 结果
-
此
JSeparator
的字符串表示JSeparator
-
getAccessibleContext
@BeanProperty(bound=false) public AccessibleContext getAccessibleContext()
获取与此JSeparator关联的AccessibleContext。 对于分隔符,AccessibleContext采用AccessibleJSeparator的形式。 如有必要,将创建一个新的AccessibleJSeparator实例。- Specified by:
-
getAccessibleContext
在Accessible
- 重写:
-
getAccessibleContext
在类Component
- 结果
- 一个AccessibleJSeparator,用作此JSeparator的AccessibleContext
-
-