package Maze; import java.awt.Color; import java.awt.Font; import java.awt.Graphics; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JPanel; import javax.swing.Timer; public class stats extends JPanel implements ActionListener{ private Timer timer2; private map m; private Player h; public int numKeys=0; private Graphics g2; public stats(){ h = new Player(); //h= board.getPlayerInfo(h); timer2 = new Timer(200, this); //every 25 milliseconds the board is repainted timer2.start(); } public void actionPerformed(ActionEvent arg0) { // numKeys +=1; h=board.getPlayerInfo(h); repaint(); } //public stats addKey(stats s){ // //numKeys +=1; // repaint(); // return s; //} public void paint(Graphics g){ //Scans each tile of the map for "g" or "w" and paints the appropriate image super.paint(g); g.setFont(new Font("Lucida", Font.PLAIN, 16)); g.setColor(Color.black); g.fillRect(0, 0, 200, 486); g.setColor(Color.white); g.drawString(("Hero Name: " + h.name), 10, 30); g.drawString(("Level "+ h.level + " "+ h.job), 10, 50); g.drawString(("Health: "+ h.health + " / "+ h.maxhealth), 10, 70); g.drawString(("Experience: " + h.exp), 10, 90); g.drawString(("Keys:: " + h.numKeys), 10, 150); } }