rtitec / miglayout

Automatically exported from code.google.com/p/miglayout
0 stars 0 forks source link

MigPane sizing not properly #8

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Run attached source

What is the expected output? What do you see instead?
MigPane doesn't handle properly the pane sizing, in fact it should match with 
the button's preferred size (like HBox or similar layouts in FX). Instead the 
pane is more little than the button (see screenshot).

What version of the product are you using? On what operating system?
Linux 3.2.0, JRE 1.7.0_45-b18, MigLayout (MigPane) 4.2

Original issue reported on code.google.com by bobbyo...@gmail.com on 4 Dec 2013 at 7:01

Attachments:

GoogleCodeExporter commented 9 years ago
Here is the source with MigPane

Original comment by bobbyo...@gmail.com on 4 Dec 2013 at 7:03

Attachments:

GoogleCodeExporter commented 9 years ago
This is not a bug, what you are seeing is MigLayout's default attempts to make 
a UI look good byh adding white space. Try creating MigLayout like this:

MigPane root = new MigPane(new LC().insets("0px"));

Original comment by tbeer...@gmail.com on 8 Dec 2013 at 9:05

GoogleCodeExporter commented 9 years ago
I'm sorry, I've read you issue wrong.

Original comment by tbeer...@gmail.com on 8 Dec 2013 at 9:08

GoogleCodeExporter commented 9 years ago
Ok, interestingly enough MigPane seems to be doing it fine, below are some 
debug prints:

MigPane.setPrefHeight 14.0
MigPane.setPrefHeight 35.0
Button[id=null, styleClass=button] FX2ComponentWrapper.setBound x=7,y=7 / 
w=28,h=21 / resizable=true
MigPane.setPrefHeight 35.0
Button[id=null, styleClass=button] FX2ComponentWrapper.setBound x=7,y=7 / 
w=102,h=21 / resizable=true

The first time setPrefHeight is called, it is set to just the insets (2x7px). 
Later on the button is added (21px) and the prefheight is set to 35px. For some 
reason the window does not pick that up. If I hardcode the prefHeight to 35, so 
the first call also sets 35px, then the window sizes correctly.

Strange

Original comment by tbeer...@gmail.com on 8 Dec 2013 at 12:24

GoogleCodeExporter commented 9 years ago
So it's a problem concerning JavaFX that doesn't update the window size, 
MigLayout, or both?

Original comment by bobbyo...@gmail.com on 8 Dec 2013 at 4:34

GoogleCodeExporter commented 9 years ago
I have found a workaround for this. Maybe it's not a "correct" way, but a 
temporary solution would be to append 

stage.sizeToScene()

after

stage.show()

Original comment by bobbyo...@gmail.com on 9 Dec 2013 at 5:21

GoogleCodeExporter commented 9 years ago
I found the problem, it was a matter of when MigPane recalculated its size and 
when JavaFX wanted to know it. 

Original comment by tbeer...@gmail.com on 11 Dec 2013 at 7:10

GoogleCodeExporter commented 9 years ago
Sweet! :-)
Will it be fixed in a near future release? And can we already have a patch to 
apply to the current release or is it too early to ask?

Original comment by bobbyo...@gmail.com on 11 Dec 2013 at 9:02

GoogleCodeExporter commented 9 years ago
It is already fixed, in the 5.0-SNAPSHOT

Original comment by tbeer...@gmail.com on 12 Dec 2013 at 7:18

GoogleCodeExporter commented 9 years ago
Where can I find the 5.0 snapshot?

Original comment by bobbyo...@gmail.com on 12 Dec 2013 at 11:21

GoogleCodeExporter commented 9 years ago
Good work, Thanks for the fix. Fixed my issues

I downloaded snapshot 5.0 from:
https://oss.sonatype.org/content/repositories/snapshots/com/miglayout/

Original comment by had...@gmail.com on 27 Jan 2014 at 12:23

GoogleCodeExporter commented 9 years ago
I tried the version 5.0, but it's not working with Java7. I get the next 
exception: Caused by: java.lang.UnsupportedClassVersionError: 
org/tbee/javafx/scene/layout/fxml/MigPane : Unsupported major.minor version 52.0

I understand that version 52.0 means Java8, isn't?

Is there a solution for Java7?

Original comment by maq...@gmail.com on 29 May 2014 at 12:46

GoogleCodeExporter commented 9 years ago
5.0 is Java 8, MigPane 4 is for Java 7. I would suggest upgrading to J8, since 
JavaFX  also is a major upgrade.

Original comment by tbeer...@gmail.com on 29 May 2014 at 4:00