Coverage report

  %line %branch
ca.spaz.gui.TranslucentLabel
0% 
0% 

 1  
 /*
 2  
  * Created on 23-April-2005
 3  
  */
 4  
 package ca.spaz.gui;
 5  
 
 6  
 import java.awt.*;
 7  
 
 8  
 import javax.swing.*;
 9  
 
 10  
 public class TranslucentLabel extends JLabel {
 11  0
    double transparency = 1;
 12  
    
 13  
    public TranslucentLabel(double transparency, String title) {
 14  0
       super(title);
 15  0
       this.transparency = transparency;
 16  0
       setOpaque(false);
 17  0
    }
 18  
    
 19  
    public TranslucentLabel(double transparency, String title, int alignment) {
 20  0
       super(title, alignment);
 21  0
       this.transparency = transparency;
 22  0
       setOpaque(false);
 23  0
    }
 24  
    
 25  
    
 26  
    public TranslucentLabel(double transparency, Icon icon) {
 27  0
       super(icon);
 28  0
       this.transparency = transparency;
 29  0
       setOpaque(false);
 30  0
    }
 31  
    
 32  
    public void setTransparency(double val) {
 33  0
       this.transparency = val;
 34  0
    }
 35  
 
 36  
    public void paint(Graphics g) {
 37  0
       Graphics2D g2d = (Graphics2D)g;
 38  0
       g2d.setRenderingHint(
 39  
             RenderingHints.KEY_ANTIALIASING, 
 40  
             RenderingHints.VALUE_ANTIALIAS_ON);
 41  
       
 42  0
       Composite c = g2d.getComposite();
 43  0
       g2d.setComposite(AlphaComposite.getInstance(
 44  
             AlphaComposite.SRC_OVER, (float)transparency));
 45  0
       g2d.setColor(getBackground());
 46  0
       g2d.fillRoundRect(0, 0, getWidth(), getHeight(), 15, 15);
 47  0
       g2d.setComposite(c);
 48  0
       super.paint(g);
 49  0
    }
 50  
    
 51  
 }

This report is generated by jcoverage, Maven and Maven JCoverage Plugin.