X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=altosui%2FAltosConfigureUI.java;h=85a3f6c0d455954253486536e4abddf7b37a1f90;hp=392d71997d097c98c7999457e169f0c23d2c2836;hb=5a51efd7f9b49ffadc91ccaf7a0d69566301c009;hpb=aed990c3a37249a111c783336afade7ecdda7546 diff --git a/altosui/AltosConfigureUI.java b/altosui/AltosConfigureUI.java index 392d7199..85a3f6c0 100644 --- a/altosui/AltosConfigureUI.java +++ b/altosui/AltosConfigureUI.java @@ -22,7 +22,7 @@ import java.awt.event.*; import java.beans.*; import javax.swing.*; import javax.swing.event.*; -import org.altusmetrum.altosuilib.*; +import org.altusmetrum.altosuilib_3.*; public class AltosConfigureUI extends AltosUIConfigure @@ -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) { @@ -88,6 +89,8 @@ public class AltosConfigureUI row++; } + boolean has_bluetooth; + public void add_bluetooth() { JButton manage_bluetooth = new JButton("Manage Bluetooth"); manage_bluetooth.addActionListener(new ActionListener() { @@ -97,6 +100,7 @@ public class AltosConfigureUI }); pane.add(manage_bluetooth, constraints(0, 2)); /* in the same row as add_frequencies, so don't bump row */ + has_bluetooth = true; } public void add_frequencies() { @@ -107,7 +111,40 @@ public class AltosConfigureUI } }); manage_frequencies.setToolTipText("Configure which values are shown in frequency menus"); - pane.add(manage_frequencies, constraints(2, 1)); + if (has_bluetooth) + pane.add(manage_frequencies, constraints(2, 1)); + else + pane.add(manage_frequencies, constraints(0, 3)); + 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++; }