Esse cód não funciona o que esta errado?
import javax.swing.;
import java.awt.BorderLayout;
import java.awt.event.;
public class SimpleGui1B implements ActionListener{
JButton button;
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
SimpleGui1B gui = new SimpleGui1B();
gui.go();
}
public void go(){
JFrame frame = new JFrame();
button = new JButton("click me");
button.addActionListener(this);
MyDrawPanel panel = new MyDrawPanel();
frame.getContentPane().add(BorderLayout.NORTH, panel);
frame.getContentPane().add(BorderLayout.SOUTH, button);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(300, 300);
frame.setVisible(true);
}
public void actionPerformed(ActionEvent event){
button.setText("I've bee clicke");
}
}
import javax.swing.;
import java.awt.;
public class MyDrawPanel extends JPanel{
public void paintComponent(Graphics g){
///super.paintComponent(g);
setBackground(Color.black);
g.setColor(Color.blue);
g.fillRect(10, 10, 100, 100);
g.fillOval(70, 70, 100, 100);*/
}
}