g.drawString(p2.getName(), 800 - FontMetrics.stringWidth(p2.getName()), 40);
That line results in the error " Cannot make a static reference to the non-static method stringWidth(String) from the type FontMetrics.
The getName() method is defined in the player class, and p2 is an instance of that class, so I don't see how p2.getName() is a static reference.