I would appreciate any help (I am very much a beginner in Java) what is this error message and also do I use init() or main() for applet?
Thank you so much
//JavaAirlinesApplet.java ERROR MESSAGE:
/*JavaAirlinesApplet.java:8: JavaAirlinesApplet is not abstract and does not override abstract method actionPerformed(java.awt.event.ActionEvent) in java.awt.event.ActionListener
public class JavaAirlinesApplet extends JApplet
^
1 error*/
Code:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.border.TitledBorder;
import java.text.NumberFormat;
public class JavaAirlinesApplet extends JApplet
implements ActionListener
{
JTextField jtfMessage = new JTextField(20); //created message,label,2radio, button
JLabel jlblPassenger = new JLabel("Enter passenger name");
public JRadioButton jrbCessna, jrb747;
public JRadioButton jrbfirst, jrbsecond;
public JRadioButton jrbVeggie, jrbFish, jrbBeef;
JButton jbtPrintTicket = new JButton("Print Ticket");
public void init()// static void main(String[] args)
{
JFrame JavaAirlines = new JFrame("JavaAirlines");
JavaAirlines.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JavaAirlines.setTitle("JavaAirlines");
JavaAirlines.setSize(500, 200);
JavaAirlines.setVisible(true);
}
public void JavaAirlines()
{ //created message,label, 2 radio, button
JPanel jpTextField = new JPanel();
jpTextField.setLayout(new BorderLayout(1,2));
jpTextField.add(
new JLabel("Enter passenger name"), BorderLayout.WEST);
jpTextField.add(jtfMessage, BorderLayout.CENTER);
getContentPane().add(jpTextField, BorderLayout.NORTH);
jtfMessage.setHorizontalAlignment(JTextField.RIGHT);
JPanel jpRadioButtons = new JPanel();
jpRadioButtons.setLayout(new GridLayout(2, 2));
jpRadioButtons.add(jrbCessna = new JRadioButton("Cessna"));
jpRadioButtons.add(jrb747 = new JRadioButton("747"));
jpRadioButtons.add(jrbfirst = new JRadioButton("747 First Class"));
jpRadioButtons.add(jrbsecond = new JRadioButton("747 Second Class"));
//JPanel jpRadioButtons = new JPanel();
jpRadioButtons.setLayout(new GridLayout(3, 1));
jpRadioButtons.add(jrbVeggie = new JRadioButton("747 Veggie"));
jpRadioButtons.add(jrbFish = new JRadioButton("747 Fish"));
jpRadioButtons.add(jrbBeef = new JRadioButton("747 Beef"));
getContentPane().add(jbtPrintTicket, BorderLayout.SOUTH);
// Create a radio button group to group buttons
ButtonGroup group1 = new ButtonGroup();
group1.add(jrbCessna);
group1.add(jrb747);
group1.add(jrbfirst);
group1.add(jrbsecond);
ButtonGroup group2 = new ButtonGroup();
group2.add(jrbVeggie);
group2.add(jrbFish);
group2.add(jrbBeef);
// Register listeners //created message,2 radio, button
jtfMessage.addActionListener(this);
//jlblPassenger.addActionListener(this); //this line causes error
jrbCessna.addActionListener(this);
jrb747.addActionListener(this);
jrbfirst.addActionListener(this);
jrbsecond.addActionListener(this);
jrbVeggie.addActionListener(this);
jrbFish.addActionListener(this);
jrbBeef.addActionListener(this);
jbtPrintTicket.addActionListener(this);
ButtonListener btListener = new ButtonListener();
JPanel pa = new JPanel();
}
class ButtonListener implements ActionListener {
public void actionPerformed(ActionEvent e){
System.out.println("Print Ticket");
}
}
}