Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4649793

JEditorPane font setting not working

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P5 P5
    • None
    • 1.4.0
    • client-libs

      Within JavaHelp attempts to change the default Font size are rejected. The following code is internal to the JHContentViewer (BasicContentViewer) and is not changing the font when executed. The first part is the old code and the latter is no code. Neither work.

                       Font newFont = (Font)event.getNewValue();
                        EditorKit ek = html.getEditorKit();
                        if (ek instanceof HTMLEditorKit) {
      ! String cssData = "body { font-family: " +
      ! newFont.getFamily() + " }";
                            HTMLEditorKit hek = (HTMLEditorKit) ek;
                            StyleSheet styles = hek.getStyleSheet();
                            try {
      ! styles.loadRules(new StringReader(cssData), null);
                            } catch (Exception ex) {
                            }
                        }
      --- 283,296 ----
                        Font newFont = (Font)event.getNewValue();
                        EditorKit ek = html.getEditorKit();
                        if (ek instanceof HTMLEditorKit) {
      ! String cssData = "body { font: " +
      ! newFont.getSize() + "pt " + newFont.getFamily() +
      ! " }";
      ! System.out.println ("cssData="+ cssData + "\n");
                            HTMLEditorKit hek = (HTMLEditorKit) ek;
                            StyleSheet styles = hek.getStyleSheet();
                            try {
      ! styles.addRule(cssData);
                            } catch (Exception ex) {
                            }
                        }

            idk Igor Kushnirskiy (Inactive)
            rbrinkle Roger Brinkley (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: