Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-21-2008, 04:54 PM
Member
 
Join Date: Nov 2007
Posts: 25
Renegade85 is on a distinguished road
[SOLVED] Need help using variables between classes
Ok, so i'm doing a GUI for a program i'm making. It has 4 classes (MainPanel, Panel1, panel2, Panel3) and i have referenced panel2 in panel 3 in it's constructor i.e.

Code:
public Panel3(Panel2 panel2)
The objects are all created in the main class of the program i.e. MainPanel
I want to get the information put into Panel2 and use it in a method of Panel3. I can't seem to figure it out though

The info i want to take is from JLabels

Any help appreciated, thanks

Last edited by Renegade85 : 04-21-2008 at 05:10 PM.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 04-21-2008, 07:20 PM
CaptainMorgan's Avatar
Moderator
 
Join Date: Dec 2007
Location: NewEngland, US
Posts: 840
CaptainMorgan will become famous soon enoughCaptainMorgan will become famous soon enough
Send a message via AIM to CaptainMorgan
Hmm.. I would start with constructing the Panel2 before you construct Panel3... in addition, make the data you want to retrieve from Panel2 static.... what have you got so far for code?
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
to our beloved Java Forums!
(closes on September 4, 2008)
Want to voice your opinion on your IDE/Editor of choice?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
!
Got a little Capt'n in you? (drink responsibly)
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 04-22-2008, 11:53 AM
Member
 
Join Date: Nov 2007
Posts: 25
Renegade85 is on a distinguished road
Quote:
Originally Posted by CaptainMorgan View Post
Hmm.. I would start with constructing the Panel2 before you construct Panel3... in addition, make the data you want to retrieve from Panel2 static....
Already constructing Panel2 first Will try making variables in Panel2 static
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 04-22-2008, 02:00 PM
Chris.Brown.SPE's Avatar
Member
 
Join Date: Apr 2008
Location: State College, PA
Posts: 50
Chris.Brown.SPE is on a distinguished road
Send a message via AIM to Chris.Brown.SPE
Let me know if i'm getting this right.

Step 1: Create main panel
Step 2: Add Panel 1
Step 3: Add Panel 2
Step 4: Add stuff to panel 2
Step 5: Add Panel 3 by passing Panel 2

Code snippets may help.
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 04-22-2008, 03:53 PM
Member
 
Join Date: Nov 2007
Posts: 25
Renegade85 is on a distinguished road
Have it fixed now so its ok

Last edited by Renegade85 : 04-23-2008 at 10:54 AM.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
boolean variables ravian New To Java 3 12-31-2007 05:58 AM
Initialize variables before use Java Tip Java Tips 0 12-22-2007 12:22 PM
Variables mew New To Java 3 12-11-2007 01:44 PM
JSP - session variables Java Tip Java Tips 0 12-02-2007 10:22 PM
Saving Variables Fish New To Java 6 06-25-2007 09:20 PM


All times are GMT +3. The time now is 02:51 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org