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
|
protected void paintComponent(Graphics g) {
Graphics2D g2 = (Graphics2D g)
// Activation de l'anti-aliasing
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
// Dessin de l'arc de cercle extérieur de 1 pixel
g2.setColor(Color.BLACK);
g2.setStroke(new BasicStroke(1));
g2.drawArc(0, -getHeight() - 1, getWidth()*2, getHeight()*2, 180, 90);
// Dessin du deuxième arc de cercle de 4 pixels
g2.setStroke(new BasicStroke(5));
g2.setColor(new Color(102, 51, 0));
Arc2D arc = new Arc2D.Float(2, -getHeight() - 1, getWidth()*2 - 2, getHeight()*2 - 2, 180, 90, Arc2D.OPEN);
g2.draw(arc);
// Application de la couleur blanche dans la zone formée par les
// deux arcs de cercles...
g2.setColor(Color.WHITE);
// .... ???
// .... ??? Comment peut-on faire ?
} |
Partager