| Author |
Why aren't my components wrapping?
|
Luigi Plinge
Ranch Hand
Joined: Jan 06, 2011
Posts: 441
|
|
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
Joined: Jul 08, 2003
Posts: 24061
|
|
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.
|
[Jess in Action][AskingGoodQuestions]
|
 |
Luigi Plinge
Ranch Hand
Joined: Jan 06, 2011
Posts: 441
|
|
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
Joined: Jan 06, 2011
Posts: 441
|
|
Never mind, I worked it out:
|
 |
 |
|
|
subject: Why aren't my components wrapping?
|
|
|