Question
Would anyone be able to assist? Example 1: // 1. What are the following import statements for? // 2. Why do we need each one?
Would anyone be able to assist?
Example 1:
// 1. What are the following import statements for?
// 2. Why do we need each one?
import javax.swing.*; // Why do we need this? import java.awt.*; // Why do we need this? import java.awt.event.*; // Why do we need this? import java.util.*; // Why do we need this? import java.math.*; // Why do we need this?
Example 2:
// Test field
// 1. What is a JLabel?
// 2. How do you create a JLabel?
// 3. What does SwingConstants.RIGHT mean? t1L = new JLabel("Test score 1: ", SwingConstants.RIGHT); t2L = new JLabel("Test score 2: ", SwingConstants.RIGHT); t3L = new JLabel("Test score 3: ", SwingConstants.RIGHT); t4L = new JLabel("Test score 4: ", SwingConstants.RIGHT);
Example 3:
// Text field
// 1. What is a JTextField?
// 2. How do you create a JTextField?
// 3. What does setHorizontalAlignment(JTextField.CENTER); mean?
t1TF = new JTextField(0, 5); t1TF.setHorizontalAlignment(JTextField.CENTER); t2TF = new JTextField(0, 5); t2TF.setHorizontalAlignment(JTextField.CENTER); t3TF = new JTextField(0, 5); t3TF.setHorizontalAlignment(JTextField.CENTER); t4TF = new JTextField(0, 5); t4TF.setHorizontalAlignment(JTextField.CENTER);
Example 4:
// Calc button.
// 1. What is a JButton?
// 2. How do you create a JButton?
// 3. What is a CalculateButtonHandler()?
// 4. How do you create a CalculateButtonHandler()?
// 5. What is an ActionListener? Where is it in our textbook? calculateB = new JButton("Calculate"); cbHandler = new CalculateButtonHandler(); calculateB.addActionListener(cbHandler);
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started