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

JEditorPane font setting not working

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P5
    • Resolution: Not an Issue
    • Affects Version/s: 1.4.0
    • Fix Version/s: None
    • Component/s: client-libs
    • Labels:

      Description

      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) {
                            }
                        }

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: