GUIs Flashcards
What does MVC stand for?
Model-View-Controller
What is each part of the MVC?
Model - How information is represented internally
View - How information is presented externally
Controller - User input
What part of MVC does Java method calls fit into?
Model
What part of MVC do mouse or keyboard events fit into?
Controller
What part of MVC does the outward appearance of a program fit into?
View
What does GUI stand for?
Graphical User Interface
What does WIMP stand for?
Windows, Icons, Menus, Pointers
What are modern GUI libraries usually called?
Toolkits
What do modern GUI libraries usually contain?
Widgets
What are some examples of widgets?
Buttons, Sliders, Menus
Containers which give structure to the GUI
What are the 2 java GUI libraries?
java. awt (abstract windowing toolkit)
javax. swing (swing library)
How do swing components distinguish themselves from awt components?
They have “J” in front of them (e.g. JList, JMenu)
What is a JFrame?
A window for a GUI in java
How do you create a JFrame object?
JFrame frameName = new JFrame(“frame name”);
What are the 4 options for setDefaultCloseOperation on a JFrame?
DO_NOTHING_ON_CLOSE
HIDE_ON_CLOSE (the default)
DISPOSE_ON_CLOSE (usually best for non-main frame)
EXIT_ON_CLOSE (implemented directly in JFrame and should usually only be done for the main frame)
What are each of the 4 parameters for in setBounds(a,b,c,d) (method for a JFrame)
All parameters are integers.
a and b set position like x-y co-ordinate
c and d set width and height respectively
What is another sizing method for a JFrame as an alternative to setBounds?
pack()
This will size the frame to fit the components within it
What does the setVisible() method do and what parameter does it take?
setVisible takes a boolean value and makes the frame visible or not visible
What are some common components used to populate a JFrame window?
JLabel
JButton
JTextField - one line of editable text
JTextArea - multiple lines of editable text
JCheckbox
JRadioButton - usually part of a ButtonGroup
JComboBox
What is an event?
an event is an object created whenever something happens
Where do events come from?
They are created by a source (usually a widget) and the type of event represents what has happened (e.g. button press, mouse move)
How are events used?
They are ignored or interpreted by listeners