Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Why aren't my components wrapping?

 
Luigi Plinge
Ranch Hand
Posts: 441
IntelliJ IDE Scala Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I understand that FlowLayout is the default layout manager for JPanels.

So why isn't my text area wrapping in this window?

Thanks for any suggestions...



 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because the WEST component of a JPanel is allowed to be as wide as it requires. The JPanel says it wants to be wide enough to contain all its contents, and the BorderLayout says "OK".

As to why when the window is first created, the TextArea paints over the buttons: that seems like a bug. But in any case, if you expand the window, you'll see what's going on.

If you want the JTextArea to be below the other components, you should arrange that manually by using a different LayoutManager.
 
Luigi Plinge
Ranch Hand
Posts: 441
IntelliJ IDE Scala Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. I've set the left panel's position to CENTER and it looks a bit more as expected.

But I want the components to be left-alligned. I've tried



but the components are still centered within leftPanel. Any suggestions? (BTW I also tried setAlignmentX and that had no effect either.)

 
Luigi Plinge
Ranch Hand
Posts: 441
IntelliJ IDE Scala Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Never mind, I worked it out:

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic