00001 /* 00002 * $Id: RCDisplay_8java-source.html,v 1.2 2002/07/07 20:59:52 stork Exp $ 00003 * 00004 * $Log: RCDisplay_8java-source.html,v $ 00004 * Revision 1.2 2002/07/07 20:59:52 stork 00004 * update dokumenation 00004 * 00005 * Revision 1.4 2002/07/02 20:53:11 stork 00006 * add synchronize and resize to improve the display 00007 * 00008 * Revision 1.3 2002/06/17 15:33:20 oliver 00009 * Update of RCDisplay & RCViewport; first step of visualisation: 00010 * Window popup, own player and lines visible 00011 * 00012 * Revision 1.2 2002/06/07 18:13:14 stork 00013 * extens JFrame 00014 * 00015 * Revision 1.1.1.1 2002/05/21 20:32:05 stork 00016 * empty project 00017 * 00018 */ 00019 import java.awt.*; 00020 import java.awt.event.*; 00021 import javax.swing.*; 00022 import javax.swing.border.*; 00023 00024 public class RCDisplay extends JFrame { 00026 public RCWorld World; 00028 private RCViewPort ViewPort; 00035 public RCDisplay ( RCWorld World ){ 00036 super("Player "+ World.PlayerNumber); 00037 00038 // create filed 00039 ViewPort = new RCViewPort(World); 00040 Container contentPane = getContentPane(); 00041 contentPane.setLayout(new GridLayout(1,1)); 00042 contentPane.add(ViewPort); 00043 00044 // set size 00045 setResizable(false); 00046 reSize(); 00047 setSize(10,10); 00048 } 00049 00053 public void reSize(){ 00054 this.setSize( (int)(this.ViewPort.getSize().width+this.getInsets().left+this.getInsets().right), 00055 (int)(this.ViewPort.getSize().height+this.getInsets().top+this.getInsets().bottom) ); 00056 } 00057 00058 00064 public synchronized void paint( Graphics g ){ 00065 super.paint(g); 00066 reSize(); 00067 } 00068 00069 00074 public synchronized void update ( ){ 00075 this.repaint(); 00076 ViewPort.repaint(); 00077 } 00078 } 00079