Search in sources :

Example 1 with Configuration

use of jsyntaxpane.util.Configuration 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)

Aggregations

JEditorPane (javax.swing.JEditorPane)1 LookAndFeel (javax.swing.LookAndFeel)1 Configuration (jsyntaxpane.util.Configuration)1