| | |
Java GUI--Dynamically Adding Buttons to a Menu
![]() |
•
•
Join Date: Jun 2005
Posts: 1
Reputation:
Solved Threads: 0
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?
Thanks,
Miles
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?
Thanks,
Miles
![]() |
Similar Threads
- Java / GUI Developer Needed (UK) (Software Development Job Offers)
- java gui libraries (Java)
- Java GUI JOptionPane.showMessageDialog (Java)
- basic java GUI problem (Java)
- two Java GUI problems - please help (Java)
- Help need with Socket, Thread, and BufferedReader (Java)
Other Threads in the Java Forum
| Thread Tools | Search this Thread |
3d 6 @param affinetransform android api applet application arc array arrays automation binary bluetooth bold byte c++ chat class client code color compare component coordinates database detection doctype eclipse educational error file fractal froglogic game givemetehcodez graphics gui guitesting helpwithhomework html ide ideas image ingres input integer internet intersect j2me java java.xls javaexcel javaprojects jni jpanel jtextarea julia keytool keyword linux list loop map method methods mobile netbeans newbie nextline object pong print problem producer program programming project projectideas read recursion recursive replaysolutions rim scanner sell server set size sms sort sql string swing terminal threads tree web websites windows






