I have a popup menu but it closes when i click something.
This is ok most of the time but sometimes it is required that it does not close on click!
Here is a piece of code i am working on which would help you to reproduce what i have :
import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
public class Try{
public static void main(String[] args) {
JFrame frame = new JFrame("Trial");
JPopupMenu menu = new JPopupMenu();
JLabel label = new JLabel("This is a popup menu!");
menu.add(label);
frame.setSize(900, 500);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
menu.show(frame, 450, 250);
}
}
What i want it the menu wont close if i click on the frame!