Is it Bad Practice to use HTML Styling in Java Swing Elements?

后端 未结 2 1332
傲寒
傲寒 2021-02-13 06:24

It is considered bad practice to style Swing elements using HTML?

As an example, if I want to make a label bigger and red just once, I have two options:

Either u

相关标签:
2条回答
  • 2021-02-13 06:42
    1. No, it is not bad or good practice to use HTML syntax in the Swing JComponents

    2. Today, Java supports HTML 3.2 and there is reduced support for certain CSS attributes

    3. JTextPane and JEditorPane support adding and positioning JComponents using HTML syntax

    0 讨论(0)
  • 2021-02-13 06:49

    Using <font> is bad even in html. And using objects to customize font color, size etc is lot of work in big applications.

    Fortunately, javaFX 2 is out. With it you can use CSS to deal with these kinds of things : http://www.oracle.com/technetwork/java/javafx/documentation/index.html

    0 讨论(0)
提交回复
热议问题