|
|
|
как сделать простейший UI
|
|||
|---|---|---|---|
|
#18+
У меня есть код программы для вывода указанного каталога, как сделать простейший UI (чтобы был textfield для ввода пути, и еще один для вывода и кнопка enter)... Подскажите если не сложно? import java.io.*; import java.util.*; public class Browser_Files { public static void main(String args[]) { String s; int i; while(true) { System.out.println( "Enter full path : ");//нужно указать путь файла s = new String(getKbdString());// Полученная строка сохраняется в переменной s File f = new File(s); if(!f.exists()) { System.out.println("\nNot found: " + s); continue; } if(!f.isDirectory()) { System.out.println( "\nNot directory: " + s); continue; } String[] sDirList = f.list(); for(i = 0; i < sDirList.length; i++) { File f1 = new File( s + File.separator + sDirList[i]); if(f1.isFile()) System.out.println(sDirList[i]); else System.out.println( "-dir- " + sDirList[i]); } } } // ============================================ // getKbdString // ============================================ static public String getKbdString() { byte bKbd[] = new byte[256]; int iCnt = 0; String szStr = ""; try { iCnt = System.in.read(bKbd); } catch(Exception ex) { System.out.println(ex.toString()); } szStr = new String(bKbd, 0, iCnt); szStr = szStr.trim(); return szStr; } } ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 31.01.2013, 19:46:41 |
|
||
|
|

start [/forum/topic.php?fid=59&fpage=247&tid=2130071]: |
0ms |
get settings: |
19ms |
get forum list: |
32ms |
check forum access: |
4ms |
check topic access: |
4ms |
track hit: |
37ms |
get topic data: |
12ms |
get forum data: |
4ms |
get page messages: |
53ms |
get tp. blocked users: |
2ms |
| others: | 306ms |
| total: | 473ms |

| 0 / 0 |
