import libaltosJNI.altos_device;
import libaltosJNI.SWIGTYPE_p_altos_file;
import libaltosJNI.SWIGTYPE_p_altos_list;
-import altosui.AltosDevice;
public class AltosDeviceDialog extends JDialog implements ActionListener {
private static AltosDeviceDialog dialog;
- private static altos_device value = null;
+ private static AltosDevice value = null;
private JList list;
- public static altos_device show (Component frameComp, String product) {
+ public static AltosDevice show (Component frameComp, int product) {
Frame frame = JOptionPane.getFrameForComponent(frameComp);
AltosDevice[] devices;
devices = AltosDevice.list(product);
- if (devices != null & devices.length > 0) {
+ if (devices != null && devices.length > 0) {
value = null;
dialog = new AltosDeviceDialog(frame, frameComp,
devices,
dialog.setVisible(true);
return value;
} else {
- JOptionPane.showMessageDialog(frame,
- "No AltOS devices available",
- "No AltOS devices",
- JOptionPane.ERROR_MESSAGE);
+ /* check for missing altos JNI library, which
+ * will put up its own error dialog
+ */
+ if (AltosUI.load_library(frame)) {
+ JOptionPane.showMessageDialog(frame,
+ "No AltOS devices available",
+ "No AltOS devices",
+ JOptionPane.ERROR_MESSAGE);
+ }
return null;
}
}
//Handle clicks on the Set and Cancel buttons.
public void actionPerformed(ActionEvent e) {
- if ("select".equals(e.getActionCommand())) {
- System.out.printf("got select action\n");
- AltosDeviceDialog.value = (altos_device)(list.getSelectedValue());
- }
+ if ("select".equals(e.getActionCommand()))
+ AltosDeviceDialog.value = (AltosDevice)(list.getSelectedValue());
AltosDeviceDialog.dialog.setVisible(false);
}