JavaFX adding custom item to Pane -
i have fxml file has pane 1 of it's entries, used output of our program. have pane contain htmleditor. i'm little bit confused @ accomplish this. class uses singleton pattern recommended, , can call controller pane.
then find myself having create inner class, since htmleditor not node. extended rectangle this, , use getchildren.add(htmleditorwrapper) try , add node. of course, htmleditor not show when run program.
the gist of question: how add htmleditor pane (which in fxml file)?
import javafx.scene.layout.pane; import javafx.scene.shape.rectangle; import javafx.scene.web.htmleditor; /** * gets controller's outputpane (the console in gui) * @author matt * */ public class outputpanel{ private static pane pane; private static htmleditorwrap htmleditor = new htmleditorwrap(); private static final outputpanel outputpanel = new outputpanel(); private outputpanel(){} public static outputpanel getinstance(){ pane = controller.getoutputpane(); pane.getchildren().add(htmleditor); return outputpanel; } public void clear(){ //htmleditor.sethtmltext(); } public static void write(string text){ htmleditor.sethtmltext(text + "\n"); } } class htmleditorwrap extends rectangle{ htmleditor htmleditor = new htmleditor(); public htmleditorwrap(){ htmleditor.setlayoutx(200); htmleditor.setlayouty(200); htmleditor.sethtmltext("testing"); } public void sethtmltext(string text){ htmleditor.sethtmltext(text); } }
actually htmleditor node
. try adding directly. , how did obtain editor extending rectangle
?
Comments
Post a Comment