Add scaling icons to PAMGuard swing

This commit is contained in:
Jamie Mac 2024-05-29 07:17:13 +01:00
parent 9e13e9a8d5
commit a8f01b1509
15 changed files with 89 additions and 50 deletions

View File

@ -20,6 +20,7 @@ import org.kordamp.ikonli.materialdesign2.MaterialDesignC;
import org.kordamp.ikonli.swing.FontIcon;
import PamUtils.PamCalendar;
import PamView.component.PamSettingsIconButton;
import PamView.dialog.PamGridBagContraints;
/**
@ -40,7 +41,7 @@ public class FileDateDialogStrip {
private JButton settingsButton;
// private ImageIcon settingsIcon = new ImageIcon(ClassLoader.getSystemResource("Resources/SettingsButtonSmall2.png"));
public static FontIcon settingsIcon = FontIcon.of(MaterialDesignC.COG, 20, Color.DARK_GRAY);
public static FontIcon settingsIcon = FontIcon.of(PamSettingsIconButton.SETTINGS_IKON, PamSettingsIconButton.NORMAL_SIZE, Color.DARK_GRAY);
private Window parent;

View File

@ -21,6 +21,7 @@ import org.kordamp.ikonli.materialdesign2.MaterialDesignC;
import org.kordamp.ikonli.swing.FontIcon;
import PamController.PamController;
import PamView.component.PamSettingsIconButton;
import PamView.dialog.PamDialog;
import PamguardMVC.PamDataBlock;
import PamguardMVC.dataSelector.DataSelector;
@ -90,7 +91,7 @@ public class MapDetectionsDialog extends PamDialog {
MapDetectionData md;
// ImageIcon settingsIcon = new ImageIcon(ClassLoader.getSystemResource("Resources/SettingsButtonSmall2.png"));
FontIcon settingsIcon = FontIcon.of(MaterialDesignC.COG, 20, Color.DARK_GRAY);
FontIcon settingsIcon = FontIcon.of(PamSettingsIconButton.SETTINGS_IKON, PamSettingsIconButton.NORMAL_SIZE, Color.DARK_GRAY);
for (int i = 0; i < n; i++) {
md = mapDetectionsParameters.mapDetectionDatas.get(i);

View File

@ -30,7 +30,6 @@ import java.awt.MouseInfo;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
@ -39,17 +38,14 @@ import java.awt.geom.AffineTransform;
import java.awt.image.BufferedImage;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.ConcurrentModificationException;
import java.util.List;
import java.util.ListIterator;
import java.util.Vector;
import javax.swing.ImageIcon;
import javax.swing.JCheckBoxMenuItem;
import javax.swing.JFrame;
import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;
import pamScrollSystem.PamScrollSlider;
import Array.ArrayManager;
import Array.PamArray;
import Array.SnapshotGeometry;
@ -61,7 +57,6 @@ import GPS.GpsData;
import GPS.GpsDataUnit;
import Map.gridbaselayer.GridbaseControl;
import Map.gridbaselayer.MapRasterImage;
import PamController.PamControlledUnit;
import PamController.PamController;
import PamController.PamControllerInterface;
import PamController.masterReference.MasterReferencePoint;
@ -83,7 +78,6 @@ import PamView.PamColors.PamColor;
import PamView.panel.JPanelWithPamKey;
import PamView.panel.KeyPanel;
import PamView.paneloverlay.OverlayCheckboxMenuItem;
import PamView.paneloverlay.overlaymark.MarkDataMatcher;
import PamView.paneloverlay.overlaymark.MarkDataSelector;
import PamView.paneloverlay.overlaymark.MarkOverlayDraw;
import PamView.symbol.PamSymbolChooser;
@ -1476,9 +1470,9 @@ public class MapPanel extends JPanelWithPamKey implements PamObserver, ColorMana
plotDetectorMenu.add(menuItem);
plotDetectorMenu.addSeparator();
ImageIcon settingsIcon = new ImageIcon(ClassLoader.getSystemResource("Resources/SettingsButtonSmall2.png"));
ImageIcon settingsIconNot = new ImageIcon(
ClassLoader.getSystemResource("Resources/SettingsButtonSmallWhite.png"));
// ImageIcon settingsIcon = new ImageIcon(ClassLoader.getSystemResource("Resources/SettingsButtonSmall2.png"));
// ImageIcon settingsIconNot = new ImageIcon(
// ClassLoader.getSystemResource("Resources/SettingsButtonSmallWhite.png"));
ArrayList<MapDetectionData> mddList = simpleMapRef.mapDetectionsManager.getMapDetectionDatas();
for (int i = 0; i < mddList.size(); i++) {

View File

@ -1,6 +1,7 @@
package PamView;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
@ -13,6 +14,10 @@ import javax.swing.JPanel;
import javax.swing.JToolBar;
import javax.swing.Timer;
import org.kordamp.ikonli.materialdesign2.MaterialDesignP;
import org.kordamp.ikonli.materialdesign2.MaterialDesignR;
import org.kordamp.ikonli.swing.FontIcon;
import warnings.PamWarning;
import warnings.SingleLineWarningDisplay;
import warnings.WarningDisplay;
@ -22,6 +27,7 @@ import PamController.PamControlledUnit;
import PamController.PamController;
import PamUtils.PamCalendar;
import PamView.PamColors.PamColor;
import PamView.component.PamSettingsIconButton;
import PamView.dialog.PamLabel;
import PamView.panel.PamPanel;
@ -51,19 +57,15 @@ public class TopToolBar extends PamToolBar implements ColorManaged {
pamController = PamController.getInstance();
if (pamController.getRunMode() == PamController.RUN_PAMVIEW) {
add(startButton = new JButton(new ImageIcon(ClassLoader
.getSystemResource("Resources/playStart.png"))));
add(startButton = new JButton(FontIcon.of(MaterialDesignP.PLAY, PamSettingsIconButton.NORMAL_SIZE, Color.DARK_GRAY)));
startButton.setToolTipText("Start sound playback");
add(stopButton = new JButton(new ImageIcon(ClassLoader
.getSystemResource("Resources/playPause.png"))));
add(stopButton = new JButton(FontIcon.of(MaterialDesignP.PAUSE, PamSettingsIconButton.NORMAL_SIZE, Color.DARK_GRAY)));
stopButton.setToolTipText("Stop sound playback");
}
else {
add(startButton = new JButton(new ImageIcon(ClassLoader
.getSystemResource("Resources/recordStart.png"))));
add(startButton = new JButton(FontIcon.of(MaterialDesignR.RECORD_CIRCLE, PamSettingsIconButton.NORMAL_SIZE, Color.RED)));
startButton.setToolTipText("Start PAM processing");
add(stopButton = new JButton(new ImageIcon(ClassLoader
.getSystemResource("Resources/playPause.png"))));
add(stopButton = new JButton(FontIcon.of(MaterialDesignP.PAUSE, PamSettingsIconButton.NORMAL_SIZE, Color.DARK_GRAY)));
stopButton.setToolTipText("Stop PAM processing");
}
startButton.addActionListener(new StartButton());

View File

@ -2,21 +2,29 @@ package PamView.component;
import java.awt.Color;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import org.kordamp.ikonli.Ikon;
import org.kordamp.ikonli.materialdesign2.MaterialDesignC;
import org.kordamp.ikonli.swing.FontIcon;
public class PamSettingsIconButton extends JButton {
/**
*
*/
private static final long serialVersionUID = 1L;
public static final int SMALL_SIZE = 17;
public static final int NORMAL_SIZE = 20;
/**
* The ikon enum for the the setting button
*/
public static Ikon SETTINGS_IKON = MaterialDesignC.COG;
// private static final ImageIcon settingsIcon = new ImageIcon(ClassLoader.getSystemResource("Resources/SettingsButtonSmall2.png"));
private static final FontIcon settingsIcon = FontIcon.of(MaterialDesignC.COG, 20, Color.DARK_GRAY);
private static final FontIcon settingsIcon = FontIcon.of(SETTINGS_IKON, NORMAL_SIZE, Color.DARK_GRAY);
/**
* Create a simple square button using the given icon.

View File

@ -10,6 +10,8 @@ import javax.swing.JButton;
import org.kordamp.ikonli.materialdesign2.MaterialDesignC;
import org.kordamp.ikonli.swing.FontIcon;
import PamView.component.PamSettingsIconButton;
/**
* Standard settings button with the little cogwheel for use throughout Swing components.
* @author dg50
@ -27,7 +29,7 @@ public class SettingsButton extends JButton {
}
private static Icon makeIcon() {
return FontIcon.of(MaterialDesignC.COG, 20, Color.DARK_GRAY);
return FontIcon.of(PamSettingsIconButton.SETTINGS_IKON, PamSettingsIconButton.SMALL_SIZE, Color.DARK_GRAY);
// return new ImageIcon(ClassLoader.getSystemResource("Resources/SettingsButtonSmall2.png"));
}

View File

@ -16,8 +16,13 @@ import javax.swing.JCheckBox;
import javax.swing.JComponent;
import javax.swing.JPanel;
import org.kordamp.ikonli.materialdesign2.MaterialDesignC;
import org.kordamp.ikonli.materialdesign2.MaterialDesignP;
import org.kordamp.ikonli.swing.FontIcon;
import PamView.PamColors;
import PamView.PamColors.PamColor;
import PamView.component.PamSettingsIconButton;
import PamView.dialog.PamButtonAlpha;
import PamView.dialog.PamDialog;
import PamView.panel.CornerLayoutContraint;
@ -29,14 +34,18 @@ public class HidingDialog extends PamDialog {
JCheckBox pinButton;
private ImageIcon settings=new ImageIcon(ClassLoader
.getSystemResource("Resources/SettingsButtonSmallWhite.png"));
// private ImageIcon settings=new ImageIcon(ClassLoader
// .getSystemResource("Resources/SettingsButtonSmallWhite.png"));
//
// private ImageIcon pinImage = new ImageIcon(ClassLoader
// .getSystemResource("Resources/pinbuttonwhite.png"));
//
// private ImageIcon pinHide = new ImageIcon(ClassLoader
// .getSystemResource("Resources/deletewhite.png"));
private ImageIcon pinImage = new ImageIcon(ClassLoader
.getSystemResource("Resources/pinbuttonwhite.png"));
private ImageIcon pinHide = new ImageIcon(ClassLoader
.getSystemResource("Resources/deletewhite.png"));
private static final FontIcon settings = FontIcon.of(PamSettingsIconButton.SETTINGS_IKON, PamSettingsIconButton.SMALL_SIZE, Color.WHITE);
private static final FontIcon pinImage = FontIcon.of(MaterialDesignP.PIN, PamSettingsIconButton.SMALL_SIZE, Color.WHITE);
private static final FontIcon pinHide = FontIcon.of(MaterialDesignP.PIN_OFF, PamSettingsIconButton.SMALL_SIZE, Color.WHITE);
public HidingDialog(Window parentFrame, HidingDialogPanel hidingDialogPanel, String title, boolean hasDefault) {

View File

@ -1,5 +1,6 @@
package PamView.paneloverlay;
import java.awt.Color;
import java.awt.Point;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
@ -8,6 +9,10 @@ import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JCheckBoxMenuItem;
import org.kordamp.ikonli.materialdesign2.MaterialDesignC;
import org.kordamp.ikonli.swing.FontIcon;
import PamView.component.PamSettingsIconButton;
import PamView.symbol.PamSymbolManager;
import PamguardMVC.PamDataBlock;
import PamguardMVC.dataSelector.DataSelector;
@ -23,8 +28,12 @@ import PamguardMVC.dataSelector.DataSelector;
public class OverlayCheckboxMenuItem extends JCheckBoxMenuItem {
public static final ImageIcon settingsIcon = new ImageIcon(ClassLoader.getSystemResource("Resources/SettingsButtonSmall2.png"));
public static final ImageIcon settingsIconNot = new ImageIcon(ClassLoader.getSystemResource("Resources/SettingsButtonSmallWhite.png"));
// public static final ImageIcon settingsIcon = new ImageIcon(ClassLoader.getSystemResource("Resources/SettingsButtonSmall2.png"));
// public static final ImageIcon settingsIconNot = new ImageIcon(ClassLoader.getSystemResource("Resources/SettingsButtonSmallWhite.png"));
private static final FontIcon settingsIcon = FontIcon.of(PamSettingsIconButton.SETTINGS_IKON, PamSettingsIconButton.SMALL_SIZE, Color.DARK_GRAY);
private static final FontIcon settingsIconNot = FontIcon.of(PamSettingsIconButton.SETTINGS_IKON, PamSettingsIconButton.SMALL_SIZE, Color.WHITE);
private static final long serialVersionUID = 1L;

View File

@ -5,16 +5,11 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.swing.ImageIcon;
import javax.swing.JComponent;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import PamController.PamController;
import PamView.GeneralProjector;
import PamView.GeneralProjector.ParameterType;
import PamView.GeneralProjector.ParameterUnits;
import PamView.PanelOverlayDraw;
import PamView.symbol.PamSymbolChooser;
import PamView.symbol.PamSymbolManager;
import PamguardMVC.DataBlockNameComparator;
@ -33,9 +28,12 @@ import PamguardMVC.dataSelector.DataSelector;
*/
public abstract class OverlayDataManager<TOverlayInfoType extends OverlayDataInfo> implements OverlayDataObserver {
private ImageIcon settingsIcon = new ImageIcon(ClassLoader.getSystemResource("Resources/SettingsButtonSmall2.png"));
// private ImageIcon settingsIcon = new ImageIcon(ClassLoader.getSystemResource("Resources/SettingsButtonSmall2.png"));
// private ImageIcon settingsIconNot = new ImageIcon(ClassLoader.getSystemResource("Resources/SettingsButtonSmallWhite.png"));
// private static final FontIcon settingsIcon = FontIcon.of(MaterialDesignC.COG, 16, Color.DARK_GRAY);
// private static final FontIcon settingsIconNot = FontIcon.of(MaterialDesignC.COG, 16, Color.WHITE);
private ImageIcon settingsIconNot = new ImageIcon(ClassLoader.getSystemResource("Resources/SettingsButtonSmallWhite.png"));
private OverlaySwingPanel swingPanel;

View File

@ -22,6 +22,9 @@ import javax.swing.JRadioButton;
import javax.swing.JToolBar;
import javax.swing.border.EmptyBorder;
import org.kordamp.ikonli.materialdesign2.MaterialDesignP;
import org.kordamp.ikonli.swing.FontIcon;
import soundPlayback.PlaybackControl;
import clickDetector.BTDisplayParameters;
import clickDetector.ClickBTDisplay;
@ -29,6 +32,7 @@ import clickDetector.ClickControl;
import clickDetector.ClickDisplay;
import clickDetector.ClickClassifiers.ClickIdentifier;
import PamView.PamToolBar;
import PamView.component.PamSettingsIconButton;
import PamView.dialog.PamCheckBox;
import PamView.dialog.PamLabel;
import PamView.dialog.PamRadioButton;
@ -75,14 +79,16 @@ public class OfflineToolbar {
toolBar = new PamToolBar("Offline Click Analysis");
if (isViewer) {
playClicks = new JButton(new ImageIcon(ClassLoader
.getSystemResource("Resources/clickPlayStart.png")));
// private static final FontIcon settings = FontIcon.of(PamSettingsIconButton.SETTINGS_IKON, PamSettingsIconButton.SMALL_SIZE, Color.WHITE);
playClicks = new JButton(FontIcon.of(MaterialDesignP.PLAY_CIRCLE_OUTLINE, PamSettingsIconButton.NORMAL_SIZE, Color.DARK_GRAY));
playClicks.addActionListener(new PlayClicks());
playClicks.setToolTipText("Play clicks (pack empty space with 0's)");
PlaybackControl.registerPlayButton(playClicks);
reAnalyseClicks = new JButton(new ImageIcon(ClassLoader
.getSystemResource("Resources/reanalyseClicks.png")));
.getSystemResource("Resources/reanalyseClicks.png")));
reAnalyseClicks.addActionListener(new ReanalyseClicks());
reAnalyseClicks.setToolTipText("Re-analyse clicks");
}

View File

@ -10,6 +10,10 @@ import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import org.kordamp.ikonli.materialdesign2.MaterialDesignC;
import org.kordamp.ikonli.swing.FontIcon;
import PamView.component.PamSettingsIconButton;
import PamView.dialog.PamButtonAlpha;
import PamView.dialog.PamDialog;
import PamView.hidingpanel.TabbedHidingPane;
@ -25,8 +29,11 @@ public class CompoundHidingTabPane extends TabbedHidingPane{
private static final long serialVersionUID = 1L;
public static final ImageIcon settingsImage=new ImageIcon(ClassLoader
.getSystemResource("Resources/SettingsButtonSmallWhite.png"));
// public static final ImageIcon settingsImage=new ImageIcon(ClassLoader
// .getSystemResource("Resources/SettingsButtonSmallWhite.png"));
public static final FontIcon settingsImage = FontIcon.of(PamSettingsIconButton.SETTINGS_IKON, PamSettingsIconButton.SMALL_SIZE, Color.WHITE);
public CompoundHidingTabPane() {

View File

@ -31,6 +31,7 @@ import PamUtils.PamCalendar;
import PamUtils.TxtFileUtils;
import PamView.CancelObserver;
import PamView.DBTextArea;
import PamView.component.PamSettingsIconButton;
import PamView.dialog.PamDialog;
import PamView.dialog.PamFileBrowser;
import PamView.dialog.PamGridBagContraints;
@ -93,7 +94,7 @@ public class OLProcessDialog extends PamDialog {
// public static ImageIcon settings = new ImageIcon(ClassLoader.getSystemResource("Resources/SettingsButtonSmall2.png"));
public static FontIcon settings = FontIcon.of(MaterialDesignC.COG, 20, Color.DARK_GRAY);
public static FontIcon settings = FontIcon.of(PamSettingsIconButton.SETTINGS_IKON, PamSettingsIconButton.NORMAL_SIZE, Color.DARK_GRAY);
TaskStatus currentStatus = TaskStatus.IDLE;

View File

@ -37,7 +37,7 @@ public class HidingPane extends StackPane {
/**
* The opacity of the button when the mouse is outside the show button
*/
private double showButtonOpacity = 0.25;
private double showButtonOpacity = 0.8;
/**

View File

@ -94,7 +94,7 @@ public class DLPredictionPlotInfoFX extends GenericLinePlotInfo {
if (getDlControl().getDLModel()!=null) {
DLClassName[] classNames = getDlControl().getDLModel().getClassNames();
System.out.println("Class names are: !!! " + (classNames == null ? "null" : classNames.length));
// System.out.println("Class names are: !!! " + (classNames == null ? "null" : classNames.length));
if (classNames!=null) {

View File

@ -38,6 +38,7 @@ import targetMotionModule.algorithms.TargetMotionModel;
import PamDetection.PamDetection;
import PamView.ColorManaged;
import PamView.PamColors.PamColor;
import PamView.component.PamSettingsIconButton;
import PamView.dialog.PamDialog;
import PamView.dialog.PamGridBagContraints;
import PamView.panel.PamPanel;
@ -79,7 +80,7 @@ public class TargetMotionMainPanel<T extends PamDataUnit> implements PamTabPanel
// public ImageIcon settings = new ImageIcon(ClassLoader
// .getSystemResource("Resources/SettingsButtonSmall2.png"));
public static FontIcon settings = FontIcon.of(MaterialDesignC.COG, 20, Color.DARK_GRAY);
public static FontIcon settings = FontIcon.of(PamSettingsIconButton.SETTINGS_IKON, PamSettingsIconButton.NORMAL_SIZE, Color.DARK_GRAY);
public TargetMotionMainPanel(TargetMotionLocaliser<T> targetMotionLocaliser) {