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
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/48
Play
Full screen (f)
Deck 12: Advanced Guis and Graphics
1
The class Container is the superclass of all the classes designed to provide a GUI.
True
2
An applet invokes the methods start, init, stop, paint, and destroy in sequence.
False
3
The class Graphics is an abstract class.
True
4
The R in RGB stands for Right.
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
5
You can close an applet by closing the HTML document in which the applet is embedded.
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
6
Applets do not have titles.
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
7
You can create an applet by extending the class JFrame.
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
8
The paint method is used to get data from the user.
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
9
Like Java application programs, Java applets have the method main.
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
10
Unlike application programs, when you compile a Java applet, no .class file is produced.
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
11
The class Graphics provides methods for drawing items such as lines, ovals, and rectangles on the screen.
Unlock Deck
Unlock for access to all 48 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 48 flashcards in this deck.
Unlock Deck
k this deck
13
You cannot convert a GUI application into an applet.
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
14
You can create instances of Color by mixing red, green, and blue hues in various proportions.
Unlock Deck
Unlock for access to all 48 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 48 flashcards in this deck.
Unlock Deck
k this deck
16
A Java applet is the same as a Java GUI application program.
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
17
JCheckBox is a subclass of the abstract class ToggleButton.
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
18
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 48 flashcards in this deck.
Unlock Deck
k this deck
19
Applets use the init method in place of constructors to initialize various GUI components and data members.
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
20
You must import the package javax.swing in order to use the methods in the class Font.
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
21
Clicking on a JCheckBox generates an item event.
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
22
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 48 flashcards in this deck.
Unlock Deck
k this deck
23
The graphic in the accompanying figure is an example of ____.
A) check boxes
B) radio buttons
C) a combo box
D) a text area
A) check boxes
B) radio buttons
C) a combo box
D) a text area
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
24
Given Graphics object g, what method call is used to draw a line from X = 10, Y = 20 to X = 80, Y = 40?
A) g.drawLine(10, 80, 20, 40);
B) g.drawLine(10, 20, 80, 40);
C) g.drawLine(10, 20, 40, 80);
D) g.drawLine((10, 20), (80, 40));
A) g.drawLine(10, 80, 20, 40);
B) g.drawLine(10, 20, 80, 40);
C) g.drawLine(10, 20, 40, 80);
D) g.drawLine((10, 20), (80, 40));
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
25
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 48 flashcards in this deck.
Unlock Deck
k this deck
26
How many inches is 12-point font?
A) 1/6
B) 1
C) 6
D) 72
A) 1/6
B) 1
C) 6
D) 72
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
27
What class must be extended when you create an applet?
A) AWT
B) JDK
C) JApplet
D) Graphics
A) AWT
B) JDK
C) JApplet
D) Graphics
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
28
A JComboBox generates an ItemEvent.
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
29
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 48 flashcards in this deck.
Unlock Deck
k this deck
30
Applets are embedded in ____ documents.
A) HTTP
B) TCP
C) HTML
D) VRML
A) HTTP
B) TCP
C) HTML
D) VRML
Unlock Deck
Unlock for access to all 48 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 48 flashcards in this deck.
Unlock Deck
k this deck
32
What class can be used to generate a random number?
A) JApplet
B) Graphics
C) Math
D) RandomNumber
A) JApplet
B) Graphics
C) Math
D) RandomNumber
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
33
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 48 flashcards in this deck.
Unlock Deck
k this deck
34
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 48 flashcards in this deck.
Unlock Deck
k this deck
35
Which of the following methods does the class JTextArea inherit from the class JTextComponent?
A) setLineWrap()
B) setTabsize()
C) setColumns()
D) setText()
A) setLineWrap()
B) setTabsize()
C) setColumns()
D) setText()
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
36
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 48 flashcards in this deck.
Unlock Deck
k this deck
37
Which applet method is called by the Web browser to display the applet to the screen?
A) drawApplet()
B) paint()
C) paintApplet()
D) setApplet()
A) drawApplet()
B) paint()
C) paintApplet()
D) setApplet()
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
38
Item events are handled by the interface ItemListener, which contains only the abstract method itemStateChanged.
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
39
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 48 flashcards in this deck.
Unlock Deck
k this deck
40
To draw a rectangle filled with the current color, you can use the method ____.
A) drawRect()
B) fillRect()
C) drawOval()
D) fillOval()
A) drawRect()
B) fillRect()
C) drawOval()
D) fillOval()
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
41
Which of the following is NOT included in the Java applet in the accompanying figure?
A) Check box
B) Radio button
C) Combo box
D) List
A) Check box
B) Radio button
C) Combo box
D) List
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
42
Which of the following mouse events is handled by the interface MouseMotionListener?
A) mouseExited
B) mouseReleased
C) mouseDragged
D) mousePressed
A) mouseExited
B) mouseReleased
C) mouseDragged
D) mousePressed
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
43
Which of the following is the default layout manager for a Java application?
A) null
B) GridLayout
C) FlowLayout
D) BorderLayout
A) null
B) GridLayout
C) FlowLayout
D) BorderLayout
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
44
A mouse can generate ____ different types of events.
A) three
B) five
C) seven
D) nine
A) three
B) five
C) seven
D) nine
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
45
When you press a meta key, the method ____ is executed.
A) metaKeyPressed
B) keyPressed
C) keyDown
D) keyTyped
A) metaKeyPressed
B) keyPressed
C) keyDown
D) keyTyped
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
46
menuMB.add(fileMenu);
MenuMB.add(editMenu);
MenuMB.add(viewMenu);
MenuMB.add(insertMenu);Which menu will appear first if it is added to the menu bar in the order shown in the accompanying figure?
A) fileMenu
B) editMenu
C) viewMenu
D) insertMenu
MenuMB.add(editMenu);
MenuMB.add(viewMenu);
MenuMB.add(insertMenu);Which menu will appear first if it is added to the menu bar in the order shown in the accompanying figure?
A) fileMenu
B) editMenu
C) viewMenu
D) insertMenu
Unlock Deck
Unlock for access to all 48 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
B) FlowLayout
C) BorderLayout
D) EvenLayout
A) GridLayout
B) FlowLayout
C) BorderLayout
D) EvenLayout
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
48
When you type a regular alphanumeric key, the ____ method is executed.
A) keyPressed
B) keyTyped
C) keyDown
D) keyUp
A) keyPressed
B) keyTyped
C) keyDown
D) keyUp
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck