Clover coverage report - JFCUnit Test Coverage
Coverage timestamp: Mon Dec 20 2004 23:38:10 MST
file stats: LOC: 65   Methods: 3
NCLOC: 32   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
SplashScreen.java - 93.3% 66.7% 88.9%
coverage coverage
 1   
 package junit.extensions.jfcunit;
 2   
 
 3   
 import java.awt.Dimension;
 4   
 import java.awt.Font;
 5   
 import java.awt.Rectangle;
 6   
 import java.awt.Toolkit;
 7   
 import java.awt.Window;
 8   
 
 9   
 import javax.swing.JLabel;
 10   
 import javax.swing.JWindow;
 11   
 
 12   
 /**
 13   
  * An artifact class to be used while testing with "splash" screens.
 14   
  *
 15   
  * @author <a href="mailto:vraravam@thoughtworks.com">Vijay Aravamudhan : ThoughtWorks Inc.</a>
 16   
  */
 17   
 public class SplashScreen extends JWindow {
 18   
     /**
 19   
      * The name of this JWindow.
 20   
      */
 21   
     public static final String NAME = "Splash Screen";
 22   
 
 23   
     /**
 24   
      * Default constructor that does all the work.
 25   
      */
 26  1
     public SplashScreen() {
 27  1
         super();
 28   
 
 29  1
         setSize(100, 100);
 30  1
         setName(NAME);
 31   
 
 32  1
         JLabel splashLabel = new JLabel();
 33  1
         splashLabel.setFont(new Font("arial", Font.BOLD, 25));
 34  1
         splashLabel.setAlignmentX(JLabel.CENTER_ALIGNMENT);
 35  1
         splashLabel.setText("This label is being used instead of an image");
 36  1
         getContentPane().add(splashLabel);
 37  1
         pack();
 38   
 
 39   
         /* Center the frame */
 40  1
         centerOnScreen(this);
 41   
 
 42  1
         setVisible(true);
 43   
     }
 44   
 
 45   
     /**
 46   
      * This method is used to center the specified window on the screen.
 47   
      *
 48   
      * @param    win    The Window to be centered.
 49   
      */
 50  1
     private void centerOnScreen(final Window win) {
 51  1
         Dimension screenDim = Toolkit.getDefaultToolkit().getScreenSize();
 52  1
         Rectangle frameDim = win.getBounds();
 53  1
         win.setLocation((screenDim.width - frameDim.width) / 2, (screenDim.height - frameDim.height) / 2);
 54   
     }
 55   
 
 56   
     /**
 57   
      * Just a generic starting point for this class.
 58   
      *
 59   
      * @param    args    The command-line arguments.
 60   
      */
 61  0
     public static void main(final String[] args) {
 62  0
         new SplashScreen();
 63   
     }
 64   
 }
 65