Exam 15: Advanced Gui Topics

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

Match each term with the correct statement below. -Use when you need to set size, placement, and alignment constraints for every component that you add

(Multiple Choice)
4.8/5
(82)

The following statement produces a dark purple color that has green and blue components, but no red: Color darkPurple = new Color(100, 0, 100);

(True/False)
4.8/5
(70)

The parent class of MouseEvent is ____.

(Multiple Choice)
4.8/5
(84)

A(n) _________________________ is a tree of components that has a top-level container as its root (that is, at its uppermost level).

(Short Answer)
4.9/5
(89)

Which of the following statements will correctly add a JMenuBar named myBar to a JFrame?

(Multiple Choice)
4.8/5
(83)

Match each term with the correct statement below. -A key that does not generate a character, such as a function key

(Multiple Choice)
4.8/5
(74)

Any component you place on the screen has a vertical, or x-axis, position as well as a horizontal, or y-axis, position in the window.

(True/False)
4.9/5
(85)

With ____, a redrawn JPanel is displayed only when it is complete; this provides the viewer with updated screens that do not flicker while being redrawn.

(Multiple Choice)
4.7/5
(75)

To force the display of a scroll bar, you can use class variables defined in the ScrollPaneConstants class. What are they?

(Essay)
4.8/5
(71)

Describe the way in which components expand to fill their layout areas in FlowLayout and BorderLayout.

(Essay)
4.9/5
(72)

How would you arrange columns into equal rows and columns? Provide an example.

(Essay)
4.9/5
(79)

Using a FlowLayout object named myLayout, write the statement to set the layout of a content pane to left.

(Essay)
4.8/5
(74)

Clicking an item in a list box results in a(n) ____.

(Multiple Choice)
4.8/5
(85)

The state of a JCheckBoxMenuItem or JRadioButtonMenuItem can be determined with the ____ method.

(Multiple Choice)
4.7/5
(89)

If you do not specify alignment, Components are right-aligned in a FlowLayout Container by default.

(True/False)
4.9/5
(69)

Match each term with the correct statement below. -Resides above the content pane

(Multiple Choice)
4.9/5
(87)

The JMenus are added to the JMenuBar using the ____ method.

(Multiple Choice)
4.7/5
(87)

You use the getModifiers() method with an InputEvent object, and you can assign the return value to a(n) ____ variable.

(Multiple Choice)
4.9/5
(71)

Which of the following statements will set the background color of a button named stop to a color of red?

(Multiple Choice)
4.8/5
(61)

import java.awt.*; import javax.swing.*; import java.awt.Color; public class Checkerboard extends JFrame { private final int ROWS = 8; private final int COLS = 8; private final int GAP = 2; private final int NUM = ROWS * COLS; private int x; private JPanel pane = new JPanel (new GridLayout(ROWS, COLS, GAP, GAP)); private JPanel[] panel = new JPanel[NUM]; private Color color1 = Color.WHITE; private Color color2 = Color.BLUE; private Color tempColor; public Checkerboard() { super("Checkerboard"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); add(pane); for(x = 0; x < NUM; ++x) { panel[x] = new JPanel(); pane.add(panel[x]); if(x % COLS == 0) { tempColor = color1; color1 = color2; color2 = tempColor; } if(x % 2 == 0) panel[x].setBackground(color1); else panel[x].setBackground(color2); } } public static void main(String[] args) { Checkerboard frame = new Checkerboard(); final int SIZE = 300; frame.setSize(SIZE, SIZE); frame.setVisible(true); } } The above code creates a loop to fill even-positioned squares with one color and odd-positioned squares with another color, resulting in a checkerboard pattern. Describe how JPanels and a GridLayout are used to achieve this effect.

(Essay)
4.8/5
(79)
Showing 21 - 40 of 69
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)