Panels resize properly now
This commit is contained in:
parent
25609a8822
commit
88aec67833
@ -37,7 +37,8 @@ public class WindowSwitchListener implements WindowListener, UpdateListener {
|
|||||||
|
|
||||||
private Label[] tabs = new Label[contents.length];
|
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();
|
private Panel holderPanel = new Panel();
|
||||||
|
|
||||||
int current = contents.length - 1;
|
int current = contents.length - 1;
|
||||||
@ -118,9 +119,11 @@ public class WindowSwitchListener implements WindowListener, UpdateListener {
|
|||||||
if(currentColumns < tabColumns)
|
if(currentColumns < tabColumns)
|
||||||
{
|
{
|
||||||
holderPanel.addComponent(
|
holderPanel.addComponent(
|
||||||
contents[current].getPanel().setPreferredSize(new TerminalSize(
|
contents[current].getPanel()
|
||||||
tabColumns - 2,
|
.setPreferredSize(
|
||||||
contents[current].getPanel().getPreferredSize().getRows())));
|
new TerminalSize(
|
||||||
|
tabColumns - 2,
|
||||||
|
contents[current].getPanel().getPreferredSize().getRows())));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -195,7 +198,8 @@ public class WindowSwitchListener implements WindowListener, UpdateListener {
|
|||||||
@Override
|
@Override
|
||||||
public void updatePanel() {
|
public void updatePanel() {
|
||||||
holderPanel.removeAllComponents();
|
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());
|
holderPanel.addComponent(contents[current].getPanel());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user