Where do I add the main method update the code so the user can look up an employ
ID: 3659707 • Letter: W
Question
Where do I add the main method update the code so the user can look up an employee and change the position and pay rate as well as add new employees? import javax.swing.*; import java.awt.*; public class PersonnelModPanel extends JPanel { private JTextField nameTextField; private JTextField rateTextField; public void NameRatePanel() { JLabel namePrompt = new JLabel("Employees Name"); nameTextField = new JTextField(10); JLabel ratePrompt = new JLabel("Pay Rate"); rateTextField = new JTextField(10); setLayout(new GridLayout(4, 1)); add (namePrompt); add (nameTextField); add (ratePrompt); add (rateTextField); } public int getEmployeesName() { return Integer.parseInt(nameTextField.getText()); } public String getrate() { return rateTextField.getText(); } public void clear() { nameTextField.setText(""); rateTextField.setText(""); } }Explanation / Answer
/*This may help you*/
import javax.swing.*;
import java.awt.*;
public class PersonnelModPanel extends JPanel {
private JTextField nameTextField;
private JTextField rateTextField;
public void NameRatePanel() {
JLabel namePrompt = new JLabel("Employees Name");
nameTextField = new JTextField(10);
JLabel ratePrompt = new JLabel("Pay Rate");
rateTextField = new JTextField(10);
setLayout(new GridLayout(4, 1));
add(namePrompt);
add(nameTextField);
add(ratePrompt);
add(rateTextField);
}
public int getEmployeesName() {
return Integer.parseInt(nameTextField.getText());
}
public String getrate() {
return rateTextField.getText();
}
public void clear() {
nameTextField.setText("");
rateTextField.setText("");
}
public static void main(String[] args) {
PersonnelModPanel p = new PersonnelModPanel();
p.NameRatePanel();
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.