| 135 | } |
| 136 | |
| 137 | public void paintComponent(Graphics g) |
| 138 | { |
| 139 | if(this.player.getReady() == false) |
| 140 | { |
| 141 | g.setColor(Color.WHITE); |
| 142 | } |
| 143 | else |
| 144 | { |
| 145 | g.setColor(Color.GREEN); |
| 146 | } |
| 147 | g.fillRect(0, 0, this.getWidth()-1, this.getHeight()-1); |
| 148 | |
| 149 | g.setColor(Color.BLACK); |
| 150 | g.drawRect(0, 0, this.getWidth()-1, this.getHeight()-1); |
| 151 | |
| 152 | BufferedImage nameChopper = new BufferedImage(maxNameLength, this.getHeight(), BufferedImage.TYPE_4BYTE_ABGR); |
| 153 | Graphics2D c = nameChopper.createGraphics(); |
| 154 | c.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); |
| 155 | c.setFont(new Font("Sans", Font.PLAIN, 14)); |
| 156 | c.setColor(Color.BLACK); |
| 157 | c.drawString(player.getName(), 1, this.getHeight()-2); |
| 158 | g.drawImage(nameChopper, 0, 0, null); |
| 159 | } |
| 160 | |
| 161 | private boolean isAddSoldier(Object obj) |
| 162 | { |