Details

    • Type: Bug Bug
    • Status: In Progress
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:
      None
    • Environment:

      Windows 7, JDK 7, JavaFX 2.0 b38

      Description

      Buttons are always layed out too small. When you add a Button to a layout with new Button("M") it will show as ( ... ). If you add a Button new Button("MM") it will show as ( M... ), so that Button is always a tiny bit too small to show the whole text. For details see attachement.

      1. ButtonTest.java
        1.0 kB
        Michael Paus
      2. Example.java
        2 kB
        refined
      3. MigLayoutFX2ButtonTest.java
        1 kB
        Michael Paus
      4. MigLayoutFx2ButtonTest2.java
        1 kB
        Michael Paus
      5. MigLayoutFX2Fixed.java
        22 kB
        refined
      1. Fixed.jpg
        228 kB
      2. FXButtons.jpg
        184 kB
      3. netbeans_button_layout.png
        24 kB
      4. screenshot.JPG
        106 kB

        Activity

        Hide
        refined added a comment - - edited

        This is a screenshot after both issues are fixed. Insets is set to 10 for all. Works with insets 0 too.
        I'll upload the sources and explanations for the fixes later today.

        Show
        refined added a comment - - edited This is a screenshot after both issues are fixed. Insets is set to 10 for all. Works with insets 0 too. I'll upload the sources and explanations for the fixes later today.
        Hide
        refined added a comment - - edited

        This is the source file with both issues fixed. I've commented where code has been added or edited.
        The issue with the width and height was fixed in the way I already said.

        The issue with the insets seems to be caused by the fact that MigLayoutFX was not calculating and setting its sizes.
        I've fixed that by setting the sizes of the MigLayoutFX Node when the grid is created (createMigLayoutGrid()). Also I've overriden the computeMin/Max/PrefWidth/Height methods of the Region class, in order the size of the MigLayoutFX Node to be recalculated when resizing.
        I found about this issue when I was creating a MigLayoutFX Node with several components in it and then adding it to another layout (see Example.java). When using the fixed version of MigLayoutFX2, everything works fine (see screenshot).

        Windows XP SP3 x86, JDK7, JavaFX b38.

        Show
        refined added a comment - - edited This is the source file with both issues fixed. I've commented where code has been added or edited. The issue with the width and height was fixed in the way I already said. The issue with the insets seems to be caused by the fact that MigLayoutFX was not calculating and setting its sizes. I've fixed that by setting the sizes of the MigLayoutFX Node when the grid is created (createMigLayoutGrid()). Also I've overriden the computeMin/Max/PrefWidth/Height methods of the Region class, in order the size of the MigLayoutFX Node to be recalculated when resizing. I found about this issue when I was creating a MigLayoutFX Node with several components in it and then adding it to another layout (see Example.java). When using the fixed version of MigLayoutFX2, everything works fine (see screenshot). Windows XP SP3 x86, JDK7, JavaFX b38.
        Hide
        tbee added a comment -

        Changed my mind and added a few lines to quick fix the button / choicebox situation.

        Show
        tbee added a comment - Changed my mind and added a few lines to quick fix the button / choicebox situation.
        Hide
        tbee added a comment -

        Amy Fowler has said this in the JavaFX issue I created:

        The default max width of buttons in JavaFX is their preferred width. If an app wants the buttons to grow to fill a space, it can alter the max:
        button.setMaxWidth(Double.MAX_VALUE).
        We debated quite a bit of what the default max size should be for various controls and ultimately decided to choose max values that corresponded with common use cases. We should do a better job of documenting the default resizable range of each control.

        So it is not a bug, and MigLayout is correct in not letting the buttons grow. I'm very confused about the answer and asked for some elaboration. I'm considering formalizing the quick patch I've made in MigPane (and thus "patch" this control behavior).

        Show
        tbee added a comment - Amy Fowler has said this in the JavaFX issue I created: The default max width of buttons in JavaFX is their preferred width. If an app wants the buttons to grow to fill a space, it can alter the max: button.setMaxWidth(Double.MAX_VALUE). We debated quite a bit of what the default max size should be for various controls and ultimately decided to choose max values that corresponded with common use cases. We should do a better job of documenting the default resizable range of each control. So it is not a bug, and MigLayout is correct in not letting the buttons grow. I'm very confused about the answer and asked for some elaboration. I'm considering formalizing the quick patch I've made in MigPane (and thus "patch" this control behavior).
        Hide
        Michael Paus added a comment -

        I really don't get it how one can declare bad GUI design as a commmon use case and then use that as the justification for a technical decision. Even in Netscape they use aligned buttons. See attachement "netscape_button_layout.png". And it is the same in Eclipse and even in Windows itself. In almost any well designed software that I know of buttons are grouped and aligned in some way which makes it obvious that the majority of buttons has to grow in order to fit the width of the largest one.

        So Tom, please keep the fix in MigPane. This might finally just be one more reason to use MigPane as your only layout pane instead of these crapy layout panes provided with JavaFX (and Swing).

        Show
        Michael Paus added a comment - I really don't get it how one can declare bad GUI design as a commmon use case and then use that as the justification for a technical decision. Even in Netscape they use aligned buttons. See attachement "netscape_button_layout.png". And it is the same in Eclipse and even in Windows itself. In almost any well designed software that I know of buttons are grouped and aligned in some way which makes it obvious that the majority of buttons has to grow in order to fit the width of the largest one. So Tom, please keep the fix in MigPane. This might finally just be one more reason to use MigPane as your only layout pane instead of these crapy layout panes provided with JavaFX (and Swing).

          People

          • Assignee:
            tbee
            Reporter:
            Michael Paus
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated: