Skip to Main Content

Java SE (Java Platform, Standard Edition)

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!

Creating sub menu's under Abstract Action.

843807Aug 2 2010 — edited Aug 2 2010
Folks,

I am trying to create a sub-menu under abstract actions.

But when I run the application,I can only see 'Create New Positions' menu item;
and cannot view/invoke the sub menu options(ie Create Position One/Two).

Is there a way to create sub menu's under the main action menu? (in the code below please)

Thanks,

final ArrayList<Action> actions = new ArrayList<Action>();


actions.add(new AbstractAction("Create New Positions") {

	public void actionPerformed(ActionEvent e) {
					
				
			// Sub Menu options		
			actions.add(new AbstractAction("Create Position One") {
			@Override
			public void actionPerformed(ActionEvent e) {

			// Code to create position one					

			}

			});
						
	}
		

	public void actionPerformed(ActionEvent e) {
					
				
			// Sub Menu options		
			actions.add(new AbstractAction("Create Position Two") {
			@Override
			public void actionPerformed(ActionEvent e) {

			// Code to create position two				

			}

			});
						
	}			





});
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 30 2010
Added on Aug 2 2010
7 comments
118 views