summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2013-01-19 18:04:08 -0800
committerKeith Packard <keithp@keithp.com>2013-01-20 15:45:16 -0800
commit5d35fd843299b5ff09a36220e6ecd8aefceb9b2c (patch)
tree63fd35049955a4dd98588af122d14594c405caa9
parentaed990c3a37249a111c783336afade7ecdda7546 (diff)
altosui/micropeak: Let native window system place windows
Instead of forcing windows to our choice of positions, let the host window pick reasonable locations. This avoids having all of our windows appear on top of one another. Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--altosui/AltosUI.java1
-rw-r--r--altosuilib/AltosUIFrame.java12
-rw-r--r--micropeak/MicroPeak.java1
3 files changed, 12 insertions, 2 deletions
diff --git a/altosui/AltosUI.java b/altosui/AltosUI.java
index 70142a93..d630ceec 100644
--- a/altosui/AltosUI.java
+++ b/altosui/AltosUI.java
@@ -552,7 +552,6 @@ public class AltosUI extends AltosUIFrame {
/* Handle batch-mode */
if (args.length == 0) {
AltosUI altosui = new AltosUI();
- altosui.setVisible(true);
java.util.List<AltosDevice> devices = AltosUSBDevice.list(Altos.product_basestation);
for (AltosDevice device : devices)
diff --git a/altosuilib/AltosUIFrame.java b/altosuilib/AltosUIFrame.java
index 409aea2e..8a1ba205 100644
--- a/altosuilib/AltosUIFrame.java
+++ b/altosuilib/AltosUIFrame.java
@@ -66,7 +66,19 @@ public class AltosUIFrame extends JFrame implements AltosUIListener {
setIconImages(icons);
}
+ private boolean location_by_platform = true;
+ public void setLocationByPlatform(boolean lbp) {
+ location_by_platform = lbp;
+ super.setLocationByPlatform(lbp);
+ }
+
+ public void setVisible (boolean visible) {
+ if (visible)
+ setLocationByPlatform(location_by_platform);
+ super.setVisible(visible);
+ }
+
public AltosUIFrame() {
AltosUIPreferences.register_ui_listener(this);
addWindowListener(new AltosUIFrameListener());
diff --git a/micropeak/MicroPeak.java b/micropeak/MicroPeak.java
index 5d128dfd..6f5e432c 100644
--- a/micropeak/MicroPeak.java
+++ b/micropeak/MicroPeak.java
@@ -255,7 +255,6 @@ public class MicroPeak extends MicroFrame implements ActionListener, ItemListene
ps.height += i.top + i.bottom;
// setPreferredSize(ps);
setSize(ps);
- setLocationByPlatform(true);
setVisible(true);
}