CSC 216/s08/exercise caution: Difference between revisions
(4 intermediate revisions by 2 users not shown) | |||
Line 24: | Line 24: | ||
Finally, the teams are asked to come one by one to the front of the class to tell their question and give out their answer. The instructor may comment on the answers. | Finally, the teams are asked to come one by one to the front of the class to tell their question and give out their answer. The instructor may comment on the answers. | ||
=== | ===Questions Used to Teach GUI's=== | ||
'''Listeners'''<br> | '''Listeners'''<br> | ||
1. The implementation of listeners in GUI's is an example of _______________ Programming.<br> | 1. The implementation of listeners in GUI's is an example of _______________ Programming.<br> | ||
(a)Modular | (a)Modular | ||
(b)Event Driven | <b>(b)Event Driven</b> | ||
(c)Audable | (c)Audable | ||
<br><br> | <br><br> | ||
2. An ActionListener relies on this method for action processing.<br> | 2. An ActionListener relies on this method for action processing.<br> | ||
(a)actionPerformed | <b>(a)actionPerformed</b> | ||
(b)processExecuted | (b)processExecuted | ||
(c)actionAnswered | (c)actionAnswered | ||
Line 38: | Line 38: | ||
3. This listener was created to combine the MouseListener ad the MouseMotionListener into one listener.<br> | 3. This listener was created to combine the MouseListener ad the MouseMotionListener into one listener.<br> | ||
(a)MultiMouseListner | (a)MultiMouseListner | ||
(b)MouseInputListener | <b>(b)MouseInputListener</b> | ||
(c)CombinedMouseListener | (c)CombinedMouseListener | ||
<br><br> | <br><br> | ||
4. <br> | 4. Is there a MouseListener that monitors the rotary button on a mouse? If so, what is its name?<br> | ||
(a) | (a)No. | ||
(b) | (b)Yes, MouseScrollListener | ||
(c) | <b>(c)Yes, MouseWheelListener</b> | ||
<br><br> | <br><br> | ||
'''MenuBar'''<br> | '''MenuBar'''<br> | ||
Line 50: | Line 50: | ||
(a)JMenuOption | (a)JMenuOption | ||
(b)JMenuChoice | (b)JMenuChoice | ||
(c)JMenuItem | <b>(c)JMenuItem</b> | ||
<br><br> | <br><br> | ||
2. ___________ does <b | 2. ___________ does <b>not</b> have to be done before a background image can be displayed on a MenuBar.<br> | ||
(a)Set the background opacity to false. | (a)Set the background opacity to false. | ||
(b)Override the objects paint menthod. | (b)Override the objects paint menthod. | ||
(c)Set Background to specified image. | <b>(c)Set Background to specified image.</b> | ||
<br><br> | <br><br> | ||
3. ___________ <b>must</b> be added to a menu in order to process menu selection events.<br> | 3. ___________ <b>must</b> be added to a menu in order to process menu selection events.<br> | ||
(a)MouseListener | (a)MouseListener | ||
(b)ActionListener | <b>(b)ActionListener</b> | ||
(c)None, Action management is built into the class. | (c)None, Action management is built into the class. | ||
<br><br> | <br><br> | ||
4. This is the standard Layout used by MenuBars.<br> | 4. This is the standard Layout used by MenuBars.<br> | ||
(a)BoxLayout | <b>(a)BoxLayout</b> | ||
(b)GridLayout | (b)GridLayout | ||
(c)FlowLayout | (c)FlowLayout | ||
<br><br> | <br><br> | ||
'''Graphics'''<br> | '''Graphics'''<br> | ||
1. | 1. The ___________ method is a low-level graphical implementation method that should only be called by the system. If the programmer wants to make the window paint again, he should call ____________.<br> | ||
(a)paint(), rePaint() | <b>(a)paint(), rePaint()</b> | ||
(b)draw(), paint() | (b)draw(), paint() | ||
(c)sketch(), drawWindow() | (c)sketch(), drawWindow() | ||
Line 76: | Line 76: | ||
(a)drawShadedRect() | (a)drawShadedRect() | ||
(b)paintRect3D() | (b)paintRect3D() | ||
(c)draw3DRect() | <b>(c)draw3DRect()</b> | ||
<br><br> | <br><br> | ||
3. What method erases a given rectangular region by filling it in with the backgroundcolor of the current drawing space?<br> | 3. What method erases a given rectangular region by filling it in with the backgroundcolor of the current drawing space?<br> | ||
(a)fillRect() | (a)fillRect() | ||
(b)clearRect() | <b>(b)clearRect()</b> | ||
(c)erase() | (c)erase() | ||
<br><br> | <br><br> | ||
4. Which of the following methods copies a specified area and pastes it in a new loction?<br> | 4. Which of the following methods copies a specified area and pastes it in a new loction?<br> | ||
(a) | <b>(a)copyArea()</b> | ||
(b)move() | (b)move() | ||
(c)drag() | (c)drag() | ||
Line 92: | Line 92: | ||
(a)assignLayout() | (a)assignLayout() | ||
(b)setOrganisation() | (b)setOrganisation() | ||
(c)setLayout() | <b>(c)setLayout()</b> | ||
<br><br> | <br><br> | ||
2. Which of the following sets of constants are used with a BorderLayout?<br> | 2. Which of the following sets of constants are used with a BorderLayout?<br> | ||
(a)NORTH, SOUTH, EAST, WEST | <b>(a)NORTH, SOUTH, EAST, WEST</b> | ||
(b)TOP, BOTTOM, LEFT, RIGHT | (b)TOP, BOTTOM, LEFT, RIGHT | ||
(c)None of the above. | (c)None of the above. | ||
<br><br> | <br><br> | ||
3. Which of the following is <b>not<b> a standard Java Layout?<br> | 3. Which of the following is <b>not</b> a standard Java Layout?<br> | ||
(a)FlowLayout | (a)FlowLayout | ||
(b)GridBagLayout | (b)GridBagLayout | ||
(c)LeftJustifiedLayout | <b>(c)LeftJustifiedLayout</b> | ||
<br><br> | <br><br> | ||
4. Which of the folowing is not a method of JPanel?<br> | 4. Which of the folowing is not a method of JPanel?<br> | ||
(a)setOpaque() | (a)setOpaque() | ||
(b)setPreferredSize() | (b)setPreferredSize() | ||
(c)setBackground() | <b>(c)setBackground()</b> |
Latest revision as of 20:44, 2 April 2008
Four Questions
Testing student's knowledge
This exercise is meant to be a kind of test of previously assigned study material. The preparation for this test is meant to be done before class. It takes about twenty minutes to play from beginning to end.
Participants and props
All the students in the class can participate. The props needed are: 4 flash cards or pieces of paper with questions and a clock or stopwatch.
The script
The instructor assigns some study material for students to study before class. He then writes down four different questions on four different pieces of paper based on the study material. Due to the nature of this game, the questions need to be somewhat difficult and conceptual or subjective in nature.
This game is played in four stages:
Stage 1
At the beginning of the class period, the instructor divides the class into four groups and hands out the pieces of paper to each group. After the rules of the game are explained, the students are given three minutes to discuss the answers to the questions with their team members.
Stage 2
After the three minutes are up, the students are given the option of talking about their question to team members from other groups. The catch is, a student can either ask a question pertaining to what is written on his assigned problem, or the student can answer another students question by responding with both a true and a false answer. This stage also takes three minutes.
Stage 3
After the interrogation stage is over, the students are again allowed to discuss their findings with their teammates for three minutes.
Stage 4
Finally, the teams are asked to come one by one to the front of the class to tell their question and give out their answer. The instructor may comment on the answers.
Questions Used to Teach GUI's
Listeners
1. The implementation of listeners in GUI's is an example of _______________ Programming.
(a)Modular
(b)Event Driven
(c)Audable
2. An ActionListener relies on this method for action processing.
(a)actionPerformed
(b)processExecuted
(c)actionAnswered
3. This listener was created to combine the MouseListener ad the MouseMotionListener into one listener.
(a)MultiMouseListner
(b)MouseInputListener
(c)CombinedMouseListener
4. Is there a MouseListener that monitors the rotary button on a mouse? If so, what is its name?
(a)No.
(b)Yes, MouseScrollListener
(c)Yes, MouseWheelListener
MenuBar
1. This class represents a choice on a dropdown menu.
(a)JMenuOption
(b)JMenuChoice
(c)JMenuItem
2. ___________ does not have to be done before a background image can be displayed on a MenuBar.
(a)Set the background opacity to false.
(b)Override the objects paint menthod.
(c)Set Background to specified image.
3. ___________ must be added to a menu in order to process menu selection events.
(a)MouseListener
(b)ActionListener
(c)None, Action management is built into the class.
4. This is the standard Layout used by MenuBars.
(a)BoxLayout
(b)GridLayout
(c)FlowLayout
Graphics
1. The ___________ method is a low-level graphical implementation method that should only be called by the system. If the programmer wants to make the window paint again, he should call ____________.
(a)paint(), rePaint()
(b)draw(), paint()
(c)sketch(), drawWindow()
2. Which Graphics method draws a rectangle, and then shades the adges to give the illusion of depth?
(a)drawShadedRect()
(b)paintRect3D()
(c)draw3DRect()
3. What method erases a given rectangular region by filling it in with the backgroundcolor of the current drawing space?
(a)fillRect()
(b)clearRect()
(c)erase()
4. Which of the following methods copies a specified area and pastes it in a new loction?
(a)copyArea()
(b)move()
(c)drag()
Layouts/Panels
1. This method is used to assign a Layout type to a panel.
(a)assignLayout()
(b)setOrganisation()
(c)setLayout()
2. Which of the following sets of constants are used with a BorderLayout?
(a)NORTH, SOUTH, EAST, WEST
(b)TOP, BOTTOM, LEFT, RIGHT
(c)None of the above.
3. Which of the following is not a standard Java Layout?
(a)FlowLayout
(b)GridBagLayout
(c)LeftJustifiedLayout
4. Which of the folowing is not a method of JPanel?
(a)setOpaque()
(b)setPreferredSize()
(c)setBackground()