答案 0 :(得分:0)
HTMLEditor的样式是通过CSS定制的。
.html-editor-foreground {
-fx-color-rect-width: 16;
-fx-color-rect-height: 16;
-fx-graphic: null;
}
这里我们将前景颜色选择器拾取的颜色指示器设置为(相对)大矩形(为样本选择粉红色):
示例代码
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.web.HTMLEditor;
import javafx.stage.Stage;
public class EditorSample extends Application {
@Override
public void start(Stage stage) throws Exception {
HTMLEditor editor = new HTMLEditor();
Scene scene = new Scene(editor);
scene.getStylesheets().add(
this.getClass().getResource(
"html-editor-large-color-rect.css"
).toExternalForm()
);
stage.setScene(scene);
stage.show();
}
public static void main(String[] args) {
launch(args);
}
}