Exam 15: Advanced Gui Topics

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

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

(Multiple Choice)
4.8/5
(83)

Use the ____ layout manager when you need to add components that are displayed one at a time.

(Multiple Choice)
4.7/5
(65)
Match each term with the correct statement below.
Use when you need to add components into a grid of rows and columns; each component is the same size
JPanel
A type of event generated by mouse manipulation
Color class
Resides above the content pane
JScrollPane
Correct Answer:
Verified
Premises:
Responses:
Use when you need to add components into a grid of rows and columns; each component is the same size
JPanel
A type of event generated by mouse manipulation
Color class
Resides above the content pane
JScrollPane
Allows the user to scroll initially invisible parts of the pane into view
MouseEvent
A key that does not generate a character, such as a function key
preferred size
Use when you need to set size, placement, and alignment constraints for every component that you add
GridBagLayout
Use this class to greatly increase the number of possible component arrangements
GridLayout
Can be used with the setBackground() and setForeground() methods of the Component class
glass pane
The default size of a component
action key
(Matching)
4.7/5
(87)

What is an adapter class?

(Essay)
4.7/5
(79)

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      {        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 JPanel s and a GridLayout are used to achieve this effect.

(Essay)
4.7/5
(85)

As you add new Components to a ____ , they are positioned in sequence from left to right  across each row.

(Multiple Choice)
4.7/5
(84)
Showing 61 - 66 of 66
close modal

Filters

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