public class JSeparator extends JComponent implements SwingConstants, Accessible
JSeparator provides a general purpose component for implementing divider lines - most commonly used as a divider between menu items that breaks them up into logical groupings. Instead of using JSeparator directly, you can use the JMenu or JPopupMenu addSeparator method to create and add a separator. JSeparators may also be used elsewhere in a GUI wherever a visual divider is useful.
For more information and examples see How to Use Menus, a section in The Java Tutorial.
Warning: Swing is not thread safe. For more information see Swing's Threading Policy.
Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.
| Modifier and Type | Class and Description |
|---|---|
protected class |
JSeparator.AccessibleJSeparator This class implements accessibility support for the |
JComponent.AccessibleJComponent Container.AccessibleAWTContainer Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH public JSeparator()
Creates a new horizontal separator.
public JSeparator(int orientation)
Creates a new separator with the specified horizontal or vertical orientation.
orientation - an integer specifying SwingConstants.HORIZONTAL or SwingConstants.VERTICAL
IllegalArgumentException - if orientation is neither SwingConstants.HORIZONTAL nor SwingConstants.VERTICAL
public SeparatorUI getUI()
Returns the L&F object that renders this component.
public void setUI(SeparatorUI ui)
Sets the L&F object that renders this component.
ui - the SeparatorUI L&F objectUIDefaults.getUI(javax.swing.JComponent)public void updateUI()
Resets the UI property to a value from the current look and feel.
updateUI in class JComponent
JComponent.updateUI()public String getUIClassID()
Returns the name of the L&F class that renders this component.
getUIClassID in class JComponent
JComponent.getUIClassID(), UIDefaults.getUI(javax.swing.JComponent)
public int getOrientation()
Returns the orientation of this separator.
SwingConstants: VERTICAL, or HORIZONTAL.SwingConstants, setOrientation(int)
public void setOrientation(int orientation)
Sets the orientation of the separator. The default value of this property is HORIZONTAL.
orientation - either SwingConstants.HORIZONTAL or SwingConstants.VERTICAL
IllegalArgumentException - if orientation is neither SwingConstants.HORIZONTAL nor SwingConstants.VERTICAL
SwingConstants, getOrientation()
protected String paramString()
Returns a string representation of this JSeparator. This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null.
paramString in class JComponent
JSeparator
public AccessibleContext getAccessibleContext()
Gets the AccessibleContext associated with this JSeparator. For separators, the AccessibleContext takes the form of an AccessibleJSeparator. A new AccessibleJSeparator instance is created if necessary.
getAccessibleContext in interface Accessible
getAccessibleContext in class Component
© 1993–2017, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.