/** * Constructs a JComboBox populated with devices of specified Micro-Manager type Attaches a * listener and sets selected item to what is specified in the Devices class. * * @param deviceType - Micro-Manager device type (mmcorej.DeviceType) * @param deviceKey - ASi diSPIM device key (see Devices class) * @param maximumWidth - * @return final JComboBox */ public JComboBox makeDeviceSelectionBox( mmcorej.DeviceType deviceType, Devices.Keys deviceKey, int maximumWidth) { // when editing this method do the same to the one with array argument too JComboBox deviceBox = new JComboBox(); ArrayList<String> devices = new ArrayList<String>(); StrVector strvDevices = core_.getLoadedDevicesOfType(deviceType); devices.addAll(Arrays.asList(strvDevices.toArray())); devices.add(0, ""); deviceBox.removeAllItems(); for (String device : devices) { deviceBox.addItem(device); } deviceBox.addActionListener(new DeviceBoxListener(deviceKey, deviceBox)); deviceBox.setSelectedItem( devices_.getMMDevice(deviceKey)); // selects whatever device was read in by prefs deviceBox.setMaximumSize(new Dimension(maximumWidth, 30)); return deviceBox; }