Deck 12: Advanced Guis and Graphics
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/49
Play
Full screen (f)
Deck 12: Advanced Guis and Graphics
1
The R in RGB stands for Right.
False
2
You can create an applet by extending the class JFrame.
False
3
Unlike application programs, when you compile a Java applet, no .class file is produced.
False
4
The class Container is the superclass of all the classes designed to provide a GUI.
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
5
You must import the package javax.swing in order to use the methods in the class Font.
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
6
You can use the methods Background and Foreground to set the background and foreground colors of a component.
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
7
Applets use the init method in place of constructors to initialize various GUI components and data members.
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
8
Applets do not have titles.
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
9
The paint method is used to get data from the user.
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
10
The class Graphics provides methods for drawing items such as lines, ovals, and rectangles on the screen.
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
11
An applet invokes the methods start, init, stop, paint, and destroy in sequence.
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
12
The class JComponent is part of the package javax.swing.
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
13
You can create instances of Color by mixing red, green, and blue hues in various proportions.
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
14
JCheckBox is a subclass of the abstract class ToggleButton.
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
15
JTextAreas can be used to display multiple lines of text.
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
16
Like Java application programs, Java applets have the method main.
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
17
A Java applet is the same as a Java GUI application program.
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
18
You can close an applet by closing the HTML document in which the applet is embedded.
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
19
The class Graphics is an abstract class.
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
20
You cannot convert a GUI application into an applet.
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
21
How many inches is 12-point font?
A) 1/6
C) 6
B) 1
D) 72
A) 1/6
C) 6
B) 1
D) 72
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
22
Does an applet compile like any other Java application program?
A) No -- applets do not produce a .class file because they don't have a main method.
B) Yes -- except the Web browser compiles the applet code.
C) Yes -- it is compiled as an application program and produces a .class file.
D) No -- applets are .applet files and not .java files.
A) No -- applets do not produce a .class file because they don't have a main method.
B) Yes -- except the Web browser compiles the applet code.
C) Yes -- it is compiled as an application program and produces a .class file.
D) No -- applets are .applet files and not .java files.
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
23
Which of the following methods does the class JTextArea inherit from the class JTextComponent?
A) setLineWrap()
C) setColumns()
B) setTabsize()
D) setText()
A) setLineWrap()
C) setColumns()
B) setTabsize()
D) setText()
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
24
Given Graphics object graph, which statement can you use to change the pen color to red?
A) graph.setColor(Color.red);
B) graph.setPen(Color.red);
C) setForeground(red);
D) graph.getRed();
A) graph.setColor(Color.red);
B) graph.setPen(Color.red);
C) setForeground(red);
D) graph.getRed();
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
25
If graph holds a Graphics object, which of the following puts "CAT" starting at X = 20, Y = 50?
A) drawString("CAT", 20, 50);
B) graph.drawString(20, 50, "CAT");
C) graph.println("CAT");
D) graph.drawString("CAT", 20, 50);
A) drawString("CAT", 20, 50);
B) graph.drawString(20, 50, "CAT");
C) graph.println("CAT");
D) graph.drawString("CAT", 20, 50);
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
26
Which applet method is called by the Web browser to display the applet to the screen?
A) drawApplet()
C) paintApplet()
B) paint()
D) setApplet()
A) drawApplet()
C) paintApplet()
B) paint()
D) setApplet()
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
27
What class must be extended when you create an applet?
A) AWT
C) JApplet
B) JDK
D) Graphics
A) AWT
C) JApplet
B) JDK
D) Graphics
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
28
Which of the following sets the background color of the applet to white?
A) setAppletColor(white);
B) setBackground(white);
C) setBackground(Color.white);
D) setAppletColor(white);
A) setAppletColor(white);
B) setBackground(white);
C) setBackground(Color.white);
D) setAppletColor(white);
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
29
What HTML tags begin and end a Web page?
A)
C)
B)
D)
A)
C)
B)
D)
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
30
A JComboBox generates an ItemEvent.
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
31
Which of the following constructors would produce the color white?
A) Color whiteColor = new Color(0, 0, 0);
B) Color whiteColor = new Color(255, 0, 0);
C) Color whiteColor = new Color(255, 255, 0);
D) Color whiteColor = new Color(255, 255, 255);
A) Color whiteColor = new Color(0, 0, 0);
B) Color whiteColor = new Color(255, 0, 0);
C) Color whiteColor = new Color(255, 255, 0);
D) Color whiteColor = new Color(255, 255, 255);
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
32
The layout manager FlowLayout places components in the container from left to right and centered, by default, until no more items can be placed.
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
33
To draw a rectangle filled with the current color, you can use the method ____.
A) drawRect()
C) drawOval()
B) fillRect()
D) fillOval()
A) drawRect()
C) drawOval()
B) fillRect()
D) fillOval()
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
34
Clicking on a JCheckBox generates an item event.
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
35
Given Graphics object graph, which of the following draws a circle with a radius of 50, at X = 20, Y = 30?
A) graph.drawCircle(50);
B) graph.drawCircle(50, 50, 20, 30);
C) graph.drawOval(50, 50);
D) graph.drawOval(20, 30, 50, 50);
A) graph.drawCircle(50);
B) graph.drawCircle(50, 50, 20, 30);
C) graph.drawOval(50, 50);
D) graph.drawOval(20, 30, 50, 50);
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
36
JRadioButtons are useful when you want to give the user the ability to select more than one of the presented options.
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
37
Item events are handled by the interface ItemListener, which contains only the abstract method itemStateChanged.
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
38
Which of the options in the accompanying figure is a correct Web page for the applet WelcomeHomeApplet?
A) A
C) C
B) B
D) D
A) A
C) C
B) B
D) D
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
39
What class can be used to generate a random number?
A) JApplet
C) Math
B) Graphics
D) RandomNumber
A) JApplet
C) Math
B) Graphics
D) RandomNumber
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
40
Applets are embedded in ____ documents.
A) HTTP
C) HTML
B) TCP
D) VRML
A) HTTP
C) HTML
B) TCP
D) VRML
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
41
The graphic in the accompanying figure is an example of ____.
A) check boxes
C) a combo box
B) radio buttons
D) a text area
A) check boxes
C) a combo box
B) radio buttons
D) a text area
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
42
Which of the following mouse events is handled by the interface MouseMotionListener?
A) mouseExited
C) mouseDragged
B) mouseReleased
D) mousePressed
A) mouseExited
C) mouseDragged
B) mouseReleased
D) mousePressed
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
43
When you press a meta key, the method ____ is executed.
A) metaKeyPressed
C) keyDown
B) keyPressed
D) keyTyped
A) metaKeyPressed
C) keyDown
B) keyPressed
D) keyTyped
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
44
When you type a regular alphanumeric key, the ____ method is executed.
A) keyPressed
C) keyDown
B) keyTyped
D) keyUp
A) keyPressed
C) keyDown
B) keyTyped
D) keyUp
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
45
Which of the following is NOT included in the Java applet in the accompanying figure?
A) Check box
C) Combo box
B) Radio button
D) List
A) Check box
C) Combo box
B) Radio button
D) List
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
46
Which menu will appear first if it is added to the menu bar in the order shown in the accompanying figure?
A) fileMenu
C) viewMenu
B) editMenu
D) insertMenu
A) fileMenu
C) viewMenu
B) editMenu
D) insertMenu
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
47
In which of the following layout managers do all rows (columns) have the same number of components and all components have the same size?
A) GridLayout
C) BorderLayout
B) FlowLayout
D) EvenLayout
A) GridLayout
C) BorderLayout
B) FlowLayout
D) EvenLayout
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
48
Which of the following is the default layout manager for a Java application?
A) null
C) FlowLayout
B) GridLayout
D) BorderLayout
A) null
C) FlowLayout
B) GridLayout
D) BorderLayout
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
49
A mouse can generate ____ different types of events.
A) three
C) seven
B) five
D) nine
A) three
C) seven
B) five
D) nine
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck