CS51 - Fall 2009 - Lecture 15
basic GUIs
create the gui item and initialize it if necessary
add the item to the content pane of the WindowController
validate
for an example, see
ComboBoxDrawingProgram
event handling
for an example, see
DoubleComboBoxDrawing
modifying so that color of new shape determined by setting of color menu at that time:
ColorfulDoubleComboBoxDrawing
notice how private method setColor is used
JPanels
grouping together the two GUI elements:
PanelComboBoxDrawing
Buttons
grouping together the two GUI elements:
BadButtonPanelDrawingProgram
make it look a little better:
ButtonPanelDrawingProgram
notice how the actionPerformed method determines which GUI item triggered the listener
notice how GridLayout is used