diff options
| author | Keith Packard <keithp@keithp.com> | 2010-09-09 17:54:41 -0700 |
|---|---|---|
| committer | Keith Packard <keithp@keithp.com> | 2010-09-09 17:57:13 -0700 |
| commit | 8ee3464d8064ebe1694c7b20177878c0d9961451 (patch) | |
| tree | 0bdcc2209aae05fd3d79d92fd2149c5efcb1eda8 /ao-tools/altosui/AltosUI.java | |
| parent | 4224a7526e51eb8fbf1f0a31bae7ee68c6385095 (diff) | |
altosui: Display error dialog when AltOS JNI library can't be loaded
Having an error dialog appear at application startup seems better than
simply failing to present the device dialog later on.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'ao-tools/altosui/AltosUI.java')
| -rw-r--r-- | ao-tools/altosui/AltosUI.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/ao-tools/altosui/AltosUI.java b/ao-tools/altosui/AltosUI.java index 3aaeb888..ca587b25 100644 --- a/ao-tools/altosui/AltosUI.java +++ b/ao-tools/altosui/AltosUI.java @@ -70,8 +70,22 @@ public class AltosUI extends JFrame { public AltosVoice voice = new AltosVoice(); + public static boolean load_library(Frame frame) { + if (!AltosDevice.load_library()) { + JOptionPane.showMessageDialog(frame, + String.format("No AltOS library in \"%s\"", + System.getProperty("java.library.path","<undefined>")), + "Cannot load device access library", + JOptionPane.ERROR_MESSAGE); + return false; + } + return true; + } + public AltosUI() { + load_library(null); + String[] statusNames = { "Height (m)", "State", "RSSI (dBm)", "Speed (m/s)" }; Object[][] statusData = { { "0", "pad", "-50", "0" } }; |
