Clover coverage report -
Coverage timestamp: Sun Apr 18 2004 21:32:30 EDT
file stats: LOC: 91   Methods: 4
NCLOC: 50   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
SplashScreen.java 50% 92.6% 75% 87.9%
coverage coverage
 1   
 /*
 2   
  * SimplyHTML, a word processor based on Java, HTML and CSS
 3   
  * Copyright (C) 2002 Ulrich Hilger
 4   
  *
 5   
  * This program is free software; you can redistribute it and/or
 6   
  * modify it under the terms of the GNU General Public License
 7   
  * as published by the Free Software Foundation; either version 2
 8   
  * of the License, or (at your option) any later version.
 9   
  *
 10   
  * This program is distributed in the hope that it will be useful,
 11   
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 12   
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 13   
  * GNU General Public License for more details.
 14   
  *
 15   
  * You should have received a copy of the GNU General Public License
 16   
  * along with this program; if not, write to the Free Software
 17   
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 18   
  */
 19   
 
 20   
 import java.awt.*;
 21   
 import java.awt.Canvas;
 22   
 
 23   
 /**
 24   
  * A splash screen for application SimplyHTML to be shown during startup.
 25   
  *
 26   
  * @author Ulrich Hilger
 27   
  * @author Light Development
 28   
  * @author <a href="http://www.lightdev.com">http://www.lightdev.com</a>
 29   
  * @author <a href="mailto:info@lightdev.com">info@lightdev.com</a>
 30   
  * @author published under the terms and conditions of the
 31   
  *      GNU General Public License,
 32   
  *      for details see file gpl.txt in the distribution
 33   
  *      package of this software
 34   
  *
 35   
  * @version stage 11, April 27, 2003
 36   
  */
 37   
 
 38   
 public class SplashScreen extends Canvas {
 39   
 
 40   
   private Window win;
 41   
   private Image image;
 42   
   private Image offscreenImg;
 43   
   private Graphics offscreenGfx;
 44   
 
 45  75
   public SplashScreen() {
 46  75
     setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
 47  75
     image = getToolkit().getImage(
 48   
             getClass().getResource(FrmMain.dynRes.getResourceString(FrmMain.resources, "splashImage")));
 49  75
     MediaTracker tracker = new MediaTracker(this);
 50  75
     tracker.addImage(image,0);
 51  75
     try {
 52  75
       tracker.waitForAll();
 53   
     }
 54   
     catch(Exception e) {
 55  0
       Util.errMsg(this, e.getMessage(), e);
 56   
     }
 57  75
     win = new Window(new Frame());
 58  75
     Dimension screen = getToolkit().getScreenSize();
 59  75
     Dimension size = new Dimension(image.getWidth(this) + 2,
 60   
             image.getHeight(this) + 2);
 61  75
     win.setSize(size);
 62  75
     win.setLayout(new BorderLayout());
 63  75
     win.add(BorderLayout.CENTER,this);
 64  75
     win.setLocation((screen.width - size.width) / 2,
 65   
             (screen.height - size.height) / 2);
 66  75
     win.validate();
 67  75
     win.show();
 68   
   }
 69   
 
 70  22
   public synchronized void paint(Graphics g) {
 71  22
     Dimension size = getSize();
 72  22
     if(offscreenImg == null)
 73   
     {
 74  22
       offscreenImg = createImage(size.width,size.height);
 75  22
       offscreenGfx = offscreenImg.getGraphics();
 76   
     }
 77  22
     offscreenGfx.setColor(Color.black);
 78  22
     offscreenGfx.drawRect(0,0,size.width - 1,size.height - 1);
 79  22
     offscreenGfx.drawImage(image,1,1,this);
 80  22
     g.drawImage(offscreenImg,0,0,this);
 81  22
     notify();
 82   
   }
 83   
 
 84  75
   public void dispose() {
 85  75
     win.dispose();
 86   
   }
 87   
 
 88  0
   public void update(Graphics g) {
 89  0
     paint(g);
 90   
   }
 91   
 }