Results 1 to 2 of 2
  1. #1
    talia is offline Member
    Join Date
    Dec 2011
    Location
    London
    Posts
    11
    Rep Power
    0

    Default relationship between classes

    I though I finally understood how to implement these, but again got confused...
    I have these classes: Student, StudentList I store the student details in a text file. I implemented the get/set functions in the student class(getname, getdob, getaddress, etc.) the students are all part of the student list. What I am trying to do is create a combobox in my main frame with all the student names in it. I pick a student from the combobox and I want to display their details in textarea.
    I did a LoadFromFile() in the Student class, which will load in the text file with the details and set the src JTextArea. I want to combine these, but I am now not sure where and how to put an if statement, which will compare the Student name picked in Combobox and will search the text file for those details. As my ComboBox is in the mainFrame and LoadFromFile() method in my Student class...

    any help appreciated

  2. #2
    CHLim is offline Member
    Join Date
    Nov 2011
    Posts
    24
    Rep Power
    0

    Default Re: relationship between classes

    Since StudentList is a class i'd suggest implementing a getStudent method in StudentList. This would return a student object. Then you'll be able to send any message you want to the student object.

    Assuming that, you did create a new StudentList object in the mainFrame.

Similar Threads

  1. Replies: 1
    Last Post: 03-21-2011, 10:40 AM
  2. help with mapping and relationship
    By peace76 in forum Enterprise JavaBeans (EJB)
    Replies: 5
    Last Post: 12-07-2010, 08:12 PM
  3. class relationship
    By RajShri in forum New To Java
    Replies: 2
    Last Post: 01-04-2010, 06:54 AM
  4. How to update data for a JPA many-to-many relationship?
    By abhijit.sarkar in forum Enterprise JavaBeans (EJB)
    Replies: 1
    Last Post: 11-04-2008, 09:48 AM
  5. What is this Object relationship?
    By SirRawlins in forum New To Java
    Replies: 3
    Last Post: 12-14-2007, 04:17 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
  •