1 Reply Latest reply: Jul 28, 2012 12:13 PM by jsmith RSS

    HTMLEditor - limiting font list

      Hy to everyone,

      after a long research, I found nothing useful, so I tried to do something...
      The problem is: In HTMLEditor, in ComboBox for Font selection I want to show only web-safe fonts. So, I have found this ComboBox, but the ObservableList is empty in the console, but in interface is full. That is not the cause by ComboBoxes for Headings and FontSize, both are full in console and in interface. Here is my code:
      int i=0;
      Toolbar tool;
      ComboBox fo;
      for(Node box: (edit.lookupAll(".bottom-toolbar"))){
      for(Node font: (tool.getItems())){
          if(font instanceof ComboBox){
                  if(i==1)fo=(ComboBox)font;   //if i==0 ->Heading ComboBox; if i==2 ->FontSize ComboBox
      System.out.println(fo.getItems().size());   //this shows 0 if we have ComboBox for Fonts, not if is Heading or FontSize CB
      This code is placed at initialize method of Controller class... Any thoughts?

      The problem is:
      should be sorounded by
      Platform.runLater(new Runnable() {
                @Override public void run() {
      Edited by: user13590954 on 2012.07.28 05:54
        • 1. Re: HTMLEditor - limiting font list
          See Re: Customizing  HTMLEditor element "Customizing HTMLEditor element"
          As well as: http://stackoverflow.com/questions/10075841/how-to-hide-the-controls-of-htmleditor "How to hide the controls of HTMLEditor?"
          And a related sample: https://gist.github.com/2514709 "Customize the JavaFX HTMLEditor"

          Note that this kind of customization depends on the internal implementation of the HTMLEditor and the linked sample was written against JavaFX 2.1 and may need to be modified for JavaFX 2.2 - similarly don't expect that the customization in your post will continue to work in future JavaFX versions, you may need to monitor it.