import javax.swing.*; import java.awt.event.*; import java.awt.*; import Spr.*; import Mat.*; public class AssociationFrame extends JFrame { private GraphicPanel graphicPanel; private Animation an; public AssociationFrame() { super("Association00"); graphicPanel = new GraphicPanel(); an = new Animation(graphicPanel); add(graphicPanel); } public void trueVisible() { setBounds(0 , 0 , 400 , 200); setVisible(true); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } public static void main(String args[]) { AssociationFrame fra = new AssociationFrame(); fra.trueVisible(); } class GraphicPanel extends MovieClip { class Rect extends Primitive { public Rect(SpriteInter spr) { super(spr); } public void action( SpriteEvent ev ) { Matrix tr = Matrix2D.PositionMatrix((double)ev.x,(double)ev.y); Matrix tra; // for(int i=0;i<90;i+=10) ev.gra.setColor(new Color(100,0,200)); tra = ev.next().innerProduct(tr); tra = ev.next().innerProduct(tra); ev.gra.fillRect((int)tra.getCell(0,0),(int)tra.getCell(1,0),10,10); ev.gra.setColor(new Color(100,100,100)); ev.gra.fillRect((int)tr.getCell(0,0),(int)tr.getCell(1,0),10,10); } } int width=500; int height=500; public GraphicPanel() { Sprite spr = new Sprite(this); spr.setX(100); spr.setY(100); spr.addMatrix(Matrix2D.RotateMatrix(10)); spr.addMatrix(Matrix2D.MoveMatrix(5,5)); //spr.addMatrix(Matrix2D.RotateMatrix(5,1)); spr.addBaseItem(new Rect(this)); addBaseItem(spr); setSize(500,500); } } }