【问题标题】:JavaFX: Is there any way to show images in a TextAreaJavaFX:有没有办法在 TextArea 中显示图像
【发布时间】:2017-08-09 15:16:11
【问题描述】:

我想在 TextArea 中显示图像,就像在 HTML 中使用 divcontentEditable
我不想要背景图片。
例如:

【问题讨论】:

标签: java javafx javafx-8


【解决方案1】:

我看到的唯一可能是将其添加为 TextArea 的背景。例如通过 fx-background-image:url 的 css

【讨论】:

    【解决方案2】:

    尝试将文本区域和图像添加到同一组中,例如:

    Textarea text = new Textarea();
    ImageView img= new ImageView ();
    
    Group group = new Group();
    
    group.getChildren().add(img);
    group.getChildren().add(text);
    

    【讨论】:

    • 它几乎解决了我的问题!但我仍然没有找到像 HTML 一样删除图像的任何方法
    • 我很高兴能帮上忙!你能解释更多吗?
    猜你喜欢
    • 1970-01-01
    • 2022-01-06
    • 1970-01-01
    • 2020-03-06
    • 2022-06-14
    • 2011-04-17
    • 2020-11-06
    • 1970-01-01
    相关资源
    最近更新 更多