Class MenuItemComparator

  • All Implemented Interfaces:
    Comparator<JMenuItem>

    public class MenuItemComparator
    extends Object
    implements Comparator<JMenuItem>
    Comparator for sorting JMenuItem (and derived classes).
    Version:
    $Revision$
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    • Constructor Detail

      • MenuItemComparator

        public MenuItemComparator()
    • Method Detail

      • compare

        public int compare​(JMenuItem o1,
                           JMenuItem o2)
        Compares its two arguments for order. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.

        Uses the text of the menu items for comparison.
        Specified by:
        compare in interface Comparator<JMenuItem>
        Parameters:
        o1 - the first object to be compared.
        o2 - the second object to be compared.
        Returns:
        a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.