Centering a JLabel on a JPanel

后端 未结 5 909
花落未央
花落未央 2020-11-22 14:32

I\'m using the NetBeans GUI builder to handle my layout (I\'m terrible with LayoutManagers) and am trying to place a simple JLabel so that it is always centered (horizontall

5条回答
  •  情书的邮戳
    2020-11-22 14:57

    By using Borderlayout, you can put any of JComponents to the CENTER area. For an example, see an answer to Stack Overflow question Get rid of the gap between JPanels. This should work.

提交回复
热议问题