Results 1 to 2 of 2
Thread: relationship between classes
- 12-10-2011, 01:32 AM #1
Member
- Join Date
- Dec 2011
- Location
- London
- Posts
- 11
- Rep Power
- 0
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
- 12-10-2011, 03:33 PM #2
Member
- Join Date
- Nov 2011
- Posts
- 24
- Rep Power
- 0
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
-
Adding and deleting in many-to-many relationship
By mn1247 in forum JDBCReplies: 1Last Post: 03-21-2011, 09:40 AM -
help with mapping and relationship
By peace76 in forum Enterprise JavaBeans (EJB)Replies: 5Last Post: 12-07-2010, 07:12 PM -
class relationship
By RajShri in forum New To JavaReplies: 2Last Post: 01-04-2010, 05:54 AM -
How to update data for a JPA many-to-many relationship?
By abhijit.sarkar in forum Enterprise JavaBeans (EJB)Replies: 1Last Post: 11-04-2008, 08:48 AM -
What is this Object relationship?
By SirRawlins in forum New To JavaReplies: 3Last Post: 12-14-2007, 03:17 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks