-
Question about a project
Hi guys. I have a project in college where I have to write a small menu-driven GUI Application which manipulates two instantiable classes.
Code:
Write a small menu-driven GUI application which manipulates two different instantiable
classes written by you. Each instantiable class should model a different aspect of a system (for
example a Book and a Student, as part of a Library system). Your system should allow you to add,
display and hold in memory in an appropriate data structure instances of each instantiable class, save
the data structure to file and load it up again. Your system should allow the user to process at least one
transaction involving an object from each class (eg process the return of a particular Book by a
particular Student). Your code should be well-structured, divided into methods so that each method
accomplishes one task.
I have no problems writing the two classes. The problem I have is actually implementing them in a GUI. Will the code for my GUI be in another class, like a "Tester Class"? :confused::confused:
-
You should look at Trail: Creating a GUI With JFC/Swing (The Java™ Tutorials) for details on a GUI.
However short answer - i always place my gui stuff in a new class which extends JFrame.
However, you dont have to do this, the main class can also extend JFrame.
-
Personally, I think that you should rarely if ever extend JFrame since you're rarely altering the JFrame's behavior. Better to just use a JFrame.
-
Ok thanks for the advice. I will try out a few things now and post back if I have any problems.