diff --git a/src/main/java/jace/config/Configuration.java b/src/main/java/jace/config/Configuration.java index 277e8dc..fdd6835 100644 --- a/src/main/java/jace/config/Configuration.java +++ b/src/main/java/jace/config/Configuration.java @@ -95,12 +95,7 @@ public class Configuration implements Reconfigurable { } public static Optional getChangedIcon() { - Optional icon = Utility.loadIcon("icon_exclaim.gif"); - if (icon.isPresent()) { - return Optional.of(new ImageView(icon.get())); - } else { - return Optional.empty(); - } + return Utility.loadIcon("icon_exclaim.gif").map(ImageView::new); } @Override diff --git a/src/main/java/jace/hardware/CardDiskII.java b/src/main/java/jace/hardware/CardDiskII.java index 737ecc3..97e8af5 100644 --- a/src/main/java/jace/hardware/CardDiskII.java +++ b/src/main/java/jace/hardware/CardDiskII.java @@ -81,7 +81,8 @@ public class CardDiskII extends Card implements Reconfigurable, MediaConsumerPar currentDrive = drive1; drive1.reset(); drive2.reset(); - EmulatorUILogic.removeIndicators(this); + EmulatorUILogic.removeIndicators(drive1); + EmulatorUILogic.removeIndicators(drive2); // Motherboard.cancelSpeedRequest(this); } @@ -104,13 +105,13 @@ public class CardDiskII extends Card implements Reconfigurable, MediaConsumerPar case 0x8: // drive off currentDrive.setOn(false); - currentDrive.getIcon().ifPresent(icon->EmulatorUILogic.removeIndicator(this, icon)); + currentDrive.removeIndicator(); break; case 0x9: // drive on currentDrive.setOn(true); - currentDrive.getIcon().ifPresent(icon->EmulatorUILogic.addIndicator(this, icon)); + currentDrive.addIndicator(); break; case 0xA: @@ -127,9 +128,6 @@ public class CardDiskII extends Card implements Reconfigurable, MediaConsumerPar // read/write latch currentDrive.write(); e.setNewValue(currentDrive.readLatch()); - if (currentDrive.isOn()) { - currentDrive.getIcon().ifPresent(icon->EmulatorUILogic.removeIndicator(this, icon)); - } break; case 0xF: // write mode diff --git a/src/main/java/jace/hardware/DiskIIDrive.java b/src/main/java/jace/hardware/DiskIIDrive.java index b411619..f461100 100644 --- a/src/main/java/jace/hardware/DiskIIDrive.java +++ b/src/main/java/jace/hardware/DiskIIDrive.java @@ -18,6 +18,7 @@ */ package jace.hardware; +import jace.EmulatorUILogic; import jace.core.Computer; import jace.library.MediaConsumer; import jace.library.MediaEntry; @@ -241,6 +242,25 @@ public class DiskIIDrive implements MediaConsumer { public void setIcon(Optional