Is there a “Group Box” equivalent in Java Swing?

前端 未结 7 1530
野的像风
野的像风 2021-01-30 19:50

Trying to build a GUI application in Java/Swing. I\'m mainly used to \"painting\" GUIs on the Windows side with tools like VB (or to be more precise, Gupta SQLWindows... wonder

7条回答
  •  面向向阳花
    2021-01-30 20:38

    Others have already commetned about JPanel and using a TitledBorder, that's fine.

    However, when playing with Swing LayoutManagers, you may find it annoying that components in different JPanels cannot align correctly (each panel has its own LayoutManager).

    For this reason, it is a good practice (check "JGoodies" on the web for more details) in Swing GUIs to NOT use TitledBorders but rather separate groups of components in a JPanel by a JLabel followed by a horizontal JSeparator.

    Ref. "First Aid for Swing"

提交回复
热议问题