Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How add text at the cursor position in HTMLEditor in JavaFX

SeamanMeiJun 13 2014 — edited Jun 13 2014

I know how add new button to HTMLEditor, and I want set to my button action to paste some text in the current cursor position.


//HTMLEditor html;
//String IMAGE_URL = "http://...";
Node node = html.lookup(".top-toolbar");
if (node instanceof ToolBar) {
  
ToolBar bar = (ToolBar) node;
  
ImageView graphic = new ImageView(new Image(IMAGE_URL, 32, 32, true, true));
  
Button myButton = new Button("", graphic);
  bar
.getItems().add(myButton);
  myButton
.setOnAction(new EventHandler<ActionEvent>() {
  
@Override
  
public void handle(ActionEvent arg0) {
  
//needs code
  
}
  
});
}

This post has been answered by David Grieve-Oracle on Jun 13 2014
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 11 2014
Added on Jun 13 2014
7 comments
4,320 views