Coverage Report - br.mia.test.view.factory.BotaoFactory
 
Classes in this File Line Coverage Branch Coverage Complexity
BotaoFactory
0%
0/12
0%
0/4
2
 
 1  
 package br.mia.test.view.factory;
 2  
 
 3  
 import java.io.IOException;
 4  
 import java.io.InputStream;
 5  
 
 6  
 import javax.imageio.ImageIO;
 7  
 import javax.swing.Icon;
 8  
 import javax.swing.ImageIcon;
 9  
 import javax.swing.JButton;
 10  
 
 11  0
 public class BotaoFactory {
 12  
 
 13  
         public static Icon createIcon(String nome) throws IOException {
 14  
 
 15  0
                 InputStream io = Object.class
 16  0
                                 .getResourceAsStream("/br/mia/test/images/" + nome + ".png");
 17  
 
 18  0
                 ImageIcon thumbnailIcon = null;
 19  
 
 20  0
                 if (io != null) {
 21  0
                         thumbnailIcon = new ImageIcon(ImageIO.read(io));
 22  
                 }
 23  
 
 24  0
                 return thumbnailIcon;
 25  
         }
 26  
 
 27  
         public static JButton create(String nome) throws IOException {
 28  0
                 Icon icon = createIcon(nome);
 29  
 
 30  
                 JButton button;
 31  
 
 32  0
                 if (icon != null) {
 33  
 
 34  0
                         button = new JButton(icon);
 35  
                 } else {
 36  0
                         button = new JButton();
 37  
                 }
 38  
 
 39  0
                 return button;
 40  
 
 41  
         }
 42  
 
 43  
 }