Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

java menu items in alphabetical order

807580Apr 19 2010 — edited Apr 21 2010
Hallo

when i add a menu item to a menu as in the following code , this adds the item to position 0 as i have in the code
so it pops up first of the list.

What i want is , it should be in alphabetical order . should i calculate the position by parsing the menuitem names and
sort it myself or is there a way in java to do it quickly ?
// Updates the GUI i.e. Menu items in the MenuBar
filterItem = new JRadioButtonMenuItem();
filterItem.setText(fd.getFile().toString());
filterItem.addActionListener(this);
filterItem.setVisible(true);
group.add(filterItem);
filterMenu.insert(smartFilterItem,0);
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 19 2010
Added on Apr 19 2010
7 comments
403 views