Meaningless Drivel is fun!*
The moose likes Swing / AWT / SWT and the fly likes variable access Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "variable access" Watch "variable access" New topic
Author

variable access

amrit sharma
Greenhorn

Joined: Apr 05, 2010
Posts: 8
hiii..

i am having some problem..

here it goes....i want to access a variable which is actually a result present in one frame class...i want to display this result into a another testarea present in second frame on clickin the display button present in the second frame..

for this reason i created an object of the class containing the result and then calling the result using the object...and then finally passing the variable in the textarea..


some part of the code is:this is a segment of class frame5

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
fourth ob=new fourth(); //here fourth is the class which contains the result value.
String result;
jTextArea1.setText(String.valueOf(ob.result));
// TODO add your handling code here:
}


how can i do it....

plse help..



amrit
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
> fourth ob=new fourth(); //here fourth is the class which contains the result value.

more likely you'll need a reference to an existing fourth() object (not just creating a new one)
google
passing references in java

I'd give you an example, but all your posts are about the same thing,
2 radioButtons and 2 frames, and people have given you suggestions,
or asked for more info, but all you do is post another topic.
pete stein
Bartender

Joined: Feb 23, 2007
Posts: 1561
I second Michael's reply. You may wish to reply to those who've taken the time to help you, because if you ignore them, why should they bother helping you again?
amrit sharma
Greenhorn

Joined: Apr 05, 2010
Posts: 8
thanks for your help...will definitely try that out....
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: variable access
 
Similar Threads
opening link in new window
GUI and events
event handling a challenge
Covariant doubt
fix for non-static variable