Results 1 to 4 of 4
Thread: how to connect 2 java files
- 07-07-2010, 02:03 PM #1
Member
- Join Date
- Jul 2010
- Posts
- 2
- Rep Power
- 0
how to connect 2 java files
hi, i'm new to java and im using netbeans. i'm wondering if there's a way for 2 java files let's say A and B. using netbeam's ui editor i made 3 jbuttons on A and a textfield on B, i can make B appear once i click any of the buttons on A but what i wanted to do was make the textfield change value depending on which of the 3 buttons were pressed.
any help is appreciated, thank you
- 07-07-2010, 02:11 PM #2
Not good!
Worse!
You have your main class (C) which contains an instance of JFrame, an instance of A and an instance B. I suppose A implements ActionListener to register the button events. Either you let C implement the ActionListener and on the events you take your B reference and set the text, or you pass the B reference to the A reference and set the text in there.Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
The Ubiquitous Newbie Tips
- 07-07-2010, 02:19 PM #3
Member
- Join Date
- Jul 2010
- Posts
- 2
- Rep Power
- 0
actually the scope of what im doing is bigger but my example is sort of the jist, anyway the reason im using netbeans ui editor is so i can present what it's gona look like.
under the action listener from A (the one with buttons) i made an instance of B and i tried doing the B.jTextfield.setText...
but netbeans doesnt show the auto suggest while im typing B.(variables should be auto suggested after typing "B." right?) i've done smethng like this before i just can't figure out why i can't do it now
thnks for the fast reply
- 07-07-2010, 02:34 PM #4
Well B is the class, you need the exact reference that is used in your JFrame, not any reference to B. So as I've already suggested, pass the b reference into your a refernce and use it there.
Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
The Ubiquitous Newbie Tips
Similar Threads
-
connect to oracle from java
By ahmadian in forum Advanced JavaReplies: 7Last Post: 05-15-2013, 04:15 PM -
Convert avi, mpeg, wmv media files to .flv files in java code
By vinay1497 in forum New To JavaReplies: 8Last Post: 07-30-2010, 05:47 PM -
one file connect with another files
By ramanavarayuri in forum AWT / SwingReplies: 2Last Post: 10-22-2009, 05:19 PM -
conversion of java .class files to .java files
By kotturupraveen in forum New To JavaReplies: 2Last Post: 06-09-2008, 12:58 PM -
Making connect 4 in java
By zoe in forum New To JavaReplies: 1Last Post: 08-07-2007, 06:10 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks