home *** CD-ROM | disk | FTP | other *** search
/ Java 1.2 How-To / JavaHowTo.iso / 3rdParty / Gamelication / examples / Boink / WindowResizer.java < prev   
Encoding:
Java Source  |  1998-04-15  |  1.0 KB  |  44 lines

  1. /**
  2.  *
  3.  * Ball.java
  4.  * @author    Jeremy Hutchins  (jgh8962@cs.rit.edu)
  5.  * @version    1.0
  6.  * Feb 23/1996
  7.  *
  8.  * 
  9.  *
  10.  */
  11.  
  12. import java.awt.*;
  13. import java.awt.event.*;
  14. import com.next.gt.*;
  15.  
  16. public class WindowResizer extends ComponentAdapter {
  17.  
  18.     private DisplayManager    displayManager;
  19.     private Gamelication    owner;
  20.  
  21.     public WindowResizer( DisplayManager displayManager, Gamelication owner ) {
  22.     this.displayManager = displayManager;
  23.     this.owner = owner;
  24.     }
  25.  
  26.     public void componentShown( ComponentEvent e ) {
  27.     displayManager.paint( owner.getGraphics() );
  28.     }
  29.  
  30.     public void componentHidden( ComponentEvent e ) {
  31.     displayManager.paint( owner.getGraphics() );
  32.     }
  33.  
  34.     public void componentResized(ComponentEvent e) {
  35.         owner.setSize( e.getComponent().getSize().width -5,
  36.                 e.getComponent().getSize().height -25 );
  37.     displayManager.setBackgroundTile (owner.getImage( owner.getCodeBase(), "images/background.gif"));
  38.     //owner.setBackground( Color.gray );
  39.     //owner.repaint();
  40.     displayManager.paint( owner.getGraphics() );
  41.     }
  42.  
  43. } /*Ball*/
  44.