• Post Reply Bookmark Topic Watch Topic
  • New Topic

Center a JFrame ...

 
Miguel Enriquez
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi friends.

i call a JFrame:

Expediente JFexpediente = new Expediente();
JFexpediente.pack();
JFexpediente.setVisible(true);

my question is how show JFExpediente centered in the screen? actually show at the left top.

Thanks
 
Miguel Enriquez
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Expediente JFexpediente = new Expediente();
JFexpediente.pack();
JFexpediente.setLocationRelativeTo(null);
JFexpediente.setVisible(true);


setLocationRelativeTo(null) is my friend thanks
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Miguel Enriquez:
Expediente JFexpediente = new Expediente();
JFexpediente.pack();
JFexpediente.setLocationRelativeTo(null);
JFexpediente.setVisible(true);


setLocationRelativeTo(null) is my friend thanks


Or you call setVisible and then call pack.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!