Skip to content

Commit

Permalink
maybe fix maximize
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam- committed Nov 12, 2023
1 parent 496505b commit 5c77478
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1106,6 +1106,7 @@ public void mouseClicked(MouseEvent e)

private class Layout implements LayoutManager2
{
private int prevState;
private int previousContentWidth;

@Override
Expand Down Expand Up @@ -1144,6 +1145,9 @@ public Dimension minimumLayoutSize(Container content)
@Override
public void layoutContainer(Container content)
{
int changed = prevState ^ frame.getExtendedState();
prevState = frame.getExtendedState();

Component client = content.getComponent(0);
Component sidebar = content.getComponent(1);

Expand Down Expand Up @@ -1199,7 +1203,10 @@ public void layoutContainer(Container content)
sidebar.setBounds(clientWidth, 0, sidebarWidth, height);

frame.revalidateMinimumSize();
frame.containedSetSize(frame.getPreferredSize());
if ((changed & Frame.MAXIMIZED_BOTH) == 0)
{
frame.containedSetSize(frame.getPreferredSize());
}

log.trace("finishing layout - content={} client={} sidebar={} frame={}", content.getWidth(), client.getWidth(), sidebar.getWidth(), frame.getWidth());
}
Expand Down

0 comments on commit 5c77478

Please sign in to comment.