Created
September 28, 2016 02:19
-
-
Save kana-ph/29a4e59e668c1ab9c5330857cb8221b1 to your computer and use it in GitHub Desktop.
Sample Applet (yuck)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.swing.*; | |
import java.awt.*; | |
import java.awt.event.ActionEvent; | |
import java.awt.event.ActionListener; | |
public class ApplePen extends JApplet { | |
public void init() { | |
this.setLayout(new GridLayout(3, 1)); | |
this.add(new JLabel("I have a pen.")); | |
this.add(new JLabel("I have an apple.")); | |
JButton button = new JButton("Ugh!"); | |
this.add(button); | |
button.addActionListener(new ActionListener() { | |
@Override | |
public void actionPerformed(ActionEvent e) { | |
JOptionPane.showMessageDialog(null, "Apple Pen!"); | |
} | |
}); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Applet</title> | |
</head> | |
<body> | |
<applet code="ApplePen.class" width="100" height="100" /> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment