Search in sources :

Example 31 with JEditorPane

use of javax.swing.JEditorPane in project knime-core by knime.

the class AggregationMethods method createDescriptionPane.

/**
 * Creates a {@link JScrollPane} that lists all available aggregation
 * methods and a short description of each method.
 *
 * @return a {@link JScrollPane} that can be added to any dialog to display
 * all available aggregation methods and their description.
 */
public static JScrollPane createDescriptionPane() {
    final StringBuilder buf = getHTMLDescription();
    final JEditorPane editorPane = new JEditorPane("text/html", buf.toString());
    editorPane.setEditable(false);
    final JScrollPane scrollPane = new JScrollPane(editorPane, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    return scrollPane;
}
Also used : JScrollPane(javax.swing.JScrollPane) JEditorPane(javax.swing.JEditorPane)

Example 32 with JEditorPane

use of javax.swing.JEditorPane in project vcell by virtualcell.

the class BioPaxObjectPropertiesPanel method main.

public static void main(String[] argv) {
    JEditorPane jep = new JEditorPane("text/html", "The rain in <a href='http://foo.com/'>" + "Spain</a> falls mainly on the <a href='http://bar.com/'>plain</a>.");
    jep.setEditable(false);
    jep.setOpaque(false);
    jep.addHyperlinkListener(new HyperlinkListener() {

        public void hyperlinkUpdate(HyperlinkEvent hle) {
            if (HyperlinkEvent.EventType.ACTIVATED.equals(hle.getEventType())) {
                System.out.println(hle.getURL());
            }
        }
    });
    JEditorPane jep1 = new JEditorPane("text/html", "ala bala por to calaala bala por to calaala bala por to calaala bala por to calaala bala por to cala");
    jep1.setEditable(false);
    jep1.setOpaque(false);
    JPanel p = new JPanel();
    p.add(new JLabel("Foo."));
    p.add(jep);
    p.add(new JLabel("Bar."));
    p.add(new JEditorPane("text", "ala bala por to calaala bala por to calaala bala por to calaala bala por to calaala bala por to cala"));
    p.add(jep1);
    JFrame f = new JFrame("HyperlinkListener");
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.getContentPane().add(p, BorderLayout.CENTER);
    f.setSize(400, 150);
    f.setVisible(true);
}
Also used : JPanel(javax.swing.JPanel) HyperlinkEvent(javax.swing.event.HyperlinkEvent) HyperlinkListener(javax.swing.event.HyperlinkListener) JFrame(javax.swing.JFrame) JEditorPane(javax.swing.JEditorPane) JLabel(javax.swing.JLabel)

Example 33 with JEditorPane

use of javax.swing.JEditorPane in project vcell by virtualcell.

the class SpeciesPropertiesPanel method getPCLinkValueEditorPane.

private JEditorPane getPCLinkValueEditorPane() {
    if (PCLinkValueEditorPane == null) {
        PCLinkValueEditorPane = new JEditorPane();
        PCLinkValueEditorPane.setContentType("text/html");
        PCLinkValueEditorPane.setEditable(false);
        PCLinkValueEditorPane.setBackground(UIManager.getColor("TextField.inactiveBackground"));
        PCLinkValueEditorPane.setText(null);
    }
    return PCLinkValueEditorPane;
}
Also used : JEditorPane(javax.swing.JEditorPane)

Example 34 with JEditorPane

use of javax.swing.JEditorPane in project processdash by dtuma.

the class BlameHistoryDialog method showCalculationError.

public void showCalculationError(Throwable calcError) {
    calcError.printStackTrace();
    ProjectHistoryException phe;
    if (calcError instanceof ProjectHistoryException) {
        phe = (ProjectHistoryException) calcError;
    } else if (projectHistory != null) {
        phe = projectHistory.wrapException(calcError);
    } else {
        phe = new ProjectHistoryException(calcError, "Dir.Cannot_Read_HTML_FMT", dataLocation);
    }
    String title = resources.getString("Message.Error");
    String message = "<html><div style='width:400px'>" + phe.getHtml() + "</div></html>";
    JEditorPane pane = new JEditorPane("text/html", message);
    pane.setEditable(false);
    pane.setBackground(null);
    JOptionPane.showMessageDialog(this, pane, title, JOptionPane.ERROR_MESSAGE);
    showReadyMessage();
}
Also used : JEditorPane(javax.swing.JEditorPane) ProjectHistoryException(teamdash.hist.ProjectHistoryException)

Example 35 with JEditorPane

use of javax.swing.JEditorPane in project jgnash by ccavanaugh.

the class AboutDialog method addHTMLTab.

private JComponent addHTMLTab(final String name, final String url) {
    try {
        URL noticeURL = HTMLResource.getURL(url);
        JEditorPane p = new JEditorPane(noticeURL);
        Font font = UIManager.getFont("Label.font");
        String bodyRule = "body { font-family: " + font.getFamily() + "; " + "font-size: " + font.getSize() + "pt; }";
        ((HTMLDocument) p.getDocument()).getStyleSheet().addRule(bodyRule);
        p.setEditable(false);
        p.setAutoscrolls(true);
        JScrollPane pane = new JScrollPane(p);
        tabbedPane.add(name, pane);
        return pane;
    } catch (final Exception e) {
        Logger.getLogger(AboutDialog.class.getName()).log(Level.SEVERE, e.toString(), e);
    }
    return null;
}
Also used : JScrollPane(javax.swing.JScrollPane) JEditorPane(javax.swing.JEditorPane) URL(java.net.URL) Font(java.awt.Font)

Aggregations

JEditorPane (javax.swing.JEditorPane)60 JScrollPane (javax.swing.JScrollPane)22 Dimension (java.awt.Dimension)12 JPanel (javax.swing.JPanel)12 IOException (java.io.IOException)11 JButton (javax.swing.JButton)11 JLabel (javax.swing.JLabel)11 JFrame (javax.swing.JFrame)10 GridBagLayout (java.awt.GridBagLayout)9 GridBagConstraints (java.awt.GridBagConstraints)8 JDialog (javax.swing.JDialog)7 HyperlinkEvent (javax.swing.event.HyperlinkEvent)6 BorderLayout (java.awt.BorderLayout)5 JTextField (javax.swing.JTextField)5 HyperlinkListener (javax.swing.event.HyperlinkListener)5 StyledEditorKit (javax.swing.text.StyledEditorKit)5 JCheckBox (javax.swing.JCheckBox)4 JSplitPane (javax.swing.JSplitPane)4 JTree (javax.swing.JTree)4 Component (java.awt.Component)3