Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

What is a widget in Swing? a. a gui component to provide a single interaction point for the direct manipulation of a given kind of

What is a widget in Swing?

a.

a gui component to provide a single interaction point for the direct manipulation of a given kind of data

b.

a small interactive application to display information or access a function

c.

Both a and b are correct

d.

None of these are correct

If we want to ensure a selection of only 1 option from among many is guaranteed what should we do?

a.

For each category of options, you need to create a ButtonGroup instance and add radio buttons for each option to it

b.

You need to create check boxes for each option and add it to your GUI to see it

c.

You need to create the radio buttons for each option and add it to your GUI to see it

d.

None of these are correct

If you wish to display text using multiple fonts and styles in the same component, with the option to initialize it with HTML from a separate source, you should use which of the following?

a.

JFormattedTextField

b.

JEditorPane

c.

JTextField

d.

JTextPane

A JMenuItem object is technically viewed as what?

a.

Distinctly different from buttons

b.

None of these are correct

c.

A subclass of JMenu

d.

A type of button

Font Metrics and Imageable Area are only determined within what section of code?

a.

The print method

b.

None of these are correct

c.

The paintComponent method

d.

The PageFormat Object at any time

To display a menu you must first have which of the following?

a.

A menu item

b.

A menu object

c.

A panel

d.

A menu bar

What is the root of any Swing based standalone application's containment hierarchy?

a.

A JFrame

b.

A JPanel

c.

A JTextPane

d.

The content pane

Take a look at the following code snippet: public class Main extends JPanel implements ActionListener { JLabel message = new JLabel(); boolean onOff = true; public void actionPerformed(ActionEvent e) { if(onOff) message.setText("Hello"); else message.setText("Goodbye"); onOff = !onOff; } public Main() { JButton b = new JButton("Click Me!"); Timer t = new Timer(1000, this); t.setInitialDelay(1000); t.start(); add(b); add(message); } private static void createAndShowGUI() { System.out.println("Created GUI on EDT? "+ SwingUtilities.isEventDispatchThread()); JFrame f = new JFrame("Basic JFrame"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Main m = new Main(); f.add(m); f.pack(); f.setVisible(true); } ... }

a.

Nothing, the action listener was not correctly registered on the button.

b.

The user will see a label display "Hello" after 1000 seconds, and then say "Goodbye" after 1000 seconds, and constantly alternate between the two.

c.

Nothing, the action listener was not correctly registered on the timer.

d.

The user will see a label display "Hello" after 1 second, and then say "Goodbye" after 1 second, and constantly alternate between the two.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Fundamentals Study Guide

Authors: Dr. Sergio Pisano

1st Edition

B09K1WW84J, 979-8985115307

More Books

Students also viewed these Databases questions

Question

Write short notes on Interviews.

Answered: 1 week ago

Question

Define induction and what are its objectives ?

Answered: 1 week ago