home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 November: Tool Chest / Dev.CD Nov 00 TC Disk 1.toast / Sample Code / Java / SlideShow / Sources (skeleton) / Controller.java < prev    next >
Encoding:
Java Source  |  2000-09-28  |  2.4 KB  |  94 lines  |  [TEXT/CWIE]

  1. import java.awt.*;
  2. import java.awt.event.ActionEvent;
  3. import java.awt.event.ActionListener;
  4.  
  5. public class Controller extends Window
  6. {
  7.     //Declare constants
  8.     //Insert "Controller Constants"
  9.  
  10.     //Declare data members
  11.     //Insert "Controller data members"
  12.  
  13.     /**
  14.      * Creates a Controller object with the specified parent Frame.
  15.      * @param the parent frame to associate the controller with.
  16.      */
  17.     public Controller(Frame parent)
  18.     {
  19.         //Setup parent info for this window
  20.         //Insert "Controller parent info"
  21.         
  22.         //INIT_CONTROLS
  23.         //Setup and layout objects in the controller
  24.         //Insert "Controller init controls"
  25.     
  26.         //REGISTER_LISTENERS
  27.         //Register our action listener with our buttons
  28.         //Insert "Controller register listeners"
  29.         
  30.         //Initialize state information.
  31.         //Insert "Controller init state"
  32.     }
  33.     
  34.     /**
  35.      * Set the state of the Play/Pause button
  36.      * @param if true, the button will be in the Play state;
  37.      * If false it will be in the Pause state.
  38.      * @see #isPlayState
  39.      */
  40.     public void setPlayState(boolean isPlay)
  41.     {
  42.         //Handle setup for the appropriate state
  43.         //Insert "Controller setPlayState"
  44.     }
  45.     
  46.     /**
  47.      * Get the current state of the Play/Pause button
  48.      * @return true if the button is in the Play state,
  49.      * false if it is in the Pause state.
  50.      * @see #setPlayState
  51.      */
  52.     public boolean isPlayState()
  53.     {
  54.         //Return the current state
  55.         //Insert "Controller isPlayState"
  56.     }
  57.     
  58.     //Routines for handling ActionListener management.
  59.     //Insert "Controller Action Management"
  60.  
  61.     public void paint(Graphics g)
  62.     {
  63.         //Handle painting the border image, and let the super class paint the rest.
  64.         //Insert "Controller paint"
  65.     }
  66.     
  67.     public void update(Graphics g)
  68.     {
  69.         //Override update to simply call paint to reduce flicker.
  70.         //Insert "Controller update"
  71.     }
  72.     
  73.     /**
  74.      * Gets the size the controller should be to look its best
  75.      * @return the dimensions the controller renders its self the best.
  76.      */
  77.     public Dimension getPreferredSize()
  78.     {
  79.         //If the current image is not null, then return the size of the image.
  80.         //If it is null, defer to the super class.
  81.         //Insert "Controller getPreferredSize"
  82.     }
  83.  
  84.     //Inner class so we can instantiate a simple lightweight container
  85.     //for use in laying out the controller properly.
  86.     class DumbContainer extends Container { }
  87.     
  88.     //Inner class to handle action events
  89.     //Insert "Controller Action"
  90.  
  91.     //Routines to handle action events from the different buttons
  92.     //Insert "Controller button actions"
  93. }
  94.