Skip to content

Commit 3339906

Browse files
committed
Move icon to the factory class, and use it there.
1 parent 4280635 commit 3339906

2 files changed

Lines changed: 14 additions & 11 deletions

File tree

src/main/java/fiji/plugin/trackmate/weka/WekaDetectorConfigurationPanel.java

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
* it under the terms of the GNU General Public License as
99
* published by the Free Software Foundation, either version 3 of the
1010
* License, or (at your option) any later version.
11-
*
11+
*
1212
* This program is distributed in the hope that it will be useful,
1313
* but WITHOUT ANY WARRANTY; without even the implied warranty of
1414
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1515
* GNU General Public License for more details.
16-
*
16+
*
1717
* You should have received a copy of the GNU General Public
1818
* License along with this program. If not, see
1919
* <http://www.gnu.org/licenses/gpl-3.0.html>.
@@ -26,6 +26,7 @@
2626
import static fiji.plugin.trackmate.gui.Fonts.FONT;
2727
import static fiji.plugin.trackmate.gui.Fonts.SMALL_FONT;
2828
import static fiji.plugin.trackmate.gui.Icons.MAGNIFIER_ICON;
29+
import static fiji.plugin.trackmate.weka.WekaDetectorFactory.ICON;
2930
import static fiji.plugin.trackmate.weka.WekaDetectorFactory.KEY_CLASSIFIER_FILEPATH;
3031
import static fiji.plugin.trackmate.weka.WekaDetectorFactory.KEY_CLASS_INDEX;
3132
import static fiji.plugin.trackmate.weka.WekaDetectorFactory.KEY_PROBA_THRESHOLD;
@@ -36,7 +37,6 @@
3637
import java.awt.Insets;
3738
import java.beans.PropertyChangeListener;
3839
import java.io.File;
39-
import java.net.URL;
4040
import java.text.DecimalFormat;
4141
import java.text.NumberFormat;
4242
import java.util.Arrays;
@@ -46,7 +46,6 @@
4646
import java.util.Vector;
4747

4848
import javax.swing.DefaultComboBoxModel;
49-
import javax.swing.ImageIcon;
5049
import javax.swing.JButton;
5150
import javax.swing.JComboBox;
5251
import javax.swing.JFormattedTextField;
@@ -80,8 +79,6 @@ public class WekaDetectorConfigurationPanel extends ConfigurationPanel
8079

8180
private static final NumberFormat THRESHOLD_FORMAT = new DecimalFormat( "#.##" );
8281

83-
protected static final ImageIcon ICON = new ImageIcon( getResource( "images/TrackMateWeka-logo-100px.png" ) );
84-
8582
private static final String TITLE = WekaDetectorFactory.NAME;
8683

8784
private static final FileFilter fileFilter = new FileNameExtensionFilter( "Weka classifier files.", "model" );
@@ -433,9 +430,4 @@ public void run()
433430
}
434431
}.start();
435432
}
436-
437-
protected static URL getResource( final String name )
438-
{
439-
return WekaDetectorFactory.class.getClassLoader().getResource( name );
440-
}
441433
}

src/main/java/fiji/plugin/trackmate/weka/WekaDetectorFactory.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,15 @@
2727
import java.util.HashMap;
2828
import java.util.Map;
2929

30+
import javax.swing.ImageIcon;
31+
3032
import org.scijava.plugin.Plugin;
3133

3234
import fiji.plugin.trackmate.Model;
3335
import fiji.plugin.trackmate.Settings;
3436
import fiji.plugin.trackmate.detection.SpotDetector;
3537
import fiji.plugin.trackmate.detection.SpotDetectorFactory;
38+
import fiji.plugin.trackmate.gui.GuiUtils;
3639
import fiji.plugin.trackmate.gui.components.ConfigurationPanel;
3740
import fiji.plugin.trackmate.io.IOUtils;
3841
import fiji.plugin.trackmate.util.TMUtils;
@@ -77,6 +80,8 @@ public class WekaDetectorFactory< T extends RealType< T > & NativeType< T > > im
7780

7881
public static final String DOC_URL = "https://imagej.net/plugins/trackmate/detectors/trackmate-weka";
7982

83+
public static final ImageIcon ICON = new ImageIcon( GuiUtils.getResource( "images/TrackMateWeka-logo-100px.png", WekaDetectorFactory.class ) );
84+
8085
/** An html information text. */
8186
public static final String INFO_TEXT = "<html>"
8287
+ "This detector relies on the 'Trainable Weka segmentation' plugin to detect objects."
@@ -175,6 +180,12 @@ public Map< String, Object > getDefaultSettings()
175180
return settings;
176181
}
177182

183+
@Override
184+
public ImageIcon getIcon()
185+
{
186+
return ICON;
187+
}
188+
178189
@Override
179190
public String getInfoText()
180191
{

0 commit comments

Comments
 (0)