File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Centring a component in NetBeans GUI Builder

 
Luigi Plinge
Ranch Hand
Posts: 441
IntelliJ IDE Scala Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm just trying to centre a button horizontally on a form, at a fixed vertical distance from the text area, so that it stays centred when the window is resized. How do I do this?

I did find a way, but not sure if it's standard, so let me know how you'd do it!

 
Luigi Plinge
Ranch Hand
Posts: 441
IntelliJ IDE Scala Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, the way I managed it was by inserting another JPanel, which stretched across the background panel, and changing its layout to FlowLayout so that the button was centred. Standard?

But is there no way to centre a component (rather than anchoring it to the left or right) in the default GroupLayout?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic