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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
public class Bouton extends JButton implements MouseListener{
private String name;
public Bouton (String str){
super(str);
this.name = str;
this.addMouseListener(this);
}
public void paintComponent(Graphics g){
g.setColor(Color.red);
g.fillRect(0, 0, getWidth(), getHeight());
g.setColor(Color.white);
g.drawString(this.name,this.getWidth()/2,this.getHeight()/2);
}
@Override
public void mouseClicked(MouseEvent e) {
// TODO Auto-generated method stub
}
@Override
public void mouseEntered(MouseEvent e) {
// TODO Auto-generated method stub
}
@Override
public void mouseExited(MouseEvent e) {
// TODO Auto-generated method stub
}
@Override
public void mousePressed(MouseEvent e) {
// TODO Auto-generated method stub
}
@Override
public void mouseReleased(MouseEvent e) {
// TODO Auto-generated method stub
}
} |