#34 call onResize() when window size is changed
[fanfix.git] / src / jexer / TDirectoryList.java
index 71be2ab5d2ddaa3f97ef17488fa2a1d4b007ee0f..c47b33054e95e8c200a24ee8c80f307ef11a86fe 100644 (file)
@@ -3,7 +3,7 @@
  *
  * The MIT License (MIT)
  *
- * Copyright (C) 2016 Kevin Lamonte
+ * Copyright (C) 2017 Kevin Lamonte
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -35,7 +35,7 @@ import java.util.List;
 /**
  * TDirectoryList shows the files within a directory.
  */
-public final class TDirectoryList extends TList {
+public class TDirectoryList extends TList {
 
     /**
      * Files in the directory.
@@ -73,6 +73,11 @@ public final class TDirectoryList extends TList {
             }
         }
         setList(newStrings);
+
+        // Select the first entry
+        if (getMaxSelectedIndex() >= 0) {
+            setSelectedIndex(0);
+        }
     }
 
     /**