[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 509
  • Last Modified:

Netbeans & Swing & Events

I have a specific Swing question about events, and then a more general question...

Question #1:  I have created a JFrame/JTabbedPane/JPanel window.  Immediately after this frame opens, I want to execute some setup code right before handing off the window to the user for input.  To which component/event should I attach my code?

Question #1:  I am using the latest Netbeans IDE.  I would like some comments to help me understand the interplay between Netbeans & Swing, and how much Netbeans-specific content Netbeans creates.  It is my understanding that questions like #1 above do not relate to Netbeans specifically, because even though the code was generated by Netbeans, the code generated is Swing code.  Is this true?  
0
LarryAndro
Asked:
LarryAndro
  • 2
1 Solution
 
CEHJCommented:
1 Use a WIndowListener on your frame: http://java.sun.com/javase/6/docs/api/java/awt/event/WindowListener.html

2. You needn't worry - one of the good things about NetBeans is that the code it produces is generic
0
 
LarryAndroAuthor Commented:
It looks like WindowOpened is the specific WindowListener event to use.  Good to know I should attach it to the JFrame too.  

I'm glad Netbeans doesn't add Netbeans-specific code.  I'll ask future questions as plain old Swing questions, unless my question is about the Netbeans interface.

Thanks for assistance.
0
 
CEHJCommented:
:-)

0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now