关于java中JButton的监听
publicvoidjButton1ActionPerformed(java.awt.event.ActionEventevt){privateclasssinexten...
public void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
private class sin extends JFrame {
public sin() {
Container container = this.getContentPane();
container.setLayout(new BorderLayout());
SinPanel sinPanel = new SinPanel();
container.add(sinPanel, BorderLayout.CENTER);
this.setTitle("Show Sin Fuction!");
this.setSize(new Dimension(400, 400));
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Dimension frameSize = this.getSize();
this.setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);
this.setVisible(true);
}
}
我是想单击JButton,运行里面的类sin 画出sin图象,但是怎么老是报错啊?
其余代码省略了! 展开
private class sin extends JFrame {
public sin() {
Container container = this.getContentPane();
container.setLayout(new BorderLayout());
SinPanel sinPanel = new SinPanel();
container.add(sinPanel, BorderLayout.CENTER);
this.setTitle("Show Sin Fuction!");
this.setSize(new Dimension(400, 400));
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Dimension frameSize = this.getSize();
this.setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);
this.setVisible(true);
}
}
我是想单击JButton,运行里面的类sin 画出sin图象,但是怎么老是报错啊?
其余代码省略了! 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询