forked from patniemeyer/learningjava
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathShowApplet.java
More file actions
30 lines (27 loc) · 783 Bytes
/
Copy pathShowApplet.java
File metadata and controls
30 lines (27 loc) · 783 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import javax.swing.*;
import java.awt.event.*;
public class ShowApplet extends JApplet {
JTextArea text = new JTextArea();
int startCount;
public void init()
{
JButton button = new JButton("Press Me");
button.addActionListener( new ActionListener() {
public void actionPerformed( ActionEvent e ) {
text.append("Button Pressed!\n");
}
} );
getContentPane().add( "Center", new JScrollPane( text ) );
JPanel panel = new JPanel();
panel.add( button );
getContentPane().add( "South", panel );
text.append( "Java Version: "+System.getProperty("java.version")+"\n" );
text.append( "Applet init()\n" );
}
public void start() {
text.append( "Applet started: "+ startCount++ +"\n" );
}
public void stop() {
text.append( "Applet stopped.\n" );
}
}