NetBeans Forums

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

How do properties get set for a JPanel?

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



Joined: 04 Jan 2011
Posts: 64

PostPosted: Sat Mar 05, 2011 3:37 pm    Post subject: How do properties get set for a JPanel? Reply with quote

Suppose I have a JPanel subclass. In that subclass, I have defined a field myField with getters/setters.

If I add the panel to the Palette Manager, and then drag an instance into another panel, then myField appears in the "Properties" window and I can set it to a specific value.

When I run the application, myField has the correct value filled-in within the instance of the JPanel object (as seen in the debugger).

Okay, so good.

But, I have questions about this. How does NB insert the value? Evidently, this is done at runtime, but I don't known what the mechanism is. And, at what point in the creation of the JPanel instance does myField become valid? Should the value be available in the constructor? Or, after initComponents()?

Please help me understand how this works. Thanks.

Eric
Back to top
mn1247



Joined: 04 Jan 2011
Posts: 64

PostPosted: Sat Mar 05, 2011 11:34 pm    Post subject: Reply with quote

Still hoping for some help with this.

The main issue is that I want to access one of the properties from within the constructor of my class. All I get is "null" - it hasn't been set at that point.

So, when and how does it get set? And, can I somehow gain access to the property value from the constructor?

Thanks,
Eric
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> Java EE 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