Questions tagged «boxlayout»

4
分配布局时出现错误:BoxLayout无法共享
我有这个Java JFrame类,我想在其中使用boxlayout,但出现错误提示java.awt.AWTError: BoxLayout can't be shared。我已经看到其他人遇到了这个问题,但是他们通过在contentpane上创建boxlayout解决了这个问题,但这就是我在这里所做的。这是我的代码: class EditDialog extends JFrame { JTextField title = new JTextField(); public editDialog() { setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setTitle("New entity"); getContentPane().setLayout( new BoxLayout(this, BoxLayout.PAGE_AXIS)); add(title); pack(); setVisible(true); } }
114 java  swing  layout  boxlayout 
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.