Java Reference
In-Depth Information
Figure 22.1 The online monitor for the DAX stock index
to add new data, access the present data, and to get information necessary for
scaling the data so it fits into the display. The display is implemented in class
MonitorPanel
which is derived from
JPanel
. Class
OnlineMonitor
is derived
from
JFrame
.Ithas a
MonitorPanel
embedded and also contains the
main
-method
for starting the application. A screen shot is shown in Figure 22.1.
File:
its/OnlineMonitor/MonitorThread.java
1.
package
its.OnlineMonitor;
2.
3.
4.
import
java.io.BufferedReader;
5.
import
java.io.InputStreamReader;
6.
import
java.net.URL;
7.
import
java.util.StringTokenizer;
8.
9.
public class
MonitorThread
extends
Thread{
10.
11.
private static final long
delay = 5000;
12.
private
String yahooDax =
13.
"http://de.finance.yahoo.com/d/quotes.csv?s=@ˆGDAXI&"+
"f=sl1d1t1c1ohgv&e=.csv";
14.
private
MonitorPanel moniPane;
15.
private
boolean goOn;
16.
17.
public
MonitorThread(MonitorPanel mp){
18.
moniPane = mp;
19.
goOn
=
true
;
20.
}
21.
Search WWH ::
Custom Search