Hello all,

I have an assignment for one of my modules which involves writing UML Class diagram software which then outputs skeletal java code. The main window contains 3 things - a menu bar at the top, a panel on the left-side containing buttons and a draw area, where the class diagram is shown. Currently, the buttons panel has separate buttons for all the different relationships between classes, such as inheritance, composition, etc. My questions is whether it is possible to have a single "relationships" button, which when clicked spawns a popupmenu to its right with all the different relationship options? If not possible, I guess I can always just use JOptionPane, but I thought that a popup menu that doesn't require an extra window would look nicer :)

Cheers,
Dave aka exon

Try looking at the JPopupMenu class. There are links to the tutorial from its API doc that show how to use it.