#36 Use image scaling in example
authorKevin Lamonte <kevin.lamonte@gmail.com>
Fri, 2 Aug 2019 19:00:14 +0000 (14:00 -0500)
committerKevin Lamonte <kevin.lamonte@gmail.com>
Fri, 2 Aug 2019 19:00:14 +0000 (14:00 -0500)
examples/JexerImageViewer.java

index 826960639df92c48306286bdaa9448c0381babcb..437aa8e712153f5a8dd56515094ac685cfb0456c 100644 (file)
@@ -307,12 +307,8 @@ class ImageViewerDesktop extends TDesktop {
         imageWidget = new TImage(this, getWidth() - width,
             getHeight() - height, width, height, image, 0, 0, null);
 
-        // Resize the image down until it can fit within the pane.
-        while ((imageWidget.getRows() > height)
-            || (imageWidget.getColumns() > width)
-        ) {
-            imageWidget.onKeypress(new TKeypressEvent(kbAltDown));
-        }
+        // Resize the image to fit within the pane.
+        imageWidget.setScaleType(TImage.Scale.SCALE);
 
         imageWidget.setActive(false);
         activate(directoryList);