From 3454592169dcb61b81de9af2b631b87e7dd86231 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 20 Jan 2013 15:42:05 -0800 Subject: altosui: Make initial AltOS window position configurable Give the user a choice of nine locations on the screen Signed-off-by: Keith Packard --- altosui/AltosConfigureUI.java | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'altosui/AltosConfigureUI.java') diff --git a/altosui/AltosConfigureUI.java b/altosui/AltosConfigureUI.java index 392d7199..fad23f59 100644 --- a/altosui/AltosConfigureUI.java +++ b/altosui/AltosConfigureUI.java @@ -31,6 +31,7 @@ public class AltosConfigureUI AltosVoice voice; public JTextField callsign_value; + public JComboBox position_value; /* DocumentListener interface methods */ public void insertUpdate(DocumentEvent e) { @@ -111,6 +112,36 @@ public class AltosConfigureUI row++; } + final static String[] position_names = { + "Top left", + "Top", + "Top right", + "Left", + "Center", + "Right", + "Bottom left", + "Bottom", + "Bottom right", + }; + + public void add_position() { + pane.add(new JLabel ("Menu position"), constraints(0, 1)); + + position_value = new JComboBox (position_names); + position_value.setMaximumRowCount(position_names.length); + int position = AltosUIPreferences.position(); + position_value.setSelectedIndex(position); + position_value.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + int position = position_value.getSelectedIndex(); + AltosUIPreferences.set_position(position); + } + }); + pane.add(position_value, constraints(1, 2, GridBagConstraints.BOTH)); + position_value.setToolTipText("Position of main AltosUI window"); + row++; + } + public AltosConfigureUI(JFrame owner, AltosVoice voice) { super(owner); -- cgit v1.2.3