我想使文本自动与窗口一样宽。我尝试使用text.setSize(window.getWidth(),20)and text.setBounds(window.getWidth(),20), (其中文本是 JTextfield),但似乎唯一可行的方法是:static JTextField text = new JTextField(int numberOfColumns);我正在使用 GridBag 布局。
text.setSize(window.getWidth(),20)
text.setBounds(window.getWidth(),20)
static JTextField text = new JTextField(int numberOfColumns);
MMTTMM
相关分类