ITP 220 - Exam 3

¡Supera tus tareas y exámenes ahora con Quizwiz!

Swing can be viewed as an improved version of the

AWT

AWT stands for

Abstract Window Toolkit

the method actionPerformed must have a parameter of type ______, even if your definition does not use this parameter

ActionEvent

an action listener is an object whose class implements the ________ interface

ActionListener

menu items fire action events that are received by objects of the class ______

ActionListener

you can have a separate _____ class for each button or menu item, so that each button or menu item has its own unique action listener

ActionListener

if a layout is not specified, the default is

BorderLayout

if some regions are not used, extra space is given to the BorderLayout.____ region (the largest region)

CENTER

a container class is any descendent class of the class

Container

the defined constant _______ sets the close-window button so that, when clicked, nothing happens

DO_NOTHING_ON_CLOSE

objects of the class _______ are used with buttons, menu items, and other objects to specify a size

Dimension

the _______ manager is the simplest layout manager

FlowLayout

GUI stands for

Graphical User Interface

the _____ manager arranges components in a two-dimensional grid with some number of rows and columns

GridLayout

if no action is specified using the method setDefaultCloseOperation, then the default action is JFrame._______

HIDE_ON_CLOSE

create a button object

JButton b = new JButton("Click me")

a ____ object is a basic window, with a border and the usual three buttons

JFrame

the class _____ is a descendent class of the class Container

JFrame

a label is an object of the class ____

JLabel

an object of the class ______ is little more than one line of text that can be added to a JFrame (or to other objects)

JLabel

entries of a menu are objects of the class _____

JMenu

when adding menus, use the three swing classes:

JMenu, JMenuItem, JMenuBar

create a menu bar object

JMenuBar bar = new JMenuBar();

a text area is an object os the class ____

JTextArea

both JTextField and JTextArea are derived classes of the abstract class ___

JTextComponent

the five regions of the BorderLayout are named

NORTH, SOUTH, EAST, WEST, CENTER

window events are objects of the class ______

WindowEvent

an action event includes a string instance variable, known as the _____

action command

every button or menu item has a string associated with it known as the _____

action command

a button fires events known as

action events

action events are handled by listeners known as

action listeners

if a checked exception is thrown in the definition of actionPerformed, it must be caught in ______

actionPerformed (the same)

including the line implements ActionListener at the start of the JFrame definition, _______ method must be defined

actionPerformed()

you cannot add a throws clause to the method __________

actionPerformed()

the ActionListener interface only has one method:

actionPerformed(ActionEvent e)

add a JButton object to a JFrame by using the ___ method

add()

use the method ____ to add menu items to a menu

add()

when using a BorderLayout manager, give the location of the component as the second argument in the method ______

add() (ex. add(label1, BorderLayout.NORTH)

adds the component to the JFrame (method)

add(Component component)

a button's action is programmed by registering a listener with the button using the method ____

addActionListener()

an event is

an object that acts as a signal to another object

if you don't change it, the action command is the string written on the _______ or the ______

button, menu item

a checked exception is one that must be either caught in a _____ block or declared in a ____ clause

catch, throws

when using a GridLayout manager, each component is stretched so that it

completely fills its grid position

classes of objects that contain components that can be arranged by a layout manager

container classes

three kinds of objects to deal with when using a Swing container class

container, components in the container, layout manager

getContentPane returns the ___

content pane

the ______ part is the input part, it relays commends from the user to the model

controller

one of the main functions of JPanel objects is to subdivide a Jframe into

different areas

eliminates the calling frame and all is subcomponents (method)

dispose()

JFrame.DO_NOTHING_ON CLOSE

do nothing (but if there are any registered window listeners, they are invoked)

the AWT package is an older package designed for

doing windowing interfaces

an _____ is the space needed to hold one uppercase M

em space

an exception object, for example, is an

event

swing programs use ___ and ___-handlers

event

methods that handle events

event handlers

signals to objects are things called

events

JFrame.EXIT_ON_CLOSE

exit the application using the System.exit method

sending the event is called

firing the event

setLineWrap(true) means that at the end of a line, any additional characters will appear on the _______

following line of the text area

to set the background color of a JFrame

getContentPane.setBackground(Color);

the method _____ returns the text written in the text field

getText()

JFrame.DISPOSE_ON_CLOSE

hide and dispose the frame invoking any registered window listeners

JFrame.HIDE_ON_CLOSE

hide the frame after invoking any registered WindowListener objects

the import statement for the container class

import java.awt.Container

the AWT library is the package

java.awt

the Dimension class is in the package _____

java.awt

the class Color is in the _____ package

java.awt

the Swing library is in the package

javax.swing

the abstract class JTextComponent is in the package

javax.swing.text

to describe how components are arranged, you need to use a _______

layout manager

the flowlayout manager arranges components one after the other, going ________, in the order in which they were added to the JFrame

left to right

the object receiving the action is the

listener

a common way to set the title of a JFrame is to _____

make the title an argument to the super() constructor

a choice on a menu is called a

menu item

the _____ part of the pattern performs the heart of the application (MVC pattern)

model

in Swing GUIs, an event often represents some action, such as

mouse movement, key press

a text ares is the same as a text field except that it allows ______

multiple lines

an object of the class JPanel that is a simple container class that groups objects

panel

a ____ is the smallest unit of space on which your screen can write

pixel

specify what objects are listeners that will respond to events fired by that button

registering the listener

the two numbers given as arguments to the constructor GridLayout specify the number of _________

rows and columns

setLineWrap(false) means that extra characters will be on the _______

same line and not visible

the method _____ allows you specify that a JTextField or JTextArea can/cannot be written in by a user

setEditable(boolean)

sets the menu bar for the calling frame (method)

setJMenuBar(JMenuBar mb)

this method adds a layout manager to the JFrame class

setLayout( new Layout)

sets the layout manager (method)

setLayout(LayoutManager lm)

the method ____ sets the line-wrapping policy for a JTextArea

setLineWrap(boolean)

JFrameObject._______(WIDTH, HEIGHT) sets the initial size of the window

setSize()

the method _____ can be used to display a new text string in a text field

setText()

sets the title for this frame to the argument string (method)

setTitle(String title)

the method JFrameObject._____(true) makes the JFrame window visible on the screen

setVisible();

a JFrame can use the method _______ to register a window listener

setWindowListener()

Event-driven programming is a programming style that uses a _________ approach to programming

signal-and-response

a method definition that does nothing (or very little) is called a

stub

if no invocation of setEditable is made, then the default state allows _____

the user to change the text in the component

the ___ part is the output part (mvc pattern)

view

sets the action command

void setActionCommand(String actionCommand)

sets the preferred size of the button or label

void setPreferredSize(Dimension preferredSize)

when the user clicks the close-window button, the JFrame fires a ______ event

window


Conjuntos de estudio relacionados

Chapter 2: Perception and the communication process and intrapersonal communication

View Set

Chapter 12 Lifespan; Social and Personality Development in Adolescence

View Set

AP Macroeconomics: Unit 2 Review

View Set

Kyle's Quiz Questions - Study Guide

View Set

FI 320 Exam 2 MC Questions from book

View Set

Common Reproductive Concerns, L&D at Risk, 312 Exam 3

View Set

Accounting for Lawyers - Balance Sheet (financial statements)

View Set

Chapter 7. Introduction to Virtual Private Networks (VPNs)

View Set