KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > thoughtriver > open > vectorvisuals > VVPanel


1 /*
2  * VVPanel.java
3  *
4  * Created on 31 May 2003, 02:53
5  */

6
7 package com.thoughtriver.open.vectorvisuals;
8
9 import java.awt.*;
10
11 import javax.swing.*;
12
13 /**
14  * This is a <CODE>JPanel</CODE>-based area upon which the graphics used by
15  * the Vector Visuals system can be painted. An instance of this (or any other
16  * <CODE>VVViewPane</CODE> implementation) must be provided to the <CODE>VVDisplay</CODE>
17  * that is being used to control the vector world.
18  *
19  * @author Brandon Franklin
20  * @version $Date: 2006/11/25 09:18:36 $
21  */

22 public class VVPanel extends JPanel implements VVViewPane {
23
24     private static final long serialVersionUID = 3833749863039906100L;
25
26     /** The <CODE>VVDisplay</CODE> that is controlling the vector world */
27     private VVDisplay vvDisplay = null;
28
29     /**
30      * Creates a new instance of <CODE>VVPanel</CODE>.
31      */

32     public VVPanel() {
33     }
34
35     /**
36      * {@inheritDoc}
37      */

38     public void setVVDisplay(final VVDisplay vvDisplay) {
39         this.vvDisplay = vvDisplay;
40     }
41
42     /**
43      * Causes the <CODE>VVPanel</CODE> to render itself. In the Vector Visuals
44      * system, this method is called quite frequently in order to facilitate
45      * animations.
46      *
47      * @param g the <CODE>Graphics</CODE> context of the panel
48      */

49     @Override JavaDoc
50     protected synchronized void paintComponent(final Graphics g) {
51         super.paintComponent(g);
52         if (vvDisplay != null) {
53             vvDisplay.paint(g);
54         }
55     }
56
57 }
58
Popular Tags