This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to center lines using SpringLayout?  RSS feed

 
Larry Krigbaum
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm using the Spring Layout Manager to put a form in a JPanel and I'm trying to center the lines horizontally so they will stay centered when the window is resized. Nothing I've tried has worked, I can't find anything on the web, and even my fallback of seeing how Netbeans does it fails as Netbeans doesn't seem to support the Spring Layout. I'm hoping that someone out there can point me to a reference that will tell me what I need. Thanks for any suggestions.
 
Rob Camick
Ranch Hand
Posts: 2800
15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe it would be easier to use a BoxLayout. Then you can add "glue" before and after your panel. The extra space will be allocated to the glue and your panel will be centered.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!