Search Header Logo

JButton

Authored by Roma Fronda

Computers

9th - 12th Grade

Used 1+ times

JButton
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 2 pts

Which of the following packages must be imported to create a JButton?

java.swing.JButton

javax.swing.JButton

java.awtJButton

javax.awt.JButton

2.

MULTIPLE CHOICE QUESTION

30 sec • 2 pts

Which statement creates a button?

JButton box = new JButton();

JButton box = JButton();

JBox box = new JBox();

button = new JButton();

3.

MULTIPLE CHOICE QUESTION

30 sec • 2 pts

Which of the following places the button 100 pixels to the right and 50 pixels down from the upper right corner of the frame?

button.setBounds(100, 50, 50, 50);

button.setBounds(50, 100, 50, 50);

button.setBounds(50, 50, 100, 50);

button.setBounds(50, 50, 50, 100);

4.

MULTIPLE CHOICE QUESTION

30 sec • 2 pts

Which of the following buttons has a dimension 100 pixels wide and 50 pixels tall?

button.setBounds(50, 50, 100, 50);

button.setBounds(50, 50, 50, 100);

button.setBounds(100, 50, 50, 50);

button.setBounds(50, 100, 50, 50);

5.

MULTIPLE CHOICE QUESTION

30 sec • 2 pts

Which statement creates a text in the console when a button is clicked?

button.addActionListener(e -> System.out.println("text"));

button.addActionListener(e -> label.setText("text"));

button.add(e -> System.out.println("Like"));

button.add(e -> label.setText("text"));

6.

MULTIPLE CHOICE QUESTION

30 sec • 2 pts

Which statement creates a text in the label when a button is clicked?

button.addActionListener(e -> System.out.println("text"));

button.addActionListener(e -> label.setText("text"));

button.add(e -> System.out.println("Like"));

button.add(e -> label.setText("text"));

7.

FILL IN THE BLANK QUESTION

1 min • 2 pts

What statement adds a text "Click" on the button?

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?