JideBoxLayout does not have expected height

This is the forum for JIDE Common Layer which is open sourced at https://github.com/jidesoft/jide-oss. Please note, JIDE technical support doesn't monitor this forum as often as other forums. Please consider subscribe for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

Moderator: JIDE Support

Forum rules
Community driven forum for open source JIDE Common Layer. JIDE technical support doesn't monitor this forum as often as other forums. If you only use JIDE Common Layer, please consider subscribing for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

JideBoxLayout does not have expected height

Postby lvr » Wed May 12, 2010 2:59 pm

Hello,
I have a JideBoxLayout(LINE_AXIS) within a GridbagLayout cell.
I've got 3 components within. The main component is a JLabel added with VARY constraint (but i've got the same problem with FLEXIBLE). It receives its text from the selection in a Jtable.
When nothing is selected the text of the JLabel is set to "--".
When its text is "--" its height is smaller than when it has a normal text (eg "c:\some folder\some file.txt").
I don't have this problem with a classic BoxLayout, where height is constant.
I tried to force the height (both Minimum- and PreferredSize) of the label using the label's FontMetrics to compute a desired height. It doesn't change anything.
How should I proceed ?
Thanks,
lvr
 
Posts: 8
Joined: Tue Feb 02, 2010 4:38 pm

Re: JideBoxLayout does not have expected height

Postby JIDE Support » Wed May 12, 2010 3:24 pm

Could please submit a complete small test case with this bug report? I don't think i can continue without a test case. Thanks.
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Re: JideBoxLayout does not have expected height

Postby lvr » Thu May 13, 2010 3:29 am

It was a bit difficult to extract this behavior from my main code.
It's in a small rar. I posted it here. Please uncompress it. I joined the source file. Look for comments with "JIDEBOXLAYOUT MISBEHAVIOUR" to find the problem.
lvr
 
Posts: 8
Joined: Tue Feb 02, 2010 4:38 pm

Re: JideBoxLayout does not have expected height

Postby JIDE Support » Thu May 13, 2010 11:31 am

I got it running but without an explanation, I can't figure out how to use and how to reproduce the issue? If you could extract your code out to make it simple so that I can compile and run, it will be really helpful. Sometimes when you try to make it simple, you figure out the problem yourself. It often happens.

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Re: JideBoxLayout does not have expected height

Postby lvr » Fri May 14, 2010 3:04 am

Actually, I can't make it simpler. The problem seems to be when the JideBoxLayout being inserted into a Gridbaglayout.
I ran into problems with buttons getting a huge size when inserted in a JideBoxLayout set in a GridBagLayout. I parted from the JideBoxLayout to make it work.
To make the test, just click on "Select". This will put some dummy data in the form below. Press "Reset" to empty the form.
When the form is empty, the big yellow label will display a "--" text. When the form contains data, the label will display a file path.
In the code, the label is called labFile.
In the method jbInit(), I put it in panel with JideBoxLayout with constraint VARY and I put the panel in a GridBagLayout
In the method setSamples(newsamples), if samples is null or empty I put "--" in labFile. Otherwise I put newsamples[0].getFile().getPath().

If you can manage to understand the code, nevermind. I solved it with BoxLayout + HorizontalGlue.
Regdars,
lvr
 
Posts: 8
Joined: Tue Feb 02, 2010 4:38 pm

Re: JideBoxLayout does not have expected height

Postby JIDE Support » Fri May 14, 2010 7:47 am

Good to know you workaround it. A a peer developer, I would suggest never use GridBagLayout. Using simpler Swing layout managers for easy stuffs and some other 3rd party layout managers such as Forms, Mig etc for complex stuffs. I would even further suggest you never use any GUI builders (and no JBuilder as well) but that's probably a personal preference than a suggestion :)

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am


Return to JIDE Common Layer Open Source Project Discussion (Community Driven)

Who is online

Users browsing this forum: No registered users and 67 guests