diff options
author | Keith Packard <keithp@keithp.com> | 2011-04-18 18:16:38 -0500 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2011-04-18 18:16:38 -0500 |
commit | f249e5926f5fd9f86c41e7f0a414193533d4d8b0 (patch) | |
tree | 2b24f7cfe4d45134caee3b70b428e8f463cfae88 /altosui/AltosBTManage.java | |
parent | 84163eee7847a09fe78f8762b28f857d76bf5755 (diff) |
altosui: Make bluetooth dialog modal
This allows it to be displayed correctly while the device dialog box
(also modal) is up.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altosui/AltosBTManage.java')
-rw-r--r-- | altosui/AltosBTManage.java | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/altosui/AltosBTManage.java b/altosui/AltosBTManage.java index 8e9e0f73..66e1210e 100644 --- a/altosui/AltosBTManage.java +++ b/altosui/AltosBTManage.java @@ -31,9 +31,8 @@ import java.util.concurrent.*; import libaltosJNI.*; public class AltosBTManage extends JDialog implements ActionListener { - String product; LinkedBlockingQueue<AltosBTDevice> found_devices; - JFrame frame; + Frame frame; class DeviceList extends JList implements Iterable<AltosBTDevice> { LinkedList<AltosBTDevice> devices; @@ -104,7 +103,7 @@ public class AltosBTManage extends JDialog implements ActionListener { public void run () { try { - AltosBTDeviceIterator i = new AltosBTDeviceIterator(product); + AltosBTDeviceIterator i = new AltosBTDeviceIterator(Altos.product_any); AltosBTDevice device; while ((device = i.next()) != null) { @@ -124,9 +123,21 @@ public class AltosBTManage extends JDialog implements ActionListener { } } - public AltosBTManage(String product, JFrame in_frame) { + public static void show(Component frameComp) { + Frame frame = JOptionPane.getFrameForComponent(frameComp); + AltosBTManage dialog; + + dialog = new AltosBTManage(frame); + dialog.setVisible(true); + } + + public AltosBTManage(Frame in_frame) { + super(in_frame, "Manage Bluetooth Devices", true); + frame = in_frame; + BTGetVisibleDevices get_visible_devices = new BTGetVisibleDevices(); + Thread t = new Thread(get_visible_devices); t.start(); @@ -182,7 +193,5 @@ public class AltosBTManage extends JDialog implements ActionListener { //Initialize values. // list.setSelectedValue(initial, true); pack(); - setLocationRelativeTo(frame); - setVisible(true); } } |