I have a JMenu with a JMenuItem, and when I click on this, I need to open a JFrame or window, in other words a component with inside JButton, JTextField,…
How can i do this ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can create the
JFramein the same way you created your initialJFrame, and callin the
ActionListenerof yourJMenuItemto make it visible when the menu is clicked.If you want it to be modal (original frame cannot be accessed unless the new window is closed), you can use a
JDialoginstead, settingmodalto true in the constructor, or callingsetModal(true).