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 / First Aid / March 2005

Tip: Looking for answers? Try searching our database.

Calling a non-static function

Thread view: 
Amol Vaidya - 21 Mar 2005 01:01 GMT
Hi. I was wondering how I could pass some values from one program to
another. I'm writing a simple program. It's GUI based, and I extend
JFrame. I have some menus. One of these is a preferences menu, which is
another JFrame. I wrote a  static function in the main program to allow
the preferences program send some values to the main program. Now, in
this static function, I would like to call connect(), a non-static
function. Is there any way I could go about doing that?
Roy Goodman - 21 Mar 2005 02:56 GMT
Amol Vaidya <mynewsa@gmail.com> wrote in news:Nao%d.7838$ot.5078
@tornado.texas.rr.com:

> Hi. I was wondering how I could pass some values from one program to
> another. I'm writing a simple program. It's GUI based, and I extend
[quoted text clipped - 3 lines]
> this static function, I would like to call connect(), a non-static
> function. Is there any way I could go about doing that?

You have to create an instance of the object that the connect() method is
in:

Class1 c = new Class1();
c.connect();

Something like that.

Roy


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.