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. :)
migelitto 0 Newbie Poster
Recommended Answers
Jump to PostPlease post a small program that compiles, executes and shows your problem.
Jump to Postand what do you mean: "which RadioButton of JMenu"? a JMenu uses JMenuItems, not RadioButtons
All 5 Replies
NormR1 563 Posting Sage Team Colleague
migelitto 0 Newbie Poster
NormR1 563 Posting Sage Team Colleague
stultuske 1,116 Posting Maven Featured Poster
migelitto 0 Newbie Poster
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.