Link to home
Create AccountLog in
Avatar of drewmore44

asked on

Java GUI: What type of component(s) should I use?

I have a collection of Employee objects called Schedule.

I want a GUI that prints the name of each employee in the collection beside several text boxes into which the user inputs several different pieces of data. Beside the text boxes should be a button that, when clicked, binds the values entered by the user to several instance attributes of the respective employee object (i.e. the employee whose name is beside the text boxes).

My question here is general: What is the best GUI component to implement for this function? The Employee objects (and the number of them) contained in the collection will change each time the program is run. This seems like a case where a table would be appropriate, (with a separate row for each employee and a separate column for each data type (i.e. each variable)), but I'm not sure how exactly to implement one. I've also thought about creating a JPanel class that creates the lines of textboxes, and an empty JFrame into which the appropriate number of JPanels is loaded (with the appropriate employee names) each time the program runs.

I have a feeling, though, that there is a better option, a type of component I'm not familiar with. Is that so? In case it isn't already clear, I'm a new programming student...
Avatar of HonorGod
Flag of United States of America image

Since you are new to programming, it might be best to start with:

Q: What Graphical User Interface (GUI) should I use for my Java application(s)?

A number are available.  I have been working with Swing (which was originally part of the Java Foundation Classes), and have learned a great deal.

If you are totally new to the concept of GUI and event driven applications, I would strongly encourage you to find some good learning material.

I found this to be very good.

Title: Swing: A Beginner's Guide
Author: Herbert Schildt
Publisher: McGraw-Hill Osborne Media

Once you have reference points, you should be better able to decide how best to proceed.

Good luck
Avatar of girionis
Flag of Greece image

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account