X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2FTApplication.java;h=d0c34bf0303adbe99e917f6afbcd278032915af6;hb=0d47c5460c8e9d1198928308767a63ad35f46eb8;hp=a37cf03d7382fe564562a2faa06059c5be900c2c;hpb=d09767633248d79d1abc85f94d03b4102fae3f64;p=fanfix.git diff --git a/src/jexer/TApplication.java b/src/jexer/TApplication.java index a37cf03..d0c34bf 100644 --- a/src/jexer/TApplication.java +++ b/src/jexer/TApplication.java @@ -31,6 +31,7 @@ package jexer; import java.io.InputStream; +import java.io.IOException; import java.io.OutputStream; import java.io.UnsupportedEncodingException; import java.util.Collections; @@ -646,7 +647,7 @@ public class TApplication implements Runnable { // Draw the menu title getScreen().hLineXY(x, 0, menu.getTitle().length() + 2, ' ', menuColor); - getScreen().putStrXY(x + 1, 0, menu.getTitle(), menuColor); + getScreen().putStringXY(x + 1, 0, menu.getTitle(), menuColor); // Draw the highlight character getScreen().putCharXY(x + 1 + menu.getMnemonic().getShortcutIdx(), 0, menu.getMnemonic().getShortcut(), menuMnemonicColor); @@ -1820,4 +1821,30 @@ public class TApplication implements Runnable { return new TTerminalWindow(this, x, y, flags); } + /** + * Convenience function to spawn an file open box. + * + * @param path path of selected file + * @return the result of the new file open box + */ + public final String fileOpenBox(final String path) throws IOException { + + TFileOpenBox box = new TFileOpenBox(this, path, TFileOpenBox.Type.OPEN); + return box.getFilename(); + } + + /** + * Convenience function to spawn an file open box. + * + * @param path path of selected file + * @param type one of the Type constants + * @return the result of the new file open box + */ + public final String fileOpenBox(final String path, + final TFileOpenBox.Type type) throws IOException { + + TFileOpenBox box = new TFileOpenBox(this, path, type); + return box.getFilename(); + } + }