1 6 7 package com.thoughtriver.open.vectorvisuals.example.fundamental; 8 9 import java.awt.*; 10 import java.awt.geom.*; 11 12 import javax.swing.*; 13 14 import com.thoughtriver.open.vectorvisuals.*; 15 import com.thoughtriver.open.vectorvisuals.example.animation.*; 16 17 24 public class Subclassing implements Runnable { 25 26 27 private VVDisplay vvDisplay = null; 28 29 32 public Subclassing() { 33 vvDisplay = new VVDisplay(new VVPanel()); 34 } 35 36 39 public void run() { 40 JFrame frame = new JFrame("Vector Visuals Subclassing Example"); 41 frame.setSize(640, 480); 42 frame.getContentPane().setLayout(new BorderLayout()); 43 frame.getContentPane().add(vvDisplay.getViewPane(), BorderLayout.CENTER); 44 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 45 46 frame.setVisible(true); 47 48 vvDisplay.getViewPane().setBackground(Color.DARK_GRAY); 50 vvDisplay.setWorldViewScale(1); 51 52 ArmyTank tank = new ArmyTank(); 54 55 AffineTransform transform = tank.getTransform(); 57 transform.scale(3.0, 3.0); 58 transform.translate(100, 80); 59 tank.setTransform(transform); 60 61 tank.rotateTurret(0.5); 63 64 vvDisplay.addObject(tank); 66 } 67 68 73 public static void main(final String [] args) { 74 Runnable example = new Subclassing(); 75 example.run(); 76 } 77 78 } 79 | Popular Tags |