我有一些代码:
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
JFrame mainFrame = new JFrame();
JPanel windowPanel = new JPanel(new FlowLayout());
// windowPanel.setPreferredSize(new Dimension(200,200));
windowPanel.add(colorChooser);
windowPanel.add(button);
windowPanel.setVisible(true);
mainFrame.add(windowPanel);
}
});
问题是单击按钮后如何显示新FlowLayout
的(在新窗口中)?