experimental 24-bit image protocol
[nikiroo-utils.git] / examples / JexerImageViewer.java
index 826960639df92c48306286bdaa9448c0381babcb..4839c238fd212370c82e5ee6005088fc9a274843 100644 (file)
@@ -106,7 +106,7 @@ class ImageViewerDesktop extends TDesktop {
         setActive(true);
 
         // Add directory treeView
-        treeView = addTreeViewWidget(0, 0, getWidth() / 2, getHeight() - 1,
+        treeView = addTreeViewWidget(0, 0, getWidth() / 2, getHeight(),
             new TAction() {
                 public void DO() {
                     TTreeItem item = treeView.getSelected();
@@ -151,11 +151,6 @@ class ImageViewerDesktop extends TDesktop {
             },
             filters);
 
-        // This appears to be a bug.  If I pass keystrokes to the tree view,
-        // it will center correctly.
-        treeView.onKeypress(new TKeypressEvent(kbDown));
-        treeView.onKeypress(new TKeypressEvent(kbUp));
-
         if (directoryList.getList().size() > 0) {
             activate(directoryList);
             setThumbnail(directoryList.getPath());
@@ -307,12 +302,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);