diff --git a/src/main/java/ai/nets/samj/gui/LoadingButton.java b/src/main/java/ai/nets/samj/gui/LoadingButton.java index 6d881ab..c6fc52d 100644 --- a/src/main/java/ai/nets/samj/gui/LoadingButton.java +++ b/src/main/java/ai/nets/samj/gui/LoadingButton.java @@ -20,6 +20,9 @@ package ai.nets.samj.gui; import java.awt.Image; +import java.awt.event.ActionEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; import java.io.File; import java.io.IOException; import java.net.URI; @@ -96,6 +99,19 @@ public LoadingButton(String text, String filePath, String filename, double anima gifLabel = new JLabel(gifIcon); gifLabel.setVisible(false); // Initially hide GIF animation add(gifLabel); + + addMouseListener(new MouseAdapter() { + @Override + public void mouseReleased(MouseEvent e) { + if (isEnabled()) { + setPressed(!isSelected()); + fireActionPerformed( + new ActionEvent(LoadingButton.this, + ActionEvent.ACTION_PERFORMED, + getActionCommand())); + } + } + }); } @Override diff --git a/src/main/java/ai/nets/samj/gui/MainGUI.java b/src/main/java/ai/nets/samj/gui/MainGUI.java index eceebc4..0181c44 100644 --- a/src/main/java/ai/nets/samj/gui/MainGUI.java +++ b/src/main/java/ai/nets/samj/gui/MainGUI.java @@ -49,7 +49,7 @@ public class MainGUI extends JFrame { private JCheckBox chkRoiManager = new JCheckBox("Add to RoiManager", true); private JCheckBox retunLargest = new JCheckBox("Only return largest ROI", true); private JSwitchButton chkInstant = new JSwitchButton("LIVE", "OFF"); - private JButton go = new JButton("Go"); + private LoadingButton go = new LoadingButton("Go!", RESOURCES_FOLDER, "loading_animation_samj.gif", 20);; private JButton btnBatchSAMize = new JButton("Batch SAMize"); private JButton close = new JButton("Close"); private JButton help = new JButton("Help"); @@ -73,9 +73,12 @@ public class MainGUI extends JFrame { private static String MANUAL_STR = "Manual"; private static String PRESET_STR = "Preset prompts"; - private static String ROIM_STR = "Selection from ROIManager"; private static String VISIBLE_STR = "visible"; private static String INVISIBLE_STR = "invisible"; + /** + * Name of the folder where the icon images for the dialog buttons are within the resources folder + */ + private static final String RESOURCES_FOLDER = "icons_samj/"; private static final List DEFAULT_MODEL_LIST = new ArrayList<>(); static {