Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Setting the default location of your application  RSS feed

 
Wilson Mui
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a way to specify where the JFrame will appear on your screen at runtime by default? For me it always starts on the upper left hand corner, and I want it more in the middle.
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use the setLocation() method to set the location the frame initially appears, or the setBounds() method to set both the location and the size of the frame at the same time.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!