Coverage Summary for Class: NoEntryTileComponent (it.polimi.ingsw.Client.GUI.Components)
| Class | Class, % | Method, % | Branch, % | Line, % |
|---|---|---|---|---|
| NoEntryTileComponent | 0% (0/1) | 0% (0/1) | 0% (0/2) | 0% (0/11) |
1 package it.polimi.ingsw.Client.GUI.Components; 2 3 import javax.swing.*; 4 import java.awt.*; 5 6 import static it.polimi.ingsw.Client.GUI.IconLoader.noEntryTileIcon; 7 8 9 public class NoEntryTileComponent extends JButton { 10 /** 11 * Create a new JButton with NoEntryTile as icon 12 * 13 * @param amount NoEntryTiles' multiplicity 14 */ 15 public NoEntryTileComponent(int amount) { 16 //remove borders and fill from NoEntryTileComponent 17 this.setBorderPainted(false); 18 this.setContentAreaFilled(false); 19 this.setFocusPainted(false); 20 this.setOpaque(false); 21 this.setIcon(noEntryTileIcon); 22 23 //write eventual multiplicity beside the JButton 24 if (amount > 1) { 25 this.setText("x" + amount); 26 this.setHorizontalTextPosition(SwingConstants.RIGHT); 27 Font font = new Font("SansSerif", Font.BOLD, 13); 28 this.setFont(font); 29 } 30 } 31 }