Hi. I am making JMenuBars in my way but i start to understand, that my way ir crap! :D
So I want to know, if there is a way, how to know, which item from menu is set.
For example - i have menu with actors - i choose one, press OK and it opens new window with picture of chosen actor.
so i have to set action listener to JRadioButtonMenuItem, that gives an argument to JButtons actionlistener, so program knows, which one to show.
But how to give as an argument this exact JRadioButtonMenuItem (actually i don't pass this item, i'll pass its ID - number), that will be set!?
For now i made JTextArea in the window with my menu. And action listeners to JRadioButtonMenuItem sets text (writes it's ID) to JTextArea. and when i press OK, i watch to this JtextArea and check for its text - depending on the text, different picture will be shown).
I don't need exact code (because that will stop my learning process), i just want an idea. in this i really can't think of nothing better.
Thanks. :)

Please post a small program that compiles, executes and shows your problem.

That code won't show you anything. Simply - i want to know, how to "tell program", which RadioButton of JMenu is set.

Look at the contents of the event object.

and what do you mean: "which RadioButton of JMenu"? a JMenu uses JMenuItems, not RadioButtons

and what do you mean: "which RadioButton of JMenu"? a JMenu uses JMenuItems, not RadioButtons

it also uses JRadioButtonMenuItems - i just used short name of it!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.