summaryrefslogtreecommitdiffstats
path: root/tdejava/koala/test/simplebrowser/KSimpleBrowser.java
blob: c798cd6d00483ed95376140742ba7f5ff9a84203 (plain)
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import org.trinitydesktop.qt.*;
import org.trinitydesktop.koala.*;

/**
 *  Class KSimpleBrowser is the main application window.
 *
 *  Taken from KDE 2.0 Development book
 *
 *  Rendering HTML Files
 *
 *  A Simple Web Browser - A feature-limited Web Browser.
 *
 * @see TDEMainWindow
 * @see TDEApplication
 * @see TDEHTMLPart
 *
 * @author java translation Kenneth J. Pouncey, [email protected]
 * @version 0.1
 */

public class KSimpleBrowser extends TDEMainWindow {


   static final int URLLined = 1;

   TDEHTMLPart tdehtmlpart;

   public KSimpleBrowser (String name) {

      super(null,name,0);

      toolBar().insertLined( "", URLLined, TQ_SIGNAL("returnPressed()"),
               this, TQ_SLOT ("slotNewURL()"));


      toolBar().setItemAutoSized(URLLined);

      tdehtmlpart = new TDEHTMLPart(this);
      tdehtmlpart.begin();

      tdehtmlpart.write("<HTML><BODY><H1>KSimpleBrowser</H1>" +
                        "<P>To load a web page, type its URL in the line " +
                        "edit box and press enter,</P>" +
                        "</BODY></HTML>");

      tdehtmlpart.end();

      setCaption("KDE 2 Development book example - KSimpleBrowser");

      setCentralWidget(tdehtmlpart.view());

   }

   public void slotNewURL () {

      tdehtmlpart.openURL(new KURL(this.toolBar().getLinedText(URLLined)))   ;
   }


   static {
      qtjava.initialize();
      tdejava.initialize();
   }

}