BorderLayout only showing one object

前端 未结 1 543
孤街浪徒
孤街浪徒 2021-01-26 11:03

I decided to write a small Java program to experiment around with BorderLayout, because I\'m developing a Java game and I need to have 2 objects placed in a single JFrame at the

相关标签:
1条回答
  • 2021-01-26 11:48

    You need to override the getPreferredSize() method so the layout manager can determine the proper size for the component.

    How do I do that?

    Read the section from the Swing tutorial on Custom Painting for more information on custom painting, including a working example that shows how to override the getPreferredSize() method.

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