Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter buttons are positioned wrong when starting from empty panel #218

Closed
mlopatkin opened this issue Jan 9, 2022 · 4 comments · Fixed by #224 or #237
Closed

Filter buttons are positioned wrong when starting from empty panel #218

mlopatkin opened this issue Jan 9, 2022 · 4 comments · Fixed by #224 or #237
Assignees
Labels
a:bug Something isn't working affects-version:0.21 in:gui Tweaking GUI, implementing new UI
Milestone

Comments

@mlopatkin
Copy link
Owner

Steps to reproduce:

  1. Start with no filters
  2. Create a filter
  3. Observe broken layout
    image

Resize fixes.

The filter panel also shrinks if all filters are deleted.

@mlopatkin mlopatkin added a:bug Something isn't working in:gui Tweaking GUI, implementing new UI affects-version:0.21 labels Jan 9, 2022
@mlopatkin mlopatkin added this to the 0.21 milestone Jan 9, 2022
@mlopatkin mlopatkin self-assigned this Jan 9, 2022
@mlopatkin
Copy link
Owner Author

On Windows, the alignment is fine, and jump in size when deleting the last filter is less prominent. Both systems are running in 125%.

mlopatkin added a commit that referenced this issue Jan 13, 2022
The JPanel's default FlowLayout adds 5px paddings on top and bottom.
Without any filter buttons it is of no concern as the panel with(out)
buttons has a desired height of 0, so it is stretched out to the size of
the container. When the filter button appears, these paddings are
applied and this caused the FilterPanel to become 10px taller.

The fix is to remove the default paddings from the inner JPanel.
Instead, some paddings were added to the FilterPanel itself to achieve
a more pleasant look.

Additionally, a "revalidate()+repaint()" spell is now used when the
filter is added. Without this, the change in height is not propagated
to the FilterPanel (thought there is no more change in height).

Issue: #218
mlopatkin added a commit that referenced this issue Jan 13, 2022
The JPanel's default FlowLayout adds 5px paddings on top and bottom.
Without any filter buttons it is of no concern as the panel with(out)
buttons has a desired height of 0, so it is stretched out to the size of
the container. When the filter button appears, these paddings are
applied and this caused the FilterPanel to become 10px taller.

The fix is to remove the default paddings from the inner JPanel.
Instead, some paddings were added to the FilterPanel itself to achieve
a more pleasant look.

Additionally, a "revalidate()+repaint()" spell is now used when the
filter is added. Without this, the change in height is not propagated
to the FilterPanel (thought there is no more change in height).

Issue: #218
mlopatkin added a commit that referenced this issue Jan 13, 2022
The JPanel's default FlowLayout adds 5px paddings on top and bottom.
Without any filter buttons it is of no concern as the panel with(out)
buttons has a desired height of 0, so it is stretched out to the size of
the container. When the filter button appears, these paddings are
applied and this caused the FilterPanel to become 10px taller.

The fix is to remove the default paddings from the inner JPanel.
Instead, some paddings were added to the FilterPanel itself to achieve
a more pleasant look.

Additionally, a "revalidate()+repaint()" spell is now used when the
filter is added. Without this, the change in height is not propagated
to the FilterPanel (thought there is no more change in height).

Issue: #218
@mlopatkin
Copy link
Owner Author

Ok. I fixed Linux, but the Windows is now broken. Guess, FlatLaF adds some space for the panel on Windows by defaut.

@mlopatkin mlopatkin reopened this Jan 14, 2022
@mlopatkin mlopatkin modified the milestones: 0.21, 0.21.1 Jan 14, 2022
@mlopatkin
Copy link
Owner Author

On Linux with 125% scaling and Java 8 we have:

name.mlopatkin.andlogview.ui.filterpanel.FilterPanel[,0,0,1141x52,invalid,layout=javax.swing.BoxLayout,alignmentX=0.0,alignmentY=0.0,border=javax.swing.border.EmptyBorder@55bd7733,flags=9,maximumSize=,minimumSize=,preferredSize=]
      javax.swing.Box$Filler[,5,5,5x42,alignmentX=0.0,alignmentY=0.0,border=,flags=0,maximumSize=java.awt.Dimension[width=5,height=42],minimumSize=java.awt.Dimension[width=5,height=42],preferredSize=java.awt.Dimension[width=5,height=42]]
      javax.swing.JButton[,10,5,46x42,alignmentX=0.0,alignmentY=0.5,border=com.formdev.flatlaf.ui.FlatButtonBorder@6b223705,flags=288,maximumSize=,minimumSize=,preferredSize=,defaultIcon=com.formdev.flatlaf.extras.FlatSVGIcon@10c70d46,disabledIcon=,disabledSelectedIcon=,margin=java.awt.Insets[top=4,left=4,bottom=4,right=4],paintBorder=true,paintFocus=true,pressedIcon=,rolloverEnabled=true,rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,text=,defaultCapable=true]
      javax.swing.Box$Filler[,56,5,5x42,alignmentX=0.0,alignmentY=0.0,border=,flags=0,maximumSize=java.awt.Dimension[width=5,height=42],minimumSize=java.awt.Dimension[width=5,height=42],preferredSize=java.awt.Dimension[width=5,height=42]]
      javax.swing.JButton[,61,26,0x0,hidden,disabled,alignmentX=0.0,alignmentY=0.5,border=com.formdev.flatlaf.ui.FlatButtonBorder@6b223705,flags=288,maximumSize=,minimumSize=,preferredSize=,defaultIcon=com.formdev.flatlaf.extras.FlatSVGIcon@2abc33a1,disabledIcon=,disabledSelectedIcon=,margin=java.awt.Insets[top=4,left=2,bottom=4,right=2],paintBorder=true,paintFocus=true,pressedIcon=,rolloverEnabled=true,rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,text=,defaultCapable=true]
      javax.swing.Box$Filler[,61,5,5x42,alignmentX=0.0,alignmentY=0.0,border=,flags=0,maximumSize=java.awt.Dimension[width=5,height=42],minimumSize=java.awt.Dimension[width=5,height=42],preferredSize=java.awt.Dimension[width=5,height=42]]
      javax.swing.JSeparator[,66,26,0x0,hidden,alignmentX=0.0,alignmentY=0.0,border=,flags=0,maximumSize=,minimumSize=,preferredSize=,orientation=VERTICAL]
      javax.swing.Box$Filler[,66,5,5x42,alignmentX=0.0,alignmentY=0.0,border=,flags=0,maximumSize=java.awt.Dimension[width=5,height=42],minimumSize=java.awt.Dimension[width=5,height=42],preferredSize=java.awt.Dimension[width=5,height=42]]
      javax.swing.JScrollPane[,71,5,1050x42,layout=javax.swing.ScrollPaneLayout$UIResource,alignmentX=0.0,alignmentY=0.0,border=javax.swing.border.EmptyBorder@1406dd2a,flags=320,maximumSize=,minimumSize=,preferredSize=,columnHeader=,horizontalScrollBar=javax.swing.JScrollPane$ScrollBar[,0,0,0x0,hidden,layout=com.formdev.flatlaf.ui.FlatScrollBarUI,alignmentX=0.0,alignmentY=0.0,border=,flags=4194632,maximumSize=,minimumSize=,preferredSize=,blockIncrement=10,orientation=HORIZONTAL,unitIncrement=1],horizontalScrollBarPolicy=HORIZONTAL_SCROLLBAR_NEVER,lowerLeft=,lowerRight=,rowHeader=,upperLeft=,upperRight=,verticalScrollBar=javax.swing.JScrollPane$ScrollBar[,0,0,0x0,hidden,layout=com.formdev.flatlaf.ui.FlatScrollBarUI,alignmentX=0.0,alignmentY=0.0,border=,flags=4194632,maximumSize=,minimumSize=,preferredSize=,blockIncrement=10,orientation=VERTICAL,unitIncrement=1],verticalScrollBarPolicy=VERTICAL_SCROLLBAR_NEVER,viewport=javax.swing.JViewport[,0,0,1050x42,layout=javax.swing.ViewportLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=25165832,maximumSize=,minimumSize=,preferredSize=,isViewSizeSet=true,lastPaintPosition=java.awt.Point[x=0,y=0],scrollUnderway=false],viewportBorder=]
       javax.swing.JViewport[,0,0,1050x42,layout=javax.swing.ViewportLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=25165832,maximumSize=,minimumSize=,preferredSize=,isViewSizeSet=true,lastPaintPosition=java.awt.Point[x=0,y=0],scrollUnderway=false]
        javax.swing.JPanel[,0,0,1050x42,layout=java.awt.FlowLayout,alignmentX=0.0,alignmentY=0.0,border=javax.swing.border.EmptyBorder@1406dd2a,flags=9,maximumSize=,minimumSize=,preferredSize=]
         name.mlopatkin.andlogview.filters.MainFilterController$DialogPanelFilter@1c9ffe01 name.mlopatkin.andlogview.ui.filterpanel.FilterPanel$FilterButton[,5,0,46x42,alignmentX=0.0,alignmentY=0.5,border=com.formdev.flatlaf.ui.FlatButtonBorder@4663dd4b,flags=288,maximumSize=,minimumSize=,preferredSize=,defaultIcon=com.formdev.flatlaf.extras.FlatSVGIcon@3c035fd1,disabledIcon=,disabledSelectedIcon=,margin=java.awt.Insets[top=4,left=4,bottom=4,right=4],paintBorder=true,paintFocus=true,pressedIcon=,rolloverEnabled=true,rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,text=]
       javax.swing.JScrollPane$ScrollBar[,0,0,0x0,hidden,layout=com.formdev.flatlaf.ui.FlatScrollBarUI,alignmentX=0.0,alignmentY=0.0,border=,flags=4194632,maximumSize=,minimumSize=,preferredSize=,blockIncrement=10,orientation=VERTICAL,unitIncrement=1]
        com.formdev.flatlaf.ui.FlatScrollBarUI$FlatScrollBarButton[,0,0,0x0,alignmentX=0.0,alignmentY=0.5,border=,flags=20971808,maximumSize=,minimumSize=,preferredSize=,defaultIcon=,disabledIcon=,disabledSelectedIcon=,margin=javax.swing.plaf.InsetsUIResource[top=2,left=14,bottom=2,right=14],paintBorder=true,paintFocus=true,pressedIcon=,rolloverEnabled=true,rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,text=,defaultCapable=true]
        com.formdev.flatlaf.ui.FlatScrollBarUI$FlatScrollBarButton[,0,0,0x0,alignmentX=0.0,alignmentY=0.5,border=,flags=20971808,maximumSize=,minimumSize=,preferredSize=,defaultIcon=,disabledIcon=,disabledSelectedIcon=,margin=javax.swing.plaf.InsetsUIResource[top=2,left=14,bottom=2,right=14],paintBorder=true,paintFocus=true,pressedIcon=,rolloverEnabled=true,rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,text=,defaultCapable=true]
       javax.swing.JScrollPane$ScrollBar[,0,0,0x0,hidden,layout=com.formdev.flatlaf.ui.FlatScrollBarUI,alignmentX=0.0,alignmentY=0.0,border=,flags=4194632,maximumSize=,minimumSize=,preferredSize=,blockIncrement=10,orientation=HORIZONTAL,unitIncrement=1]
        com.formdev.flatlaf.ui.FlatScrollBarUI$FlatScrollBarButton[,0,0,0x0,alignmentX=0.0,alignmentY=0.5,border=,flags=20971808,maximumSize=,minimumSize=,preferredSize=,defaultIcon=,disabledIcon=,disabledSelectedIcon=,margin=javax.swing.plaf.InsetsUIResource[top=2,left=14,bottom=2,right=14],paintBorder=true,paintFocus=true,pressedIcon=,rolloverEnabled=true,rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,text=,defaultCapable=true]
        com.formdev.flatlaf.ui.FlatScrollBarUI$FlatScrollBarButton[,0,0,0x0,alignmentX=0.0,alignmentY=0.5,border=,flags=20971808,maximumSize=,minimumSize=,preferredSize=,defaultIcon=,disabledIcon=,disabledSelectedIcon=,margin=javax.swing.plaf.InsetsUIResource[top=2,left=14,bottom=2,right=14],paintBorder=true,paintFocus=true,pressedIcon=,rolloverEnabled=true,rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,text=,defaultCapable=true]
      javax.swing.Box$Filler[,1121,5,5x42,alignmentX=0.0,alignmentY=0.0,border=,flags=0,maximumSize=java.awt.Dimension[width=5,height=42],minimumSize=java.awt.Dimension[width=5,height=42],preferredSize=java.awt.Dimension[width=5,height=42]]
      javax.swing.JSeparator[,1126,26,0x0,hidden,alignmentX=0.0,alignmentY=0.0,border=,flags=0,maximumSize=,minimumSize=,preferredSize=,orientation=VERTICAL]
      javax.swing.Box$Filler[,1126,5,5x42,alignmentX=0.0,alignmentY=0.0,border=,flags=0,maximumSize=java.awt.Dimension[width=5,height=42],minimumSize=java.awt.Dimension[width=5,height=42],preferredSize=java.awt.Dimension[width=5,height=42]]
      javax.swing.JButton[,1131,26,0x0,hidden,disabled,alignmentX=0.0,alignmentY=0.5,border=com.formdev.flatlaf.ui.FlatButtonBorder@6b223705,flags=288,maximumSize=,minimumSize=,preferredSize=,defaultIcon=com.formdev.flatlaf.extras.FlatSVGIcon@d89df1d,disabledIcon=,disabledSelectedIcon=,margin=java.awt.Insets[top=4,left=2,bottom=4,right=2],paintBorder=true,paintFocus=true,pressedIcon=,rolloverEnabled=true,rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,text=,defaultCapable=true]
      javax.swing.Box$Filler[,1131,5,5x42,alignmentX=0.0,alignmentY=0.0,border=,flags=0,maximumSize=java.awt.Dimension[width=5,height=42],minimumSize=java.awt.Dimension[width=5,height=42],preferredSize=java.awt.Dimension[width=5,height=42]]
     javax.swing.JPanel[,0,52,1141x24,layout=javax.swing.BoxLayout,alignmentX=0.0,alignmentY=0.0,border=javax.swing.border.EtchedBorder@2fc4bc0b,flags=9,maximumSize=,minimumSize=,preferredSize=]
      javax.swing.JLabel[,2,12,0x0,alignmentX=0.0,alignmentY=0.0,border=,flags=8388608,maximumSize=,minimumSize=,preferredSize=,defaultIcon=,disabledIcon=,horizontalAlignment=LEFT,horizontalTextPosition=TRAILING,iconTextGap=4,labelFor=,text=,verticalAlignment=CENTER,verticalTextPosition=CENTER]
      javax.swing.Box$Filler[,2,12,948x0,alignmentX=0.0,alignmentY=0.0,border=,flags=0,maximumSize=java.awt.Dimension[width=32767,height=0],minimumSize=java.awt.Dimension[width=0,height=0],preferredSize=java.awt.Dimension[width=0,height=0]]
      javax.swing.JLabel[,950,2,184x20,alignmentX=0.0,alignmentY=0.0,border=,flags=8388608,maximumSize=,minimumSize=,preferredSize=,defaultIcon=,disabledIcon=,horizontalAlignment=LEADING,horizontalTextPosition=TRAILING,iconTextGap=4,labelFor=,text=Waiting for a device…,verticalAlignment=CENTER,verticalTextPosition=CENTER]
      javax.swing.Box$Filler[,1134,4,5x16,alignmentX=0.0,alignmentY=0.0,border=,flags=0,maximumSize=java.awt.Dimension[width=5,height=16],minimumSize=java.awt.Dimension[width=5,height=16],preferredSize=java.awt.Dimension[width=5,height=16]]

@mlopatkin
Copy link
Owner Author

On Windows with the same we have this:

name.mlopatkin.andlogview.ui.filterpanel.FilterPanel[,0,0,923x52,layout=javax.swing.BoxLayout,alignmentX=0.0,alignmentY=0.0,border=javax.swing.border.EmptyBorder@5a456d14,flags=9,maximumSize=,minimumSize=,preferredSize=]
      javax.swing.Box$Filler[,5,5,5x42,alignmentX=0.0,alignmentY=0.0,border=,flags=0,maximumSize=java.awt.Dimension[width=5,height=42],minimumSize=java.awt.Dimension[width=5,height=42],preferredSize=java.awt.Dimension[width=5,height=42]]
      javax.swing.JButton[,10,9,36x34,alignmentX=0.0,alignmentY=0.5,border=com.formdev.flatlaf.ui.FlatButtonBorder@79a9ef24,flags=288,maximumSize=,minimumSize=,preferredSize=,defaultIcon=com.formdev.flatlaf.extras.FlatSVGIcon@6209f128,disabledIcon=,disabledSelectedIcon=,margin=java.awt.Insets[top=4,left=4,bottom=4,right=4],paintBorder=true,paintFocus=true,pressedIcon=,rolloverEnabled=true,rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,text=,defaultCapable=true]
      javax.swing.Box$Filler[,46,5,5x42,alignmentX=0.0,alignmentY=0.0,border=,flags=0,maximumSize=java.awt.Dimension[width=5,height=42],minimumSize=java.awt.Dimension[width=5,height=42],preferredSize=java.awt.Dimension[width=5,height=42]]
      javax.swing.JButton[,51,26,0x0,hidden,disabled,alignmentX=0.0,alignmentY=0.5,border=com.formdev.flatlaf.ui.FlatButtonBorder@79a9ef24,flags=288,maximumSize=,minimumSize=,preferredSize=,defaultIcon=com.formdev.flatlaf.extras.FlatSVGIcon@61c071cb,disabledIcon=,disabledSelectedIcon=,margin=java.awt.Insets[top=4,left=2,bottom=4,right=2],paintBorder=true,paintFocus=true,pressedIcon=,rolloverEnabled=true,rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,text=,defaultCapable=true]
      javax.swing.Box$Filler[,51,5,5x42,alignmentX=0.0,alignmentY=0.0,border=,flags=0,maximumSize=java.awt.Dimension[width=5,height=42],minimumSize=java.awt.Dimension[width=5,height=42],preferredSize=java.awt.Dimension[width=5,height=42]]
      javax.swing.JSeparator[,56,26,0x0,hidden,alignmentX=0.0,alignmentY=0.0,border=,flags=0,maximumSize=,minimumSize=,preferredSize=,orientation=VERTICAL]
      javax.swing.Box$Filler[,56,5,5x42,alignmentX=0.0,alignmentY=0.0,border=,flags=0,maximumSize=java.awt.Dimension[width=5,height=42],minimumSize=java.awt.Dimension[width=5,height=42],preferredSize=java.awt.Dimension[width=5,height=42]]
      javax.swing.JScrollPane[,61,5,842x42,layout=javax.swing.ScrollPaneLayout$UIResource,alignmentX=0.0,alignmentY=0.0,border=javax.swing.border.EmptyBorder@101c9d2a,flags=320,maximumSize=,minimumSize=,preferredSize=,columnHeader=,horizontalScrollBar=javax.swing.JScrollPane$ScrollBar[,0,0,0x0,hidden,layout=com.formdev.flatlaf.ui.FlatScrollBarUI,alignmentX=0.0,alignmentY=0.0,border=,flags=4194632,maximumSize=,minimumSize=,preferredSize=,blockIncrement=10,orientation=HORIZONTAL,unitIncrement=1],horizontalScrollBarPolicy=HORIZONTAL_SCROLLBAR_NEVER,lowerLeft=,lowerRight=,rowHeader=,upperLeft=,upperRight=,verticalScrollBar=javax.swing.JScrollPane$ScrollBar[,0,0,0x0,hidden,layout=com.formdev.flatlaf.ui.FlatScrollBarUI,alignmentX=0.0,alignmentY=0.0,border=,flags=4194632,maximumSize=,minimumSize=,preferredSize=,blockIncrement=10,orientation=VERTICAL,unitIncrement=1],verticalScrollBarPolicy=VERTICAL_SCROLLBAR_NEVER,viewport=javax.swing.JViewport[,0,0,842x42,layout=javax.swing.ViewportLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=25165832,maximumSize=,minimumSize=,preferredSize=,isViewSizeSet=true,lastPaintPosition=java.awt.Point[x=0,y=0],scrollUnderway=false],viewportBorder=]
       javax.swing.JViewport[,0,0,842x42,layout=javax.swing.ViewportLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=25165832,maximumSize=,minimumSize=,preferredSize=,isViewSizeSet=true,lastPaintPosition=java.awt.Point[x=0,y=0],scrollUnderway=false]
        javax.swing.JPanel[,0,0,842x42,layout=java.awt.FlowLayout,alignmentX=0.0,alignmentY=0.0,border=javax.swing.border.EmptyBorder@101c9d2a,flags=9,maximumSize=,minimumSize=,preferredSize=]
         name.mlopatkin.andlogview.filters.MainFilterController$DialogPanelFilter@42886e41 name.mlopatkin.andlogview.ui.filterpanel.FilterPanel$FilterButton[,5,0,36x34,alignmentX=0.0,alignmentY=0.5,border=com.formdev.flatlaf.ui.FlatButtonBorder@b57b6ed,flags=352,maximumSize=,minimumSize=,preferredSize=,defaultIcon=com.formdev.flatlaf.extras.FlatSVGIcon@3db1beb0,disabledIcon=,disabledSelectedIcon=,margin=java.awt.Insets[top=4,left=4,bottom=4,right=4],paintBorder=true,paintFocus=true,pressedIcon=,rolloverEnabled=true,rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,text=]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:bug Something isn't working affects-version:0.21 in:gui Tweaking GUI, implementing new UI
Projects
None yet
1 participant