Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make channel table preset a combo box #161

Merged
merged 1 commit into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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