Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Need help with a record management app.  RSS feed

Nafiz Sheikh
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, everyone.

I need some help designing an application. The application manages student records. Each record of a student contains his/her name, ID number, grade, and major. The application is supposed to be a GUI. The user should be able to add/delete/modify records and once done the records have to be saved in a text file with of the five record fields separated by commas; the records are to be separated by lines.

What approach should I employ when integrating the GUI function and the data management part? I was thinking of creating the following:

If this pic doesn't show, I've attached a copy directly as well.

There is a control panel at the very top of the window with the add/delete record buttons. Then below that, there is the main panel where all the records are displayed. This panel has five headers as individual JLabels, and then has a series or record panels as JPanels with five JTextfields in each. For the GUI part I have the following questions:

1. Is there a simpler way of representing the student records graphically? Would JTable do the trick or should I try this way? I have never worked very thoroughly with JTable before so I'm not sure if it may suit my needs or not.
2. Suppose I create a class called Record which takes the five field arguments and has getter/setter methods. Each Record instance is associated with one student. With JTable, would it be possible to associate each row with a single Record object? Or would I have to treat each cell in the JTable as independent units and later when I need to save the typed data, take all the cells in each row and associate them with a student Record object?

When saving the information provided by the user into a data file, I have to place each student record on a different line and each line has each of the five fields of info separated by commas. Example:
Bill Carson,14222,2307 Hill Way Dr.,98.5,Mech. Engineering
Joyce Mendoza,16667,666 Durham Rd.,78.5,Chemistry

These questions pertain to when I have to save the data typed by the user into the records:

1. When collecting the data, assuming that I use JTable, how should I organize and save the data? Should I take the info in each row, store them in a Record object associated with one student, and then retrieve the info from each Record object and save as a line in the data file?
2. OR is the a simpler way to organize the data. Some have mentioned using the Hashmap, Hashtable, or other collection-type classes here but I have no idea how such may be. Can you please explain how that may be so?

NOTE that all the methods used have to be resource and time efficient, as well!

Thanks so much for going through the trouble or reading this and I REALLY would appreciated if someone could please help me with my problem.

Please forgive me if I've posted this in the wrong category, this is actually my first time using this forum, so I'm definitely a newbie.
[Thumbnail for Java1.png]
Joanne Neal
Posts: 3742
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nafiz Sheikh wrote:I have never worked very thoroughly with JTable before

This is probably a good place to start then.
Campbell Ritchie
Posts: 53750
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And welcome to the Ranch
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!