Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / November 2006

Tip: Looking for answers? Try searching our database.

Connecting JFrames in Netbeans

Thread view: 
Mithil - 16 Nov 2006 18:58 GMT
Hi Everyone,
                    I am using NetBeans to do a project and i was
wondering whether i could do the follows:

have 2 files :
one.java ----------> has JFrame1 -----------> has button1,textbox1
two.java ----------> has JFrame2

and when button1 in JFrame1 is clicked JFrame2 should appear and the
value entered in textbox1 is to be sent to two.java so JFrame2 can use
it. Is this possible if so plz help me ASAP thanks for your help in
advance. Any other suggestion arround this problem would be greatly
appreciated as well.
Jeff - 16 Nov 2006 22:06 GMT
> Hi Everyone,
>                      I am using NetBeans to do a project and i was
[quoted text clipped - 9 lines]
> advance. Any other suggestion arround this problem would be greatly
> appreciated as well.

I suggest obtaining a beginning Java text and working through that.
This is pretty elementary. I started with a book called Head First Java
and it got me up and running in just a couple weeks.

In the routine that is called by the button click, you would have the
lines:
JFrame2.setVisible();
JFrame2.setYourValue(textbox1.getText());

and in JFrame2 you would have a routine:
public void setYourValue(String s) {
...do whatever you wanted with the string that was in the textbox...
}
Mithil - 17 Nov 2006 09:01 GMT
Hi Jeff,
              Thanks for your reply but i still have one small problem
how would one.java file's class know about JFrame2 which is in two.java
?
Andrew Thompson - 17 Nov 2006 09:24 GMT
..
> how would one.java file's class know about JFrame2 which is in two.java
> ?

If it is in a package with appropriate access rights,
import it.
If not in a package, it could be loaded by reflection,
but don't - put it in a package.

(And if those terms are mysterious, search on them
or ask on c.l.j.hlp - but still search on them first..)

Andrew T.
Jeff - 17 Nov 2006 12:22 GMT
> ..
> > how would one.java file's class know about JFrame2 which is in two.java
[quoted text clipped - 9 lines]
>
> Andrew T.

Or, even better, if they are in the same package they automatically
know about each other.
Mithil - 19 Nov 2006 16:32 GMT
hey thanks everyone i actually didn't even need to create a package
since it is in the same folder thanks a lot Jeff and Andrew.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.