package nl.tudelft.simulation.dsol.swing.gui; import java.awt.Toolkit; import java.io.IOException; import java.net.URL; import javax.swing.JEditorPane; import javax.swing.JFrame; import javax.swing.JScrollPane; import org.djutils.logger.Cat; import org.djutils.logger.CategoryLogger; /** *

* Copyright (c) 2002-2019 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights * reserved. See for project information * https://simulation.tudelft.nl. The DSOL project is distributed under a three-clause BSD-style license, which can * be found at * https://simulation.tudelft.nl/dsol/3.0/license.html. *

* @author Mingxin Zhang * @author Alexander Verbraeck */ public class HTMLPanel extends JEditorPane { /** */ private static final long serialVersionUID = 1L; /** * Construct an HTML panel for the user interface. */ public HTMLPanel() { super(); super.setEditable(false); this.setPreferredSize(Toolkit.getDefaultToolkit().getScreenSize()); } /** * Construct an HTML panel for the user interface. * @param page URL; the URL of the page to display in the panel. * @throws IOException in case page cannot be loaded */ public HTMLPanel(final URL page) throws IOException { this(); this.setPage(page); } /** {@inheritDoc} */ @Override public void setPage(final URL page) throws IOException { try { super.setPage(page); } catch (Exception e) { CategoryLogger.filter(Cat.SWING).warn(e.getMessage()); } } /** * Method main. * @param args String[]; arguments for main * @throws Exception on error */ public static void main(String[] args) throws Exception { if (args.length != 1) { System.out.println("Usage: java nl.tudelft.simulation.dsol.gui.HTMLPanel [url]"); System.exit(0); } JFrame app = new JFrame("HTMLPanel, (c) 2003-2019 Delft University of Technology"); app.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); app.setContentPane(new JScrollPane(new HTMLPanel(new URL(args[0])))); app.setVisible(true); } }