Results 1 to 2 of 2
  1. #1
    BAL
    BAL is offline Member
    Join Date
    Jan 2012
    Posts
    1
    Rep Power
    0

    Default Coordinating GUI and Rest of Program

    I have a program that successfully constructs linked lists of linked lists from ArrayLists.
    I have a GUI with a JTextArea where I dump the linked lists.
    I added a panel with 2 buttons on the JTextArea.
    I want one button to quit the program, and the other button to perform a specific operation on the linked lists (don't worry about that part).

    The main linked list is created in a separate file from the GUI. The main linked list is created in the other file's public static void with a
    new MainLinkedList main = new MainLinkedList();

    I create the JTextArea in the same static main:
    DisplayTextArea dta = new DisplayTextArea("Title");

    I've created a public class for the DisplayTextArea whcih does the building of the GUI described above.
    I also have a public method in the DisplayTextArea class which is passed a string and then appends to the JTextArea in the GUI.

    I can successfully create the buttons on the GUI in the DisplayTextArea class and add Listeners to the buttons in the file containing the DisplayTextArea class. My problem is how to then access the linked lists once the button is pushed. The linked lists don't seem accessible from the GUI.

    Please help. I am required to keep the GUI separate from the classes that represent the linked lists.

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

    Default Re: Coordinating GUI and Rest of Program

    Have one class hold a reference to the other class. For instance, have the GUI hold a MainLinkedList variable which then allows the GUI to access all of MainLinkedList's public methods.

Similar Threads

  1. Calling a Rest webservice from Javascript.
    By nikhidas in forum Advanced Java
    Replies: 2
    Last Post: 07-06-2011, 05:41 PM
  2. Rest Webservices with eclipse,jibx and axis2.
    By nikhidas in forum Web Frameworks
    Replies: 0
    Last Post: 06-29-2011, 04:11 PM
  3. Create REST URL with netbeans
    By Miss.LuLu in forum NetBeans
    Replies: 0
    Last Post: 03-15-2011, 06:04 PM
  4. In honor of Benoît Mandelbrot. May he rest in peace.
    By Fubarable in forum Forum Lobby
    Replies: 0
    Last Post: 10-17-2010, 09:31 PM
  5. Sonatype GWT REST 1.0-SNAPSHOT
    By Java Tip in forum Java Software
    Replies: 0
    Last Post: 03-29-2008, 12:54 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
  •