Hi All--
I basically am trying to write a piece a piece of code for an application that will list all the open frames in the program, and if you click one, it is selected and brought to the top of the program. I have a menu bar, and I want to be able to select a Menu from it, and then have that menu drop down and list all the open frames.
The problem is I have to gather the open frames whenever I click the menu, and so I have to dynamically create buttons, corresponding to an arbitrary amount of frames which might be open.
Getting a list of the components is not difficult, and creating buttons doesn't seem to be. I just go through a for loop of all the open components, creating buttons, within a mouse listener. But it won't let me insert these buttons into the menu unless the menu is final (which it can't be since it should be dynamic).

Any ideas?


13 Years
Discussion Span
Last Post by flybet

You should be able to easily do this with add() or remove(). Are you remembering that a Menu must have JMenuItems and not buttons? Also, if your getting an error, post it.


use jbuilder, i am a newer,readed some paper,i think jbuilder is a basic for who want the gui design.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.