Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在为我的按钮面板使用网格布局,并且在网格布局中,所有组件的默认大小都相同,我希望我的按钮大小之一增加。请建议我采用相同的方式。
您可以使用
bttn.setBounds(X,Y, WIDTH, HEIGHT);
bttn 是一个 JButton 对象
GridLayout 不支持不同尺寸的组件。您可以使用 GridBagLayout。它允许为组件之一设置自定义大小。