Now with slightly better error handling.
This commit is contained in:
parent
0ad135f8f1
commit
8433369d60
2 changed files with 400 additions and 398 deletions
|
@ -27,6 +27,8 @@ import java.awt.event.KeyEvent;
|
||||||
import javax.swing.text.*;
|
import javax.swing.text.*;
|
||||||
import java.awt.font.*;
|
import java.awt.font.*;
|
||||||
|
|
||||||
|
import org.thdl.util.ThdlDebug;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interfaces between Extended Wylie and the TibetanMachineWeb fonts.
|
* Interfaces between Extended Wylie and the TibetanMachineWeb fonts.
|
||||||
* To do this this must first read the code table, which lives in "tibwn.ini",
|
* To do this this must first read the code table, which lives in "tibwn.ini",
|
||||||
|
@ -231,11 +233,12 @@ public class TibetanMachineWeb {
|
||||||
URL keyboard_url = TibetanMachineWeb.class.getResource(DEFAULT_KEYBOARD);
|
URL keyboard_url = TibetanMachineWeb.class.getResource(DEFAULT_KEYBOARD);
|
||||||
if (null != keyboard_url) {
|
if (null != keyboard_url) {
|
||||||
try {
|
try {
|
||||||
TibetanKeyboard kb = new TibetanKeyboard(keyboard_url);
|
TibetanKeyboard kb = new TibetanKeyboard(keyboard_url);
|
||||||
setKeyboard(kb);
|
setKeyboard(kb); // this can't throw the InvalidKeyboardException
|
||||||
}
|
}
|
||||||
catch (TibetanKeyboard.InvalidKeyboardException ike) {
|
catch (TibetanKeyboard.InvalidKeyboardException ike) {
|
||||||
System.out.println("invalid keyboard file or file not found");
|
System.out.println("invalid keyboard file or file not found: " + keyboard_url.toString());
|
||||||
|
ThdlDebug.noteIffyCode();
|
||||||
setKeyboard(keyboard);
|
setKeyboard(keyboard);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -473,17 +476,16 @@ public static boolean setKeyboard(TibetanKeyboard kb) {
|
||||||
* if there was an error
|
* if there was an error
|
||||||
*/
|
*/
|
||||||
public static boolean setKeyboard(URL url) {
|
public static boolean setKeyboard(URL url) {
|
||||||
TibetanKeyboard kb;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
kb = new TibetanKeyboard(url);
|
TibetanKeyboard kb = new TibetanKeyboard(url);
|
||||||
if (setKeyboard(kb))
|
if (setKeyboard(kb))
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
catch (TibetanKeyboard.InvalidKeyboardException ike) {
|
catch (TibetanKeyboard.InvalidKeyboardException ike) {
|
||||||
System.out.println("can't create this keyboard");
|
System.out.println("can't create the keyboard associated with " + url);
|
||||||
|
ThdlDebug.noteIffyCode();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue