• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Center a JFrame ...

 
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
 
Bartender
Posts: 11445
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • 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.
 
World domination requires a hollowed out volcano with good submarine access. Tiny ads are optional.
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic