Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: Calling / Updating class?

  1. #1
    Junior Member
    Join Date
    Nov 2011
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Calling / Updating class?

    Hi guys,

    I have 2 classes, two JFrame classes in NetBeans.

    The first one has a public Main() and the other has a public Maintain(), from the maintain I'm trying to re-trigger the commands in the public Main() <- the commands that run on the start up of the form.

    Can someone help? is there a command round this? thank you (:


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: Calling / Updating class?

    By commands do you mean you want to call the methods in a class?
    If you have a reference to the Main class, you can call methods in that class.
    For example in one of the Maintain class's methods:
    aRefToMain.someMethod(); // call someMethod in the Main class
    Here: aRefToMain is a reference to an instance of the Main class and someMethod() is a method in that class.

  3. #3
    Junior Member
    Join Date
    Nov 2011
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Calling / Updating class?

    Yup I did that but one method runs fine, the other doesnt give me any returns.. and the methods are fine... can it be because it accesses jLabels etc on the form?

  4. #4
    Member
    Join Date
    Mar 2011
    Posts
    84
    My Mood
    Daring
    Thanks
    17
    Thanked 1 Time in 1 Post

    Default Re: Calling / Updating class?

    please post your code, then only we can help you!!

Similar Threads

  1. calling a changing variable from another class
    By bondage in forum Collections and Generics
    Replies: 11
    Last Post: December 7th, 2011, 10:17 AM
  2. updating SWT Slider from separate java class
    By ppmckee in forum AWT / Java Swing
    Replies: 0
    Last Post: April 14th, 2011, 03:23 PM
  3. about calling sub class
    By pokuri in forum Object Oriented Programming
    Replies: 3
    Last Post: January 11th, 2011, 03:30 PM
  4. Help Calling Method From Another Class
    By CheekySpoon in forum What's Wrong With My Code?
    Replies: 2
    Last Post: February 15th, 2010, 10:24 AM
  5. [SOLVED] How to call string in another class in java?
    By tazjaime in forum What's Wrong With My Code?
    Replies: 4
    Last Post: April 23rd, 2009, 09:31 AM