我正在使用netbeans进行JAVA项目,我刚刚创建了Jframe并在其上放置了一个按钮,我还创建了另一个JFrame并添加了许多标签,我想知道当我单击第一个JFrame中的按钮时,第二个JFrame如何出现?
发布于 2013-09-02 09:41:45
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
new SecondFrame().setVisible(true);
FirstFrame.this.dispose(); // if you want the first frame to close
}有关更多信息,请访问如何编写动作侦听器。
https://stackoverflow.com/questions/18569965
复制相似问题