--- a/src/jdict/AskWord.java Wed Jul 25 20:47:50 2007 +0200
+++ b/src/jdict/AskWord.java Wed Jul 25 20:52:44 2007 +0200
@@ -2,6 +2,7 @@
import javax.microedition.lcdui.*;
import java.util.Vector;
+import java.io.*;
public class AskWord
implements CommandListener
@@ -16,23 +17,36 @@
final String translit_iksa = "Iksa sistemo";
final String translit_rusa = "ASCII-rusa";
private StringItem showSearch;
+ private String vortaro;
public AskWord()
{
- String in, out;
- in = "hola";
- out = Replace.replace_sub(in, "ho", "pa");
- System.out.println("in: " + in + " out: " + out);
- in = "sxargxo";
- out = Replace.replace_sub(in, "gx", "ĝ");
- System.out.println("in: " + in + " out: " + out);
+ get_vortaro();
show();
}
+ public void get_vortaro()
+ {
+ InputStream vfile = getClass().getResourceAsStream("/dicts/VORTARO");
+ /* 50 bytes maximum for vortaro nomo */
+ byte array[] = new byte[50];
+ int total;
+ try {
+ total = vfile.read(array, 0, 50);
+ } catch (IOException e)
+ {
+ System.out.println("Cannot open VORTARO file. Going to ERROR B.");
+ vortaro = "ERROR";
+ return;
+ }
+ /* This will have '\n' */
+ vortaro = new String(array, 0, total - 1 /* - \n */);
+ }
+
public void show()
{
- myform = new Form("Serĉado");
+ myform = new Form(vortaro);
word = new TextField("Vorto:", "", 20, TextField.ANY);
myform.append(word);
@@ -65,10 +79,7 @@
{
if (c == cmd_sercxi)
{
- /*
- DictIndex index = new DictIndex("tokipona-cat");
- */
- DictIndex index = new DictIndex("alos-eo-ca");
+ DictIndex index = new DictIndex(vortaro);
Vector results;
String toSearch = word.getString();
--- a/src/jdict/Main.java Wed Jul 25 20:47:50 2007 +0200
+++ b/src/jdict/Main.java Wed Jul 25 20:52:44 2007 +0200
@@ -20,23 +20,6 @@
protected void startApp()
{
- /*
- myform = new Form("Info");
-
- InputStream in = getClass().
- getResourceAsStream("/META-INF/MANIFEST.MF");
-
- byte b[] = new byte[10];
-
- try {
- in.read(b);
- } catch (IOException e)
- {
- }
- StringItem sitem = new StringItem(null, new String(b));
- myform.append(sitem);
- */
-
askword = new AskWord();
}