Java setBounds not working with JPanel

前端 未结 2 988
忘了有多久
忘了有多久 2020-12-11 06:53

i am doing a small Gui in java. i am using setBounds methods to set the position of buttons etc on my JFrame , but problem is that when i use it with JPanel button is

2条回答
  •  伪装坚强ぢ
    2020-12-11 07:27

    You must get rid of the JPanel's layout, in order to set absolute positions:

    p.setLayout(null);

提交回复
热议问题