Skip to content

Commit

Permalink
make channel table preset a combo box
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandon committed Oct 3, 2023
1 parent f92001f commit f4bed69
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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<String> 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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit f4bed69

Please sign in to comment.