Background:
This lesson should give a firm foundation for graphics in Swing
in java to students in high school who know OOP in java (extends
, implements
and abstract
, as well as composition). They are in the school's CS major. This year they need to create a project which is a part of their final grade in the CS major, and part of the requirements are a visible GUI. As of such, a lesson plan was created to teach them one of the ways of making GUI in java. However, this lesson doesn't teach what goes on in the background of java GUI. (unintended pun)
What I have:
Currently the lesson plan is as follows:
Purpose: To teach the basics of creating GUI in java, for the students' final project.
Needed knowledge: Object Oriented Programming, as taught in previous grade (In the previous grade they were taught the concepts listed in the Background section)
Needed materials: Computers, preferably one per student (Students can bring their laptops), Internet connection.
Procedure:
Explain the basic objects inside the
Swing
library:JFrame
,JPanel
etc.Explain the
Container
object inAWT
, and elaborate on howSwing
is heavily dependent onAWT
. All* objects inSwing
are children of objects inAWT
. Also explain theComponent
class object.Show that
Container
essentially contains (hence the fancy name) otherComponent
s and that creates a GUI.Show the students a simple GUI for a chat application (no server-client, just the gui!) which composes of a
JButton
,JTextField
(for entering messages),JTextPane
(chat history) andJLabel
. This step includes showing them the code.let them work for the remaining time (45 mins plus
45-time_it_took_to_get_to_this_step
) on creating a gui of their own, of their choosing, which can have anySwing
object they find. The GUI must haveJLabel
,JButton
andJTextField
. Other than that, go wild.
My problem:
This lesson shows absolutely nothing about what Java does in the background for the GUI. I am talking about the intensive OOP the goes on in the JFrame
class, and the incredible flexibility with everything extending JContainer
(allows JButton
, JLabel
and many others to be treated almost identically).
How could I extends one (or more) of the above steps, or possibly add a new one, that will teach these parts of java GUI? I find that these parts are important for anyone who wants to make Java GUI. Would simply saying what I have written in the previous paragraph be enough?
*Haven't checked, but never seen one that isn't.