From f4bed695a6f192b14fffcfbf854be805737add2f Mon Sep 17 00:00:00 2001 From: Brandon Date: Mon, 2 Oct 2023 17:48:55 -0700 Subject: [PATCH] make channel table preset a combo box --- .../gui/tabs/channels/ChannelTable.java | 10 ++++++++++ .../gui/tabs/channels/ChannelTablePanel.java | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/micromanager/lightsheetmanager/gui/tabs/channels/ChannelTable.java b/src/main/java/org/micromanager/lightsheetmanager/gui/tabs/channels/ChannelTable.java index a624a02..7e28935 100644 --- a/src/main/java/org/micromanager/lightsheetmanager/gui/tabs/channels/ChannelTable.java +++ b/src/main/java/org/micromanager/lightsheetmanager/gui/tabs/channels/ChannelTable.java @@ -4,9 +4,12 @@ import org.micromanager.lightsheetmanager.model.channels.ChannelSpec; import org.micromanager.lightsheetmanager.model.channels.ChannelTableData; +import javax.swing.DefaultCellEditor; +import javax.swing.JComboBox; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.ListSelectionModel; +import javax.swing.table.TableColumn; import java.util.Objects; public class ChannelTable extends JScrollPane { @@ -26,6 +29,13 @@ public ChannelTable(final LightSheetManagerModel model) { tableModel_ = new ChannelTableModel(tableData_); table_ = new JTable(tableModel_); + // init presets combo box + TableColumn column = table_.getColumnModel().getColumn(1); + JComboBox cmbPresets = new JComboBox<>(); + cmbPresets.addItem("None"); + cmbPresets.setSelectedIndex(0); + column.setCellEditor(new DefaultCellEditor(cmbPresets)); + // cancel JTable edits when focus is lost to prevent errors table_.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE); diff --git a/src/main/java/org/micromanager/lightsheetmanager/gui/tabs/channels/ChannelTablePanel.java b/src/main/java/org/micromanager/lightsheetmanager/gui/tabs/channels/ChannelTablePanel.java index 20ef074..6574b97 100644 --- a/src/main/java/org/micromanager/lightsheetmanager/gui/tabs/channels/ChannelTablePanel.java +++ b/src/main/java/org/micromanager/lightsheetmanager/gui/tabs/channels/ChannelTablePanel.java @@ -27,7 +27,7 @@ public class ChannelTablePanel extends Panel { private ChannelTable table_; - private LightSheetManagerModel model_; + private final LightSheetManagerModel model_; public ChannelTablePanel(final LightSheetManagerModel model, final CheckBox checkBox) { super(checkBox);