wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes Lining up in the same line in GridBagLayout Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Lining up in the same line in GridBagLayout" Watch "Lining up in the same line in GridBagLayout" New topic
Author

Lining up in the same line in GridBagLayout

Yohan Weerasinghe
Ranch Hand

Joined: Oct 07, 2010
Posts: 499

Please have a look at the following code

The above is the maximum shortened code possible. Removing further more elements will not display the original error.

OK. Now the problem is about alignment. Once you run the code, you will see the following.


As you can see in there, there elements in the `southPanel` are not aligned well with `centerPanel`. Which means, I expect that `southPanel` JLabels to come into the same line where the `centerPanel` JLabels start. But it ended up in this way. I want the JLabels in `southPanel` to be appeared in the same line where the JLabels of `centerPanel` begins. What I am telling is clearly displayed in the following image. How can I do it? Please help!

PS: I am attaching the "Test Image" as well, so you can test it if you want.

PS: Some suggested me to have everything inside the centerPanel. But the case is, I need 2 panels, because I need to display "titles" in that manner, as getting displayed in "TitledBorder".

PS: I noted performing minus values will do the trick. But most developers says it will make troubles.



Please help!



[Thumbnail for TESTING-LOGO.gif]


[Thumbnail for what-I-get.png]


Are you better than me? Then please show me my mistakes..
Yohan Weerasinghe
Ranch Hand

Joined: Oct 07, 2010
Posts: 499

This image explains what I want


[Thumbnail for what-I-wantr.png]

Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
have the replies at StackOverflow resolved the problem?
Yohan Weerasinghe
Ranch Hand

Joined: Oct 07, 2010
Posts: 499

Michael Dunn wrote:have the replies at StackOverflow resolved the problem?


Hi, Thank you for the reply. No I didn't get any help. There is no understandable answer there, which should contain some kind of UNDERSTANDABLE code snippet. Please help.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38808
    
  23
I think MD was alluding to this.
m Korbel
Ranch Hand

Joined: Jun 19, 2012
Posts: 155
and quite good answered (twice asked question) on another forum
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Lining up in the same line in GridBagLayout