javax.swing
Class JSeparator
java.lang.Object
|
+--java.awt.Component
|
+--java.awt.Container
|
+--javax.swing.JComponent
|
+--javax.swing.JSeparator
- All Implemented Interfaces:
- Accessible, java.awt.image.ImageObserver, MenuContainer, Serializable, SwingConstants
- Direct Known Subclasses:
- javax.swing.JPopupMenu.Separator, javax.swing.JToolBar.Separator
- public class JSeparator
- extends JComponent
- implements SwingConstants, Accessible
Safe: 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.
JSeparator
s 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:
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 JavaBeansTM
has been added to the java.beans
package.
Please see java.beans.XMLEncoder
.
- Version:
- 1.48 12/03/01
- Author:
- Georges Saab, Jeff Shapiro
- See Also:
- Serialized Form
Fields inherited from class java.awt.Container |
|
Fields inherited from 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 |
Constructor Summary |
JSeparator()
Enabled: Creates a new horizontal separator. |
JSeparator(int orientation)
Enabled: Creates a new separator with the specified horizontal or
vertical orientation. |
Method Summary |
private void |
checkOrientation(int orientation)
|
AccessibleContext |
getAccessibleContext()
Suppressed: Gets the AccessibleContext associated with this JSeparator. |
int |
getOrientation()
Enabled: Returns the orientation of this separator. |
javax.swing.plaf.SeparatorUI |
getUI()
Suppressed: Returns the L&F object that renders this component. |
String |
getUIClassID()
Suppressed: Returns the name of the L&F class that renders this component. |
protected String |
paramString()
Returns a string representation of this JSeparator . |
void |
setOrientation(int orientation)
Enabled: Sets the orientation of the separator. |
void |
setUI(javax.swing.plaf.SeparatorUI ui)
Suppressed: Sets the L&F object that renders this component. |
void |
updateUI()
Suppressed: Resets the UI property to a value from the current look and feel. |
private void |
writeObject(ObjectOutputStream s)
See readObject and writeObject in
JComponent for more
information about serialization in Swing. |
Methods inherited from class javax.swing.JComponent |
_paintImmediately, addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, alwaysOnTop, checkIfChildObscuredBySibling, componentInputMapChanged, computeVisibleRect, computeVisibleRect, compWriteObjectNotify, contains, createToolTip, disable, enable, enableSerialization, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getCreatedDoubleBuffer, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getManagingFocusBackwardTraversalKeys, getManagingFocusForwardTraversalKeys, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getWriteObjCounter, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyBindings, processKeyBindingsForAllComponents, processKeyEvent, processMouseMotionEvent, putClientProperty, rectangleIsObscured, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setCreatedDoubleBuffer, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPaintingChild, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, setWriteObjCounter, shouldDebugGraphics, superProcessMouseMotionEvent, unregisterKeyboardAction, update |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, get, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, iterate, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, size, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
Methods inherited from class 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, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, toString, transferFocus, transferFocus, transferFocusUpCycle |
uiClassID
private static final String uiClassID
- See Also:
getUIClassID()
,
JComponent.readObject(java.io.ObjectInputStream)
orientation
private int orientation
JSeparator
public JSeparator()
- Enabled: Creates a new horizontal separator.
JSeparator
public JSeparator(int orientation)
- Enabled: Creates a new separator with the specified horizontal or
vertical orientation.
- Parameters:
orientation
- an integer specifying
SwingConstants.HORIZONTAL
or
SwingConstants.VERTICAL
getUI
public javax.swing.plaf.SeparatorUI getUI()
- Suppressed: Returns the L&F object that renders this component.
- Returns:
- the SeparatorUI object that renders this component
setUI
public void setUI(javax.swing.plaf.SeparatorUI ui)
- Suppressed: Sets the L&F object that renders this component.
- Parameters:
ui
- the SeparatorUI L&F object- See Also:
UIDefaults.getUI(javax.swing.JComponent)
updateUI
public void updateUI()
- Suppressed: Resets the UI property to a value from the current look and feel.
- Overrides:
updateUI
in class JComponent
- See Also:
JComponent.updateUI()
getUIClassID
public String getUIClassID()
- Suppressed: Returns the name of the L&F class that renders this component.
- Overrides:
getUIClassID
in class JComponent
- Returns:
- the string "SeparatorUI"
- See Also:
JComponent.getUIClassID()
,
UIDefaults.getUI(javax.swing.JComponent)
writeObject
private void writeObject(ObjectOutputStream s)
throws IOException
- See
readObject
and writeObject
in
JComponent
for more
information about serialization in Swing.
- Parameters:
s
- the ObjectOutputStream
in which to write
IOException
getOrientation
public int getOrientation()
- Enabled: Returns the orientation of this separator.
- Returns:
- The value of the orientation property, one of the
following constants defined in
SwingConstants
:
VERTICAL
, or
HORIZONTAL
. - See Also:
SwingConstants
,
setOrientation(int)
setOrientation
public void setOrientation(int orientation)
- Enabled: Sets the orientation of the separator.
The default value of this property is HORIZONTAL.
- Parameters:
orientation
- either SwingConstants.HORIZONTAL
or SwingConstants.VERTICAL
- See Also:
SwingConstants
,
getOrientation()
checkOrientation
private void checkOrientation(int orientation)
paramString
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
.
- Overrides:
paramString
in class JComponent
- Returns:
- a string representation of this
JSeparator
getAccessibleContext
public AccessibleContext getAccessibleContext()
- Suppressed: 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.
- Specified by:
getAccessibleContext
in interface Accessible
- Overrides:
getAccessibleContext
in class JComponent
- Returns:
- an AccessibleJSeparator that serves as the
AccessibleContext of this JSeparator
comments?