62,614
社区成员
发帖
与我相关
我的任务
分享
package JPnelTest;
import javax.swing.*;
import java.awt.event.*;
public class GuiT extends JFrame implements ActionListener{
JButton button;
public static void main(String[] args){
GuiT gui = new GuiT();
gui.go();
}
private void go(){
MyDraw draw = new MyDraw();
button = new JButton("Click");
this.getContentPane().add(draw);
this.getContentPane().add(button);
button.addActionListener(this);
this.setTitle("GuiTest-MyDraw");
this.setVisible(true);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setSize(400, 400);
}
public void acitonPerformed(ActionEvent e){
button.setText("Clicked");
this.repaint();
}
}
public void acitonPerformed(ActionEvent e){
button.setText("Clicked");
this.repaint();
}
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
}