Example usage for javax.swing JTextPane setPage

List of usage examples for javax.swing JTextPane setPage

Introduction

In this page you can find the example usage for javax.swing JTextPane setPage.

Prototype

@BeanProperty(expert = true, description = "the URL used to set content")
public void setPage(URL page) throws IOException 

Source Link

Document

Sets the current URL being displayed.

Usage

From source file:net.rptools.maptool.client.AppSetup.java

public static void installLibrary(final String libraryName, final File root) throws IOException {
    // Add as a resource root
    AppPreferences.addAssetRoot(root);//  w w  w  .j  av a  2s  .c  o  m
    if (MapTool.getFrame() != null) {
        MapTool.getFrame().addAssetRoot(root);

        // License
        File licenseFile = new File(root, "License.txt");
        if (!licenseFile.exists()) {
            licenseFile = new File(root, "license.txt");
        }
        if (licenseFile.exists()) {
            final File licenseFileFinal = licenseFile;
            EventQueue.invokeLater(new Runnable() {
                public void run() {
                    try {
                        JTextPane pane = new JTextPane();
                        pane.setPage(licenseFileFinal.toURI().toURL());
                        JOptionPane.showMessageDialog(MapTool.getFrame(), pane, "License for " + libraryName,
                                JOptionPane.INFORMATION_MESSAGE);
                    } catch (MalformedURLException e) {
                        log.error("Could not load license file: " + licenseFileFinal, e);
                    } catch (IOException e) {
                        log.error("Could not load license file: " + licenseFileFinal, e);
                    }
                }
            });
        }
    }
    new SwingWorker<Object, Object>() {
        @Override
        protected Object doInBackground() throws Exception {
            AssetManager.searchForImageReferences(root, AppConstants.IMAGE_FILE_FILTER);
            return null;
        }
    }.execute();
}