Extension SDK 10.1.2

oracle.javatools.controls
Class JMenuSorter

java.lang.Object
  extended byoracle.javatools.controls.JMenuSorter

public final class JMenuSorter
extends java.lang.Object

This is a utility class for maintaining the contents of a JMenu in sorted order. The menu is maintained in sorted order even if items are added or removed from the menu.

When a menu is registered with the JMenuSorter, the contents of each menu group in the menu are rearranged so that the items are sorted alphabetically. A menu group is a group of components between menu separators (assuming implicit menu separators at the beginning and end of the menu).

If desired, one or more specific menu groups may be excluded from sorting for any menu that was registered for sorting. A menu group to be excluded from sorting is identified by any component in that menu group.


Method Summary
static boolean isSorted(javax.swing.JMenu menu)
          Returns true if the specified JMenu is registered to be maintained in sorted order.
static void registerExclusionGroup(javax.swing.JMenu menu, java.awt.Component component)
          Registers a menu group for a JMenu so that the group will be excluded from sorting.
static void registerJMenu(javax.swing.JMenu menu)
          Registers a JMenu so that it will be maintained in sorted order.
static void unregisterExclusionGroup(javax.swing.JMenu menu, java.awt.Component component)
          Unegisters a menu group for a JMenu so that the group will be included in sorting.
static void unregisterJMenu(javax.swing.JMenu menu)
          Unregisters a JMenu so that it will no longer be maintained in sorted order.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isSorted

public static boolean isSorted(javax.swing.JMenu menu)
Returns true if the specified JMenu is registered to be maintained in sorted order.

Parameters:
menu - the menu whose sorting status is to be tested.

registerJMenu

public static void registerJMenu(javax.swing.JMenu menu)
Registers a JMenu so that it will be maintained in sorted order.

Parameters:
menu - the menu that should be maintained in sorted order.

unregisterJMenu

public static void unregisterJMenu(javax.swing.JMenu menu)
Unregisters a JMenu so that it will no longer be maintained in sorted order. This method should only be called for a menu that has been registered for sorting with registerJMenu(JMenu), but it is not an error if the menu was not so registered.

Parameters:
menu - the menu that should no longer be maintained in sorted order.

registerExclusionGroup

public static void registerExclusionGroup(javax.swing.JMenu menu,
                                          java.awt.Component component)
Registers a menu group for a JMenu so that the group will be excluded from sorting. This method should only be called for a menu that has been registered for sorting with registerJMenu(JMenu), but it is not an error if the menu was not so registered.

Parameters:
menu - the menu that is being maintained in sorted order.
component - the component indicating the menu group that should be excluded from sorting.

unregisterExclusionGroup

public static void unregisterExclusionGroup(javax.swing.JMenu menu,
                                            java.awt.Component component)
Unegisters a menu group for a JMenu so that the group will be included in sorting. This method should only be called for a menu that has been registered for sorting with registerJMenu(JMenu), but it is not an error if the menu is not registered.

It is an error to call this method if the specified menu and component were not previously excluded from sorting by calling registerExclusionGroup(JMenu,Component).

Parameters:
menu - the menu that is being maintained in sorted order.
component - the component in the menu group that was previously excluded from sorting.

Extension SDK

 

Copyright © 1997, 2004, Oracle. All rights reserved.