From c6815053bca27b1c2374548e06779a97651fe07d Mon Sep 17 00:00:00 2001 From: Niki Roo Date: Thu, 2 Jan 2020 15:22:13 +0100 Subject: [PATCH] TUI: fix not-editable fields --- .../reader/tui/TSimpleScrollableWindow.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/be/nikiroo/fanfix/reader/tui/TSimpleScrollableWindow.java b/src/be/nikiroo/fanfix/reader/tui/TSimpleScrollableWindow.java index 48a225e6..f9e79743 100644 --- a/src/be/nikiroo/fanfix/reader/tui/TSimpleScrollableWindow.java +++ b/src/be/nikiroo/fanfix/reader/tui/TSimpleScrollableWindow.java @@ -6,6 +6,7 @@ import jexer.TPanel; import jexer.TScrollableWindow; import jexer.TVScroller; import jexer.TWidget; +import jexer.event.TResizeEvent; public class TSimpleScrollableWindow extends TScrollableWindow { protected TPanel mainPane; @@ -27,7 +28,7 @@ public class TSimpleScrollableWindow extends TScrollableWindow { int width, int height, int flags, int realWidth, int realHeight) { super(application, title, width, height, flags); - mainPane = new TPanel(this, 0, 0, width, 80) { + mainPane = new TPanel(this, 0, 0, 1, 1) { @Override public void draw() { for (TWidget children : mainPane.getChildren()) { @@ -41,10 +42,8 @@ public class TSimpleScrollableWindow extends TScrollableWindow { } }; - // // TODO: test - // for (int i = 0; i < 80; i++) { - // mainPane.addLabel("ligne " + i, i, i); - // } + mainPane.setWidth(getWidth()); + mainPane.setHeight(getHeight()); setRealWidth(realWidth); setRealHeight(realHeight); @@ -93,6 +92,14 @@ public class TSimpleScrollableWindow extends TScrollableWindow { reflowData(); } + @Override + public void onResize(TResizeEvent event) { + super.onResize(event); + mainPane.setWidth(getWidth()); + mainPane.setHeight(getHeight()); + mainPane.onResize(event); + } + @Override public void reflowData() { super.reflowData(); -- 2.27.0