| 12
 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
 
 | public class myFrame extends JFrame implements ActionListener
{
public myFrame()
 {
 int delai=100;
 ActionListener ecouteur=this;
 this.timer=new timer(delai,ecouteur);
 this.timer.start();
 tailleX=0;
 tailleY=0;
 }
 
 
public void actionPerformed(ActionEvent e)
{
int valeur_incrementation=10;//par exemple
this_resize(valeur_incrementation);
}
 
public void this_resize(int increment)
{
tailleX+=increment;
tailleY+=increment;
if(tailleX>=300)
  {
  timer.stop();
  }
else
  { 
  this.setSize(new Dimension(tailleX,tailleY)); 
  }
}
 
private int tailleX, tailleY;
private Timer timer;
} |