Is there an equivalent in Java for fieldset (HTML)?

前端 未结 3 1358
生来不讨喜
生来不讨喜 2021-02-13 04:30

Is there an element in Java (i.e. Swing/AWT or SWT) that is equivalent to the HTML element fieldset?

3条回答
  •  被撕碎了的回忆
    2021-02-13 05:03

    Have a look at javax.swing.border.TitledBorder. You can set them on panels and are similar in appearance to HTML fieldsets.

    Border titleBorder = new TitledBorder(new LineBorder(Color.RED), "Fieldset");
    

    You could then add the border to your panel using the setBorder() method.

提交回复
热议问题