【问题标题】:JavaFX TextArea style with css带有 css 的 JavaFX TextArea 样式
【发布时间】:2018-07-30 13:01:02
【问题描述】:

我想知道如何更改出现在文本区域中的内边框颜色。我想删除文本区域红色边框内的蓝色透明边框。我检查了 modena.css 文件,但找不到解决方案。

我的 css 文件中有什么:

.text-area:focused {
 -fx-background-color:  white;
 -fx-border-color: rgba(229,0,0,0.3);
}

【问题讨论】:

    标签: java css javafx textarea


    【解决方案1】:

    TextArea 在其内容上有一个额外的边框/背景。要更改/摆脱它,您需要在 css 中添加一个附加样式。

    类似

    .text-area:focused .content {
        -fx-background-color:  white;
    }
    

    不确定这是否足够安全:它是not documented(或者至少我找不到任何文档),只能作为实现使用,f.i.在提取的modena.css

    【讨论】:

      【解决方案2】:

      我使用下面的代码来摆脱文本区域自动生成的焦点效果:

      * {
      -fx-focus-color: transparent;
      -fx-border-style: none;
      }
      

      或

      .textarea {
      -fx-focus-color: transparent;
      -fx-border-style: none;
      -fx-background-radius: 0.0px;
      -fx-border-radius: 0.0px;
      }
      

      摆脱所有默认样式,包括圆角边框...

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2017-09-17
        • 2016-11-21
        • 1970-01-01
        • 2010-11-06
        • 2012-02-29
        • 1970-01-01
        • 1970-01-01
        • 2014-08-06
        相关资源
        最近更新 更多