Results 1 to 7 of 7
  1. #1
    droidus is offline Senior Member
    Join Date
    Feb 2011
    Posts
    244
    Rep Power
    4

    Default running class methods

    I have a GUI and a methods file. One calls upon the other to complete the program. Here is my gui:

    Java Code:
    Learn1 main = new Learn1();
    
    public void setContent(String content) {
            textArea.setText(content);
        }
    This happens after the entire form is initialized. setting the content in this file is fine. when i call upon my other class though, nothing happens.

    Java Code:
    GUI gui = new GUI();
            gui.setContent("Program Initialized...");
    I was thinking that calling on GUI will just return it to gui, and not run gui.setContent... any ideas?

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

  3. #3
    wsaryada is offline Senior Member
    Join Date
    Jun 2007
    Location
    Bali, Indonesia
    Posts
    758
    Rep Power
    8

    Default Re: running class methods

    We need more information to understand your problem. What result of the program that you expect to happen. And whether any error occurs in there or what?

  4. #4
    droidus is offline Senior Member
    Join Date
    Feb 2011
    Posts
    244
    Rep Power
    4

    Default Re: running class methods

    What I would like to happen is for text to be outputted into the text area.

    My question is, how do you call upon another method in another class?

  5. #5
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: running class methods

    To call a public method from another class, you would first need to create an instance (an object) of the class and then would call the public instance method on this instance/object. I'm afraid that this is a very general and vague answer, but without your showing more code and a more detailed description of your problem, as we have previously asked, your question remains very general and vague and I'm afraid that you're preventing me from being able to offer better help.
    Last edited by Fubarable; 12-09-2012 at 04:38 PM.

  6. #6
    droidus is offline Senior Member
    Join Date
    Feb 2011
    Posts
    244
    Rep Power
    4

    Default Re: running class methods

    [Java] Learn1 - Pastebin.com
    [Java] gui - Pastebin.com
    i want to send text to the text area in the gui.
    let me know if this helps

  7. #7
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

Similar Threads

  1. Calling another class after one is done running
    By Burnett98 in forum New To Java
    Replies: 4
    Last Post: 06-17-2012, 07:12 PM
  2. A class calling methods from external class
    By Aaron5466 in forum New To Java
    Replies: 4
    Last Post: 04-16-2012, 11:36 AM
  3. Running extensions other than .class
    By gwaldarick in forum Advanced Java
    Replies: 3
    Last Post: 05-13-2010, 08:57 AM
  4. How can I call abstract class methods from another class
    By srinivas2828 in forum New To Java
    Replies: 13
    Last Post: 03-12-2010, 02:33 PM
  5. Problems in running client class
    By ai_2007 in forum Advanced Java
    Replies: 0
    Last Post: 06-30-2007, 02:57 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •