Skip to content

Commit

Permalink
IT WORKS
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosuc3m committed Nov 22, 2024
1 parent dd8387b commit 2d897c6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/main/java/ai/nets/samj/gui/JSwitchButton.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package ai.nets.samj.gui;

import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.AbstractButton;
Expand Down Expand Up @@ -35,6 +36,10 @@ public JSwitchButton(String trueLabel, String falseLabel) {
public void mouseReleased(MouseEvent e) {
if (isEnabled()) {
setSelected(!isSelected());
fireActionPerformed(
new ActionEvent(JSwitchButton.this,
ActionEvent.ACTION_PERFORMED,
getActionCommand()));
}
}
});
Expand Down
7 changes: 5 additions & 2 deletions src/main/java/ai/nets/samj/gui/MainGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,12 @@ public void windowClosed(WindowEvent e) {
}

private void setInstantPromptsEnabled(boolean enabled) {
if (enabled)
if (enabled) {
consumer.enableAddingToRoiManager(this.chkRoiManager.isSelected());
consumer.activateListeners();
else
} else {
consumer.deactivateListeners();
}
}

private void setTwoThirdsEnabled(boolean enabled) {
Expand All @@ -177,6 +179,7 @@ private void loadModel() {
try {
// TODO try removing Cast
cmbModels.loadModel(Cast.unchecked(cmbImages.getSelectedRai()));
consumer.enableAddingToRoiManager(this.chkRoiManager.isSelected());
consumer.setFocusedImage(cmbImages.getSelectedObject());
consumer.setModel(cmbModels.getSelectedModel());
setInstantPromptsEnabled(this.chkInstant.isSelected());
Expand Down

0 comments on commit 2d897c6

Please sign in to comment.