X-Git-Url: http://git.nikiroo.be/?p=jvcard.git;a=blobdiff_plain;f=src%2Fcom%2Fgooglecode%2Flanterna%2Fgui2%2FBorderLayout.java;h=6cc6e85e8d5f779225f0f8355e249c494063e35d;hp=446774c834e3434a0e8d1ceccc57cdf283bf2b6b;hb=0b0b2b0ff1f5e21f7b0feb955b4b54855fb3d508;hpb=9c8baf0c360173b864683176c567757429c4fb12 diff --git a/src/com/googlecode/lanterna/gui2/BorderLayout.java b/src/com/googlecode/lanterna/gui2/BorderLayout.java index 446774c..6cc6e85 100644 --- a/src/com/googlecode/lanterna/gui2/BorderLayout.java +++ b/src/com/googlecode/lanterna/gui2/BorderLayout.java @@ -133,16 +133,38 @@ public class BorderLayout implements LayoutManager { if(layout.containsKey(Location.LEFT)) { Component leftComponent = layout.get(Location.LEFT); leftComponentWidth = Math.min(leftComponent.getPreferredSize().getColumns(), availableHorizontalSpace); + + /* + if(leftComponentWidth == availableHorizontalSpace ){ + if(layout.containsKey(Location.RIGHT)) + leftComponentWidth--; + if(layout.containsKey(Location.CENTER)) + leftComponentWidth--; + }*/ + leftComponent.setPosition(new TerminalPosition(0, topComponentHeight)); leftComponent.setSize(new TerminalSize(leftComponentWidth, availableVerticalSpace)); availableHorizontalSpace -= leftComponentWidth; + + if(availableHorizontalSpace<=0) + availableHorizontalSpace=1; } if(layout.containsKey(Location.RIGHT)) { Component rightComponent = layout.get(Location.RIGHT); int rightComponentWidth = Math.min(rightComponent.getPreferredSize().getColumns(), availableHorizontalSpace); + + /* + if(rightComponentWidth == availableHorizontalSpace ){ + if(layout.containsKey(Location.CENTER)) + rightComponentWidth--; + }*/ + rightComponent.setPosition(new TerminalPosition(area.getColumns() - rightComponentWidth, topComponentHeight)); rightComponent.setSize(new TerminalSize(rightComponentWidth, availableVerticalSpace)); availableHorizontalSpace -= rightComponentWidth; + + if(availableHorizontalSpace<=0) + availableHorizontalSpace=1; } if(layout.containsKey(Location.CENTER)) { Component centerComponent = layout.get(Location.CENTER);