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
| public mainTest(){
if (first == true){
image = new BufferedImage( largeur, hauteur, BufferedImage.TYPE_INT_ARGB );
graph = image.createGraphics();
graph.setRenderingHint( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON );
graph.setStroke(new BasicStroke(1.2f));
graph.setBackground(Color.white);
graph.clearRect(0, 0, largeur, hauteur);
first = false;
repaint();
}
}
public void update(Graphics g){
paintComponent(g);
}
public static void main(String args[]){
JFrame jd = new JFrame();
//jd.setModal(false);
inter = new mainTest();
jd.add(inter);
jd.pack();
jd.setVisible(true);
la1 = new launch();
la1.run();
}
public Dimension getPreferredSize()
{
return new Dimension( largeur, hauteur );
}
public void paintComponent( Graphics g )
{
super.paintComponent( g );
g.drawImage( image, 0, 0, this );
}
} |