Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java: Part 1 Using the JFrame example from the lectures, create a JFrame with dimensions of 400x300 pixels. Add 2 JLabels, 2 JTextFields, and 2

Java:

Part 1

Using the JFrame example from the lectures, create a JFrame with dimensions of 400x300 pixels. Add 2 JLabels, 2 JTextFields, and 2 JButtons to the form. Using a combination of JPanels and layout managers, arrange the components so that the two JLabels are vertically aligned to the left of mid screen and the two JTextFields are vertically aligned to the right of mid-screen. Thus, label1 will be directly to the left of textField1, and label2 will be directly to the left of textField2.

You will need to set the texts for each of the labels. These will serve as the "prompts" for the text fields. Set the texts for the 2 labels to "Author" and "Title".

The 2 JButtons should be labeled "Process" and "Quit" and should be placed at the bottom of the form in the center. The buttons should take up only as much space as they need. They should not take up the entire bottom of the form.

*****************************************************************************************************

Part 2

Create a listener for this project. The listener should implement the ActionListener, WindowListener, and FocusListener.

For each JTextField, add a focus listener. For each JButton, add an action listener, and for the JFrame itself (this), add a window listener.

Using the focus lost event, change whatever text is entered into each text field to upper case when you exit the text field.

Using the action event, exit the application if the quit button is pressed and change both text fields to lower case if the process button is pressed.

Using the window closing event, exit the application.

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

Students also viewed these Databases questions

Question

Explain how to perform a strategic systems analysis.

Answered: 1 week ago

Question

What is meant by formal organisation ?

Answered: 1 week ago

Question

What is meant by staff authority ?

Answered: 1 week ago

Question

Discuss the various types of policies ?

Answered: 1 week ago

Question

Briefly explain the various types of leadership ?

Answered: 1 week ago