Difference between revisions of "Code for stopwatch applet"
From MyWiki
(Created page with "<source lang="java"> </source>") |
|||
| Line 1: | Line 1: | ||
<source lang="java"> | <source lang="java"> | ||
| + | /* | ||
| + | A trivial applet that tests the StopWatchRunner component. | ||
| + | The applet just creates and shows a StopWatchRunner. | ||
| + | */ | ||
| + | |||
| + | |||
| + | import java.awt.*; | ||
| + | import javax.swing.*; | ||
| + | |||
| + | public class Test1 extends JApplet { | ||
| + | |||
| + | public void init() { | ||
| + | |||
| + | StopWatch watch = new StopWatch(); | ||
| + | watch.setFont( new Font("SansSerif", Font.BOLD, 24) ); | ||
| + | watch.setBackground(Color.white); | ||
| + | watch.setForeground( new Color(180,0,0) ); | ||
| + | watch.setOpaque(true); | ||
| + | getContentPane().add(watch, BorderLayout.CENTER); | ||
| + | |||
| + | } | ||
| + | |||
| + | } | ||
Revision as of 12:47, 23 December 2015
/* A trivial applet that tests the StopWatchRunner component. The applet just creates and shows a StopWatchRunner. */ import java.awt.*; import javax.swing.*; public class Test1 extends JApplet { public void init() { StopWatch watch = new StopWatch(); watch.setFont( new Font("SansSerif", Font.BOLD, 24) ); watch.setBackground(Color.white); watch.setForeground( new Color(180,0,0) ); watch.setOpaque(true); getContentPane().add(watch, BorderLayout.CENTER); } }