Java sample(Round images)


run

---(Source List)---

//Example19
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.awt.geom.*;
public class Example19 extends JFrame{
  Image img;
  //Main
  public static void main(String ar[]){
    JFrame f=new Example19();
    f.setDefaultCloseOperation(f.EXIT_ON_CLOSE);
    f.setSize(640,400);
    f.setVisible(true);
  }
  //Parts set
  Example19(){
    super("Round images");
    img=getToolkit().getImage("ICO_020.gif");
  }
  //Paint
  public void update(Graphics g){
    paint(g);
  }
  public void paint(Graphics g){
    Graphics2D g2=(Graphics2D) g;
    int iw=img.getWidth(this);
    g.drawImage(img,50-iw/2,150-iw/2,this);
    AffineTransform at=new AffineTransform();
    at.rotate(90*Math.PI/180.0,100,150);
    g2.setTransform(at);
    g.drawImage(img,100-iw/2,150-iw/2,this);
    at.rotate(90*Math.PI/180.0,150,100);
    g2.setTransform(at);
    g.drawImage(img,150-iw/2,150-iw/2,this);
    at.rotate(90*Math.PI/180.0,150,100);
    g2.setTransform(at);
    g.drawImage(img,200-iw/2,150-iw/2,this);
  }
}