review_6 awt, swing, actionlistener, and graphics

Post on 19-Jan-2016

227 Views

Category:

Documents

2 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Review_6

AWT, Swing,ActionListen

er,and

Graphics

What is javax.swing?

If we make a JFrame, what code

do we need to make it show up?

How do we put a JPanel into a

JFrame?

If we do not specify a JFrame to do

EXIT_ON_CLOSE, what happens?

What are JButton and JCheckbox?

How do we set the color to red

in the paintComponent

method?

If we set a JLabel to have a background color, what else do

we need to do to see the color?

How do we change this label to write something

else?

JLabel display = new Jlabel();

In Java, layouts are handled by objects called…

Which layout is the best for quick GUI

design and automatically reacts

to resizing?

Which layout is the best for grouping

and placing components at the center or sides of

your frame?

Which layout is the best for placing all of your components

manually?

Which layout is the best for

automatically placing components

into rows and columns?

What is it called when we put panels with layouts inside

panels with layouts?

What is ActionListener?

What method does the

ActionListener interface have?

Fill in the blank to use

actionlisteners:

public class MyListener ________ ActionListener

What import do we need to use

ActionListeners?

In the following code, what is goes in the

blank?

button.addActionListener(____);

What goes in the blank?

public void actionPerformed(___) {

What code do we use to figure out which button was

clicked?

To paint inside of a JPanel, we first need to make a class that extends Jpanel and

overrides the....

What keyword can we use to refer to the

parent class?

If we want our graphics to resize

with the frame, what methods do we need?

If we want to draw the outline of a circle,

what method should we use?

If we want to draw a filled in rectangle

what method should we use?

The drawPolygon method takes in what

three parameters?

top related