1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
import java.awt.event.*;
public class testZone extends javax.swing.JPanel implements ActionListener{
private javax.swing.JButton bouton;
private int choix;
public testZone(){
super();
this.setSize(new java.awt.Dimension(200,200));
this.setLayout(null);
choix = 0;
bouton = new javax.swing.JButton("test");
bouton.setBounds(30, 50, 60, 70);
bouton.addActionListener(this);
this.add(bouton);
this.setVisible(true);
}
public void actionPerformed(ActionEvent e){
if(e.getSource()=="test"){
choix = 1;
this.repaint();
}
}
public void paintComponent(java.awt.Graphics g){
if(choix ==1){
g.drawLine(200, 200, 1100, 1100);
}
}
}
voila quelqu'un a t il une idée ?
Cordialement,
fterm |