miglayout icon indicating copy to clipboard operation
miglayout copied to clipboard

Migpane problem with size

Open Hugolarson opened this issue 4 years ago • 6 comments

Hello, Having used Mig for Swing for many and now am transitioning to JavaFX and have discovered a strange issue how nodes are displayed on differnet computers.

Consider this code;

`public class MigPaneMain extends Application {

@Override
public void start (Stage stage) throws Exception {
        MigPane root = new MigPane();
        Scene scene = new Scene(root);

        Label lbl = new Label("label");
        TextField tf = new TextField();
        VBox box = new VBox(tf, lbl);
        
        root.add(box, "w 200!");
        
        //Button b = new Button("Hello");
        //root.getChildren().add(b);

        stage.setScene(scene);
        stage.setTitle("FX");
        stage.setWidth(1000);
        stage.setHeight(500);
        stage.show();
}

public static void main (String[] args) {
        launch (args);
}

}` Both computer Windows 10. Java-8_181. MipPane. 5.3.

Computer 1. w 200! is not respected

image

Computer 2

image

Let me know if you need debug information.

Br, Hugo

Hugolarson avatar Jun 05 '20 08:06 Hugolarson

That is very strange. The only thing I can come to think of is if the textfields are reporting different preferred or maximum sizes. Try creating the MigPane with new MigPane("debug"); And see the preferred/max size of the textfield with System.out.println(tf.prefWidth(-1)); System.out.println(tf.maxWidth(-1)); and see of they differ on the computers.

Also, does anything change if the windows are resized (which means the layout will be recalculated)?

Other than that it's hard for me to solve it if it is local to just one computer. Chances are that there's something strange with that computer rather than with MigLayout, but stranger things have happened. :)

mikaelgrev avatar Jun 05 '20 08:06 mikaelgrev

Hi,

Have not rolled out our JavaFX software yet so this might not be isolated problem. Have not seen this problem with swing miglayout on 200 + computers.

Any more ideas?

UPDATED. resize the windows did not do anything. still bad.

Computer 1 (bad) tf 148.5078125 tf 1.7976931348623157E308 vbox 149.0 vbox 1.7976931348623157E308

image

Computer 2. tf 186.134765625 tf 1.7976931348623157E308 vbox 187.0 vbox 1.7976931348623157E308

image

Hugolarson avatar Jun 05 '20 09:06 Hugolarson

I JavaFX running with MigLayout on multiple computers at customers and a lot of on Windows, so I don't think this is a general problem. MigLayout also have quite a large user base, so it it was a generic problem I think I would have heard about it, or at least I hope so. :) No further ideas unfortunately other than to try with a newer Java version to see if there is something in JavaFX.

mikaelgrev avatar Jun 05 '20 09:06 mikaelgrev

Strange that this same computer Mig works fine with swing but not JavaFX. Same Java version.

Hugolarson avatar Jun 05 '20 09:06 Hugolarson

It is strange indeed.

mikaelgrev avatar Jun 05 '20 12:06 mikaelgrev

Hello, We have now observed this issue on several other computers. Here is one example of a modern computer https://www.asus.com/Laptops/X540LA/ Tried as you suggested with newer java 8-252 from Azul https://www.azul.com/downloads/zulu-community/?version=java-8-lts&os=windows&architecture=x86-64-bit&package=jre-fx

If you want we can give you access to this laptop or provide you with debug information.

Please address this issue of your great library.

Thanks.

Hugolarson avatar Jun 12 '20 07:06 Hugolarson