codice:
class JFrame{
 public void centra(){
   Dimension d=Toolkit.getDefaultToolkit().getScreenSize();
   int x=(d.getWidth()-this.getWidth())/2;
   int y=(d.getHeight()-this.getHeight())/2;
   this.setLocation(x,y);
 }
}