GUI programming

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

What is a frame in java

It is a window with borders and can contain other GUI components

What does the constructor below do? JFrame frame = new JFrame("Test Frame 1");

Creates a JFrame object while setting the name of the frame to Test Frame 1

What does GUI stand for?

Graphical User Interface

What does the add() method do?

It adds GUI components to the JFrame object

What is the FlowLayout Manager?

The FlowLayout manager puts components into the frame row by row in the order they are added.

What does the swing package contain?

The GUI components necessary like windows and buttons

What is the component class?

The abstract Component class is the base class for the AWT. Many AWT classes are derived from it. These are the old AWT components that are no longer in use.

Compare and contrast swing and AWT components

The older AWT components are similar to Swing components, but Swing components are more versatile. Also, Swing integrates smoothly with the Java Foundation Classes

Why does nothing happen when you click a newly created button

There are no listener methods created for it yet

What are swing components?

They are based off of the older fundamental classes of the AWT. These components come with newer classes

What are characteristics of all swing classes

They can contain components, they themselves can be placed inside containers, they can be displayed on the monitor, they generate events, and they register event listeners.

What do layout managers do?

They can help decide the size and where components will go without you specifying. However with specifications of which layout manager the container will use the default which can lead to odd results

What does the setBounds(x,y,h,w) method

This puts the upper left corner at location (x, y), where x is number of pixels from the left of the screen and y is the number from the top of the screen. height and width are as before.

If you forget to call setDefaultCloseOperation() what happens?

you will get JFrame.HIDE_ON_CLOSE by default (hides frame but keeps the program running)

What is event driven programming?

Events are in order according to the user not the console (The console does not prompt the user to do something)

What does a GUI consist of?

graphical components like windows, buttons, menus, and text fields

How to import all classes of the swing and AWT packages

import java.awt.*; import javax.swing.*;

What must be imported when dealing with events

java.awt.event.*

When you hover over something on a website and something happens what is it called?

mouseOver event.

What are the 3 parts of a GUI program

-*Graphical Components* that make up the Graphical User Interface. -*Listener methods* that receive the events and respond to them. -*Application methods* that do useful work for the user.

How does a user control a GUI application class

A GUI application program shows the user a graphical interface containing several graphical components. The user controls the application by interacting with the graphical components

To be able to respond to events, a program must:

1. Create an event listener object for the type of event. 2. Register the listener object with the GUI component that generates the event (or with a component that contains it).

What is the one graphical component that (nearly) all GUI programs must have?

A window

What type of class is the component class?

Abstract

A button listener must implement...

ActionListener interface. ActionListener is an interface (not a class) that contains a single method: public void actionPerformed( ActionEvent evt) ;

What is an event?

An action done by the user interacting with GUI

What does the method setDefaultCloseOperation() do?

It sets what the close button does

What letter starts the name of many Swing classes?

J (AWT doesn't)

What is the name of the Swing class that defines buttons?

JButton

What is the base class of nearly all Swing classes?

JComponent

Can a JButton contain something?

YES

Can a container contain another container?

YES

what is a container, what is an example?

container is an object that can hold other GUI components, a window


Conjuntos de estudio relacionados

Basecamp: Breath Sounds and Voices

View Set

APUSH Unit 6 Amsco Questions Review

View Set

End-Tidal Carbon Dioxide Monitoring

View Set