Search in sources :

Example 86 with JEditorPane

use of javax.swing.JEditorPane in project suite by stupidsing.

the class EditorController method run.

private void run(Iterate<String> fun) {
    JEditorPane editor = view.getEditor();
    String selectedText = editor.getSelectedText();
    String text = selectedText != null ? selectedText : editor.getText();
    if (runThread == null || !runThread.isAlive())
        runThread = Thread_.startThread(() -> {
            view.showMessageRunning();
            view.showMessage(fun.apply(text));
            view.getEditor().requestFocusInWindow();
        });
    else
        JOptionPane.showMessageDialog(view.getFrame(), "Previous evaluation in progress");
}
Also used : JEditorPane(javax.swing.JEditorPane)

Example 87 with JEditorPane

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

the class OneWayANOVANodeView method createMainPanel.

/**
 * The content of the view.
 */
private JPanel createMainPanel() {
    JPanel p = new JPanel(new GridBagLayout());
    GridBagConstraints c = createGridBagConstraints();
    c.gridwidth = 2;
    m_headerPane = new JEditorPane("text/html", "");
    m_headerPane.setEditable(false);
    p.add(m_headerPane, c);
    c.gridwidth = 1;
    c.gridy++;
    c.gridx = 0;
    c.gridwidth = 2;
    m_descrStatPane = new JEditorPane("text/html", "");
    m_descrStatPane.setEditable(false);
    p.add(m_descrStatPane, c);
    c.gridy++;
    c.gridx = 0;
    c.gridwidth = 2;
    m_leveneStatPane = new JEditorPane("text/html", "");
    m_leveneStatPane.setEditable(false);
    p.add(m_leveneStatPane, c);
    c.gridy++;
    c.gridx = 0;
    c.gridwidth = 2;
    m_statPane = new JEditorPane("text/html", "");
    m_statPane.setEditable(false);
    p.add(m_statPane, c);
    c.gridy++;
    c.weighty = 1;
    JPanel foo = new JPanel();
    foo.setBackground(Color.white);
    p.add(foo, c);
    return p;
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) GridBagLayout(java.awt.GridBagLayout) JEditorPane(javax.swing.JEditorPane)

Example 88 with JEditorPane

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

the class TwoSampleTTestNodeView method createMainPanel.

/**
 * The content of the view.
 */
private JPanel createMainPanel() {
    JPanel p = new JPanel(new GridBagLayout());
    GridBagConstraints c = createGridBagConstraints();
    c.gridwidth = 2;
    m_headerPane = new JEditorPane("text/html", "");
    m_headerPane.setEditable(false);
    p.add(m_headerPane, c);
    c.gridwidth = 1;
    c.gridy++;
    c.gridx = 0;
    c.gridwidth = 2;
    m_descrStatPane = new JEditorPane("text/html", "");
    m_descrStatPane.setEditable(false);
    p.add(m_descrStatPane, c);
    c.gridy++;
    c.gridx = 0;
    c.gridwidth = 2;
    m_leveneStatPane = new JEditorPane("text/html", "");
    m_leveneStatPane.setEditable(false);
    p.add(m_leveneStatPane, c);
    c.gridy++;
    c.gridx = 0;
    c.gridwidth = 2;
    m_statPane = new JEditorPane("text/html", "");
    m_statPane.setEditable(false);
    p.add(m_statPane, c);
    c.gridy++;
    c.weighty = 1;
    JPanel foo = new JPanel();
    foo.setBackground(Color.white);
    p.add(foo, c);
    return p;
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) GridBagLayout(java.awt.GridBagLayout) JEditorPane(javax.swing.JEditorPane)

Example 89 with JEditorPane

use of javax.swing.JEditorPane in project JWildfire by thargor6.

the class RessourceDialog method getEditorTextArea.

/**
 * This method initializes editorTextArea
 *
 * @return javax.swing.JTextArea
 */
private JEditorPane getEditorTextArea() {
    if (editorTextArea == null) {
        if (Prefs.getPrefs().isTinaAdvancedCodeEditor()) {
            try {
                DefaultSyntaxKit.initKit();
                // setting JSyntaxPane font, see comment in org.jwildfire.create.tina.swing.ScriptEditDialog for explanation
                Configuration config = DefaultSyntaxKit.getConfig(DefaultSyntaxKit.class);
                config.put("DefaultFont", "monospaced " + Integer.toString(Prefs.getPrefs().getTinaAdvancedCodeEditorFontSize()));
            } catch (Exception ex) {
                ex.printStackTrace();
            }
        }
        editorTextArea = new JEditorPane();
        // if using advanced editor color fix, and one of JWildfire's dark look and feels (HiFi or Noire),
        // override look and feel to set scriptEditor background to white,
        // to work better with JSyntaxPane text colors
        LookAndFeel laf = UIManager.getLookAndFeel();
        String laf_name = laf.getName();
        boolean using_dark_theme = laf_name.equalsIgnoreCase("HiFi") || laf_name.equalsIgnoreCase("Noire");
        if (using_dark_theme && Prefs.getPrefs().isTinaAdvancedCodeEditor() && Prefs.getPrefs().isTinaAdvancedCodeEditorColorFix()) {
            editorTextArea.setBackground(Color.white);
        }
        editorTextArea.setText("");
    }
    return editorTextArea;
}
Also used : Configuration(jsyntaxpane.util.Configuration) JEditorPane(javax.swing.JEditorPane) LookAndFeel(javax.swing.LookAndFeel)

Example 90 with JEditorPane

use of javax.swing.JEditorPane in project JWildfire by thargor6.

the class ScriptEditDialog method getScriptEditor.

/**
 * This method initializes editorTextArea
 *
 * @return javax.swing.JTextArea
 */
private JEditorPane getScriptEditor() {
    if (scriptEditor == null) {
        scriptEditor = new JEditorPane();
        // if using advanced editor color fix, and one of JWildfire's dark look and feels (HiFi or Noire),
        // override look and feel to set scriptEditor background to white,
        // to work better with JSyntaxPane text colors
        LookAndFeel laf = UIManager.getLookAndFeel();
        String laf_name = laf.getName();
        boolean using_dark_theme = laf_name.equalsIgnoreCase("HiFi") || laf_name.equalsIgnoreCase("Noire");
        if (using_dark_theme && Prefs.getPrefs().isTinaAdvancedCodeEditor() && Prefs.getPrefs().isTinaAdvancedCodeEditorColorFix()) {
            scriptEditor.setBackground(Color.white);
        }
    }
    return scriptEditor;
}
Also used : JEditorPane(javax.swing.JEditorPane) LookAndFeel(javax.swing.LookAndFeel)

Aggregations

JEditorPane (javax.swing.JEditorPane)130 JScrollPane (javax.swing.JScrollPane)54 Dimension (java.awt.Dimension)34 JPanel (javax.swing.JPanel)34 JButton (javax.swing.JButton)22 JLabel (javax.swing.JLabel)21 BorderLayout (java.awt.BorderLayout)20 IOException (java.io.IOException)16 HyperlinkEvent (javax.swing.event.HyperlinkEvent)16 JFrame (javax.swing.JFrame)15 HyperlinkListener (javax.swing.event.HyperlinkListener)15 JDialog (javax.swing.JDialog)14 GridBagConstraints (java.awt.GridBagConstraints)12 GridBagLayout (java.awt.GridBagLayout)12 URL (java.net.URL)12 ActionEvent (java.awt.event.ActionEvent)11 FlowLayout (java.awt.FlowLayout)10 HTMLEditorKit (javax.swing.text.html.HTMLEditorKit)10 Component (java.awt.Component)9 JSplitPane (javax.swing.JSplitPane)9