I made a popup menu in Netbeans and I want to make a menu item that sends me to another GUI when I press it, but I don't know how.
I have to do something like a restaurant menu and when someone presses the button from the menu to send them to a specific type of food.
I made it only to popup when I right click it.
private void formMousePressed(java.awt.event.MouseEvent evt) {
if(evt.isPopupTrigger()){
jPopupMenu1.show(evt.getComponent(),evt.getX(),evt.getY());
}
}
private void formMouseReleased(java.awt.event.MouseEvent evt) {
if(evt.isPopupTrigger()){
jPopupMenu1.show(evt.getComponent(),evt.getX(),evt.getY());
}
}
I'm, not sure how the drag and drop works with GUI Builder for JPopupMenu. I tried to to drap and drop it, but it won't show the display, so I couldn't just drag and drop JMenuItems to it. So I had to hand code it.
jPopupmenu1
);JMenuItem
to it.ActionListener
to theJMenuItem
It works fine for me