package appletPackage; import javax.swing.JApplet; import javax.swing.JButton; import java.awt.event.*; import java.awt.*; public class MainClass extends JApplet,Frame implements ActionListener { private JButton button; private String text = "Screenflashing"; Button btn; public MainClass(){ } public void init(){ button = new JButton(text); button.addActionListener(this); add(button); btn = new Button("Regular button"); btn.addActionListener(this); add(btn); } public void actionPerformed(ActionEvent e){ button.setText("BUAHAHAH."); showStatus("actionPerformed..."); } }
Umm, yeah... I'm trying to make two buttons with seperate actionPerformed functions so I can make them do separate things; how exactly would I do that? Thanks in advance!