且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

也在 Eclipse 中更改我的小程序的大小“作为小程序运行"

更新时间:2023-11-19 20:50:22

您的窗口大小设置为 500,500,因此它是您的黑匣子的大小.如果您加宽屏幕,则可以看到右侧的面板.

Your size of the window is set to 500,500 and so it this size of your black box. The panel on the right is visible if you widen your screen.

删除用于设置 topPanel 的大小和最小、最大和首选大小的代码.然后,不要将其添加到 BorderLayout.WEST,而是使用 BorderLayout.CENTER.这将允许测试面板保持在左侧,并会随着窗口大小的调整而调整黑框的大小.

Remove the code for setting a size and a min,max, and preferred size for the topPanel. Then instead of adding it to BorderLayout.WEST, use BorderLayout.CENTER instead. This will allow the test panel to stay on the left and will resize your black box as the window resizes.