// Job: Jay's Own Browser, a web browser written in Java by Jay Skeer // Copyright (C) 1996 Jay Skeer, Jay Prime Positive // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // // History: // 1996 02 12: Simple stubed hypertext (html) displayer. // 1996 02 13: Added simple fill behavior. // 1996 02 21: got a version which draws text using graphics prims // and began reorganizing the program a bit. // 1996 04 11: released program on the net import java.io.*; import java.awt.*; import HtmlDocumentStream; import HtmlDocumentRegionStream; import HtmlDocumentRegionPanel; /** Html display window panel. */ public class HtmlDocumentPanel extends HtmlDocumentRegionPanel { File url; HtmlDocument doc; boolean url_changed; public HtmlDocumentPanel() { this.url= null; this.doc= null; } public HtmlDocumentPanel(File url) { this.url= url; this.doc= null; } public void showDocument(File url) { this.url= url; url_changed= true; HtmlDocumentStream hds= null; try { Jdb.trace("Try to open Doc_Stream"); hds= new HtmlDocumentStream(url); Jdb.trace("Try to parse Doc_Steam into html doc"); doc= hds.readHtmlDocument(); Jdb.trace("Try to show Doc"); super.showRegions(new HtmlDocumentRegionStream(doc)); // invalidate(); repaint(); } catch (IOException e) { //status("Can't open " + url); } finally { if (null != hds) { try { hds.close(); } catch (IOException e) { //status("Can't close " + url); }; } } } public void showDocument(String url) { showDocument(new File(url)); } public void rebuild_doc() { showDocument(url); } public void xpaint(Graphics g) { Jdb.enter("HDP.paint(g"+g+")"); // if (url_changed) { // rebuild_doc(); // } url_changed= false; super.paint(g); Jdb.exit("HDP.paint()"); } }