|
Extension SDK 10.1.2 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
javax.swing.BoxLayout
javax.swing.plaf.basic.DefaultMenuLayout
oracle.ide.controls.SortedMenuLayout
Deprecated. No replacement -- experimental class which never worked properly.
### NOTE: This class has been temporarily disabled.
SortedMenuLayout
is an implementation of LayoutManager2
that can be used to order the items displayed in a JPopupMenu
in Locale
-sensitive collation order. It is a subclass of DefaultMenuLayout
.
(In actuality, any arbitrary Container
can have its children sorted using this LayoutManager
, but in practice only a JPopupMenu
is likely to want its children sorted in this fashion.)
Each child of the target Container
must be an instance of AbstractButton
. The children are ordered according to the value returned by each child's AbstractButton.getText()
method.
When the target to be ordered is a JMenu
, then general usage pattern is:
import javax.swing.JMenu; import javax.swing.JPopupMenu; import oracle.ide.controls.SortedMenuLayout; // ... final JMenu menu = new JMenu(); final JPopupMenu popup = menu.getPopupMenu(); popup.setLayout(new SortedMenuLayout(popup));
The general usage pattern for a JPopupMenu
is similar:
import javax.swing.JPopupMenu; import oracle.ide.controls.SortedMenuLayout; // ... final JPopupMenu popup = new JPopupMenu(): popup.setInvoker(<invoker>); popup.setLayout(new SortedMenuLayout(popup));
(The reason for calling JPopupMenu.setInvoker(Component)
on the popup menu is so that the layout on the popup won't be reset when the invoker is set on the popup in response to a call to JPopupMenu.show(Component,int,int)
.)
Field Summary | |
protected java.util.SortedMap |
componentMap Deprecated. The SortedMap used to maintain child components in sorted order. |
protected boolean |
isVertical Deprecated. Flag indicating whether to layout vertically or horizontally. |
Fields inherited from class javax.swing.BoxLayout |
LINE_AXIS, PAGE_AXIS, X_AXIS, Y_AXIS |
Constructor Summary | |
SortedMenuLayout(java.awt.Container target) Deprecated. Constructs a SortedMenuLayout for the target container using a vertical orientation. |
|
SortedMenuLayout(java.awt.Container target, int axis) Deprecated. Constructs a SortedMenuLayout for the target container using the specified axis for orientation. |
Method Summary | |
void |
addLayoutComponent(java.awt.Component component, java.lang.Object constraints) Deprecated. Adds the component to the componentMap and starts listening for changes to the component's text property. |
void |
layoutContainer(java.awt.Container target) Deprecated. Lays out the container using the appropriate orientation. |
void |
propertyChange(java.beans.PropertyChangeEvent event) Deprecated. Listens for changes to the AbstractButton.TEXT_CHANGED_PROPERTY of any child items. |
void |
removeLayoutComponent(java.awt.Component component) Deprecated. Removes the component from the componentMap and stops listening for changes to the component's text property. |
Methods inherited from class javax.swing.plaf.basic.DefaultMenuLayout |
preferredLayoutSize |
Methods inherited from class javax.swing.BoxLayout |
addLayoutComponent, getLayoutAlignmentX, getLayoutAlignmentY, invalidateLayout, maximumLayoutSize, minimumLayoutSize |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.util.SortedMap componentMap
SortedMap
used to maintain child components in sorted order.protected boolean isVertical
Constructor Detail |
public SortedMenuLayout(java.awt.Container target)
SortedMenuLayout
for the target container using a vertical orientation.public SortedMenuLayout(java.awt.Container target, int axis)
SortedMenuLayout
for the target container using the specified axis for orientation.BoxLayout.X_AXIS
, BoxLayout.Y_AXIS
Method Detail |
public void addLayoutComponent(java.awt.Component component, java.lang.Object constraints)
componentMap
and starts listening for changes to the component's text property. The component must be an instance of AbstractButton
.addLayoutComponent
in interface java.awt.LayoutManager2
public void removeLayoutComponent(java.awt.Component component)
componentMap
and stops listening for changes to the component's text property. The component must be an instance of AbstractButton
.removeLayoutComponent
in interface java.awt.LayoutManager
public void layoutContainer(java.awt.Container target)
layoutContainer
in interface java.awt.LayoutManager
public void propertyChange(java.beans.PropertyChangeEvent event)
AbstractButton.TEXT_CHANGED_PROPERTY
of any child items. A change in the text of one of the items invalidates the layout.propertyChange
in interface java.beans.PropertyChangeListener
|
Extension SDK | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 1997, 2004, Oracle. All rights reserved.