diff --git a/src/main/java/xyz/thastertyn/UserInterface/WindowSwitchListener.java b/src/main/java/xyz/thastertyn/UserInterface/WindowSwitchListener.java index 1011535..f969a5f 100644 --- a/src/main/java/xyz/thastertyn/UserInterface/WindowSwitchListener.java +++ b/src/main/java/xyz/thastertyn/UserInterface/WindowSwitchListener.java @@ -37,7 +37,8 @@ public class WindowSwitchListener implements WindowListener, UpdateListener { private Label[] tabs = new Label[contents.length]; - private Panel tabsPanel = new Panel().setLayoutManager(new LinearLayout(Direction.HORIZONTAL)); + private Panel tabsPanel = new Panel() + .setLayoutManager(new LinearLayout(Direction.HORIZONTAL)); private Panel holderPanel = new Panel(); int current = contents.length - 1; @@ -114,13 +115,15 @@ public class WindowSwitchListener implements WindowListener, UpdateListener { .getPanel() .getSize() .getColumns(); - + if(currentColumns < tabColumns) { holderPanel.addComponent( - contents[current].getPanel().setPreferredSize(new TerminalSize( - tabColumns - 2, - contents[current].getPanel().getPreferredSize().getRows()))); + contents[current].getPanel() + .setPreferredSize( + new TerminalSize( + tabColumns - 2, + contents[current].getPanel().getPreferredSize().getRows()))); return; } @@ -195,7 +198,8 @@ public class WindowSwitchListener implements WindowListener, UpdateListener { @Override public void updatePanel() { holderPanel.removeAllComponents(); - // Todo find a way to resize the panel on screen + contents[current].getPanel().setPreferredSize(contents[current].getPanel().calculatePreferredSize()); + setPanelPreferedSize(); holderPanel.addComponent(contents[current].getPanel()); }