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
|
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package Visualisation;
import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.image.BufferedImage;
import javax.swing.JPanel;
/**
*
* @author HackerLover
*/
public class Affiche_TStation extends JPanel{
void Affiche_TStation(){
//Ceci est mon constructeur
}
public static BufferedImage getBufferedImage(Image img) {
int w = img.getWidth(null);
int h = img.getHeight(null);
BufferedImage bImage = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
Graphics2D g2 = bImage.createGraphics();
g2.drawImage(img, 0, 0, null);
return bImage;
}
public void tracer_cercle(int X, int Y, int Rayon, JPanel Tracage){
//BufferedImage hh = new BufferedImage(200, 200,BufferedImage.TYPE_BYTE_INDEXED);
Graphics2D g = (Graphics2D)Tracage.getGraphics();
g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.3f ));
g.setColor(Color.blue);
g.fillOval(X, Y, Rayon, Rayon);
g.setColor(Color.blue);
g.fillRect(((X+(Rayon/2))-(Rayon/20)), ((Y+(Rayon/2))-(Rayon/20)), Rayon/10, Rayon/10);
}
} |
Partager