Results 1 to 2 of 2
  1. #1
    ai_2007 is offline Member
    Join Date
    Jun 2007
    Posts
    21
    Rep Power
    0

    Default Linking code to GUI Interface

    I have a GUI Interface with Add, Edit, Delete, Filter, Sort, Search methods.

    How do I connect the coding for each of the methods above to the GUI Interface so that when the buttons are pressed, the correct method is called and the required output is seen.

    Let's say that I want to add an information or filter something. When I click the appropriate button on the GUI Interface, the correct option has to pop up for me to do what I want to do, in this case, add or filter.

  2. #2
    JavaBean's Avatar
    JavaBean is offline Moderator
    Join Date
    May 2007
    Posts
    1,270
    Rep Power
    9

    Default

    As an abstract description:

    You will have a data class which will hold your data and a view class (e.g. your jframe). You will register event listeners in your GUI and these event listeners (e.g. listener which listens for mouse clicks on certain components) will obtain necessary data from GUI elements (e.g. getting input from the user via a textfield) and call required methods of your data class to change the data. If you dont need to change data and just need to change representation, the listeners will call GUI methods instead of methods of your data class.

    Here you can find list of listeners and events in Swing:

    javax.swing.event (Java 2 Platform SE v1.4.2)

    And here is a tutorial for listeners:

    Lesson: Writing Event Listeners (The Java™ Tutorials > Creating a GUI with JFC/Swing)

Similar Threads

  1. Linking of exe files
    By archu2friends in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 02-06-2008, 07:08 AM
  2. <URGENT> problem after linking .jnlp
    By bongia in forum New To Java
    Replies: 14
    Last Post: 11-18-2007, 06: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
  •