Example usage for javax.swing.text.html HTMLEditorKit HTMLEditorKit

List of usage examples for javax.swing.text.html HTMLEditorKit HTMLEditorKit

Introduction

In this page you can find the example usage for javax.swing.text.html HTMLEditorKit HTMLEditorKit.

Prototype

public HTMLEditorKit() 

Source Link

Document

Constructs an HTMLEditorKit, creates a StyleContext, and loads the style sheet.

Usage

From source file:uk.nhs.cfh.dsp.srth.desktop.uiframework.app.impl.ModularApplicationAboutDialog.java

/**
 * Creates the buttons panel.//from   ww w  .  j a  v  a2  s  .c  om
 */
private void createButtonsPanel() {

    JideButton aboutButton = new JideButton(new AbstractAction("About") {

        public void actionPerformed(ActionEvent arg0) {
            // show features in info panel
            infoPane.setText(createHTMLText());
        }
    });

    JideButton featuresButton = new JideButton(new AbstractAction("Features") {

        public void actionPerformed(ActionEvent arg0) {
            // show features in info panel
            if (featuresHtmlURL == null) {
                featuresHtmlURL = ModularApplicationAboutDialog.class.getResource("resources/features.html");
            }

            try {
                infoPane.setEditorKit(new HTMLEditorKit());
                infoPane.setPage(featuresHtmlURL);
            } catch (IOException e) {
                logger.warn("Nested exception is : " + e.fillInStackTrace());
            }
        }
    });

    JButton libsButton = new JideButton(new AbstractAction("Libraries") {

        public void actionPerformed(ActionEvent arg0) {
            // show dependencies in info panel
            if (dependenciesHtmlURL == null) {
                dependenciesHtmlURL = ModularApplicationAboutDialog.class
                        .getResource("resources/dependencies.html");
            }

            try {
                infoPane.setEditorKit(new HTMLEditorKit());
                infoPane.setPage(dependenciesHtmlURL);
            } catch (IOException e) {
                logger.warn("Nested exception is : " + e.fillInStackTrace());
            }
        }
    });

    JButton closeButton = new JButton(new AbstractAction("Close") {

        public void actionPerformed(ActionEvent arg0) {
            setVisible(false);
        }
    });

    JPanel buttonsPanel = new JPanel(new GridLayout(1, 0));
    buttonsPanel.add(aboutButton);
    buttonsPanel.add(featuresButton);
    buttonsPanel.add(libsButton);
    buttonsPanel.add(closeButton);
    mainPanel.add(buttonsPanel, BorderLayout.SOUTH);
}