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 8fcb7e1..dda6dab 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 @@ -8,6 +8,7 @@ import org.micromanager.lightsheetmanager.gui.components.Panel; import org.micromanager.lightsheetmanager.model.LightSheetManagerModel; import org.micromanager.lightsheetmanager.api.data.MultiChannelMode; +import org.micromanager.lightsheetmanager.model.channels.ChannelSpec; import javax.swing.JLabel; import java.util.ArrayList; @@ -79,14 +80,18 @@ private void createEventHandlers() { // repaint(); System.out.println("add channel"); table_.getData().printChannelData(); - asb.channels(table_.getData().getChannelArray()); + final ChannelSpec[] channels = table_.getData().getChannelArray(); + asb.channels(channels); + asb.numChannels(channels.length); }); btnRemoveChannel_.registerListener(e -> { final int row = table_.getTable().getSelectedRow(); if (row != -1) { table_.getData().removeChannel(row); - asb.channels(table_.getData().getChannelArray()); + final ChannelSpec[] channels = table_.getData().getChannelArray(); + asb.channels(channels); + asb.numChannels(channels.length); table_.refreshData(); System.out.println("remove row index: " + row); } diff --git a/src/main/java/org/micromanager/lightsheetmanager/model/channels/ChannelTableData.java b/src/main/java/org/micromanager/lightsheetmanager/model/channels/ChannelTableData.java index 85f0d2f..6b72a64 100644 --- a/src/main/java/org/micromanager/lightsheetmanager/model/channels/ChannelTableData.java +++ b/src/main/java/org/micromanager/lightsheetmanager/model/channels/ChannelTableData.java @@ -18,6 +18,7 @@ public ChannelTableData() { public ChannelTableData(final ChannelSpec[] channels, final String channelGroup) { channels_ = new ArrayList<>(); + // TODO: Objects.requireNonNull if (channels != null) { Collections.addAll(channels_, channels); }