NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

How to set action to open a JDialog from a button in neatbeans IDE ?

 
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Users
View previous topic :: View next topic  
Author Message
ozzyman



Joined: 05 Mar 2011
Posts: 11

PostPosted: Sat Mar 05, 2011 3:49 pm    Post subject: How to set action to open a JDialog from a button in neatbeans IDE ? Reply with quote

I'm new to netbeans & swing so I don't know if this is the correct/best way to achieve what i'm trying to do:

at the moment i have two windows:
- main menu (as a jframe)
- sub menu (as a jdialog)

what i need to do is:
- open the jdialog sub menu from an action of a certain push button in the main menu

please see the screenshot for more details.

also, is jdialog most suitable for this kind of action/function ?



netbeans_open_jdialog.png
 Description:
Netbeans; JFrame (left) button should open JDialog (right)
 Filesize:  34.68 KB
 Viewed:  3010 Time(s)

netbeans_open_jdialog.png


Back to top
ozzyman



Joined: 05 Mar 2011
Posts: 11

PostPosted: Sat Mar 05, 2011 5:30 pm    Post subject: Reply with quote

Setting the visibility seems to do the trick...

Right-click button > Events > Actions > actionPerformed, then edit the function body to
dialogName.setVisible(true);

private void menu1ActionPerformed(java.awt.event.ActionEvent evt) {
JDialog1.setVisible(true);
}
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo