的JavaFX从HTML编辑
问题描述:
删除节点我用JavaFX开发一个简单的应用程序。问题是,我想删除两个工具栏,但没有办法如何做到这一点。在代码中,我将底部工具栏的可见性设置为false。 如需帮助,如果你需要回答:顶部的工具栏的ID .TOP,工具栏,而底部工具栏的ID是.bottom-工具栏。您的帮助将被极大地赞赏...这是我的代码。 在此先感谢。的JavaFX从HTML编辑
import javafx.application.Application;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.web.HTMLEditor;
import javafx.stage.Stage;
public class PrivateHistory extends Application {
@Override
public void start(Stage stage) {
stage.setTitle("HTMLEditor Sample");
stage.setWidth(400);
stage.setHeight(300);
final HTMLEditor htmlEditor = new HTMLEditor();
htmlEditor.setPrefHeight(245);
Scene scene = new Scene(htmlEditor);
stage.setScene(scene);
Node node = htmlEditor.lookup(".bottom-toolbar");
node.setVisible(false);
//htmlEditor.setHtmlText("<img src='"+getClass().getResource("ball.png")+"' />");
stage.show();
}
public static void main(String[] args) {
launch(args);
}
}
答
适用于你的htmlEditor
htmlEditor.lookup(".top-toolbar").setManaged(false);
htmlEditor.lookup(".top-toolbar").setVisible(false);
htmlEditor.lookup(".bottom-toolbar").setManaged(false);
htmlEditor.lookup(".bottom-toolbar").setVisible(false);
感谢的人下面的代码,我很乐意帮助你解决问题:) – Muhammad 2014-11-06 20:58:53