Create an applet that displays an employees title in a TextField when the user types the employee's first names(seperated by a space) in another TextField. Include Labels for each TextField.You can use arrays to store the employees names and titles.Here is what I have thus far:
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class EmployeeTitle extends Applet implements ActionListener {
String occ = ("Mechanic"
TextField tf1;
TextField tf2;
Label name = new Label("Employee Name"
Label title = new Label("Employee Title"
public void init() {
add(name);
tf1 = new TextField(20);
add(tf1);
add(title);
tf2 = new TextField(20);
add(tf2);
}
public void actionPerformed(ActionEvent e){
if(tf1==1){
String occ= tf2.getText();
}
}
}
//Please Help!!! IM going crazy.
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class EmployeeTitle extends Applet implements ActionListener {
String occ = ("Mechanic"
TextField tf1;
TextField tf2;
Label name = new Label("Employee Name"
Label title = new Label("Employee Title"
public void init() {
add(name);
tf1 = new TextField(20);
add(tf1);
add(title);
tf2 = new TextField(20);
add(tf2);
}
public void actionPerformed(ActionEvent e){
if(tf1==1){
String occ= tf2.getText();
}
}
}
//Please Help!!! IM going crazy.