[英]I want to open a new window when clicking the button with actionperformed
When the button is clicked with actionPerformed
, I want to open a new window, but I cannot open whatever I type.当使用
actionPerformed
单击按钮时,我想打开一个新的 window,但我无法打开我输入的任何内容。 Can you support?你能支持吗? I tried that:
我试过了:
JButton btnNewButton_5 = new JButton("Place Order");
btnNewButton_5.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) (
new Final().setVisible(true);
}
});
First of all, try to set the size and/or dimension of your new window.首先,尝试设置新 window 的大小和/或尺寸。 I think the new window has been opened but it is not visible to you.
我认为新的 window 已打开,但您看不到。 I think you should replace your code like this
我认为你应该像这样替换你的代码
JButton btnNewButton_5 = new JButton ("Place Order");
btnNewButton_5.addActionListener (new ActionListener () (
public void actionPerformed (ActionEvent e) (
Final final = new Final();
final.setSize(500,500);
final.setVisible (true);
}
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.