Repository: workcraft/workcraft
Issue: Tool control icons do not size correctly when base font size is modified

Tool control icons are loaded together with their plugins, which happens before configuration variables are read from `config.xml`. As a result the tool control buttons may have incorrect icon size in case _Base font size_ is changed (its default value is used instead). A solution is to load the tool control icons only when the corresponding tool is activated for the first time.

Changed files:
workcraft/WorkcraftCore/src/org/workcraft/gui/tools/SelectionTool.java
workcraft/CircuitPlugin/src/org/workcraft/plugins/circuit/tools/CycleAnalyserTool.java
workcraft/WorkcraftCore/src/org/workcraft/utils/GuiUtils.java
workcraft/CircuitPlugin/src/org/workcraft/plugins/circuit/tools/InitialisationAnalyserTool.java
workcraft/PolicyPlugin/src/org/workcraft/plugins/policy/tools/PolicySelectionTool.java
workcraft/CpogPlugin/src/org/workcraft/plugins/cpog/tools/CpogSelectionTool.java
workcraft/WorkcraftCore/src/org/workcraft/gui/tools/SimulationTool.java
workcraft/WorkcraftCore/src/org/workcraft/gui/MainWindowIconManager.java

diff --git a/workcraft/CircuitPlugin/src/org/workcraft/plugins/circuit/tools/CycleAnalyserTool.java b/workcraft/CircuitPlugin/src/org/workcraft/plugins/circuit/tools/CycleAnalyserTool.java
index 450dbb23a..6f75b58ec 100644
--- a/workcraft/CircuitPlugin/src/org/workcraft/plugins/circuit/tools/CycleAnalyserTool.java
+++ b/workcraft/CircuitPlugin/src/org/workcraft/plugins/circuit/tools/CycleAnalyserTool.java
@@ -70,22 +70,22 @@ public class CycleAnalyserTool extends AbstractGraphEditorTool {
     private JPanel getBreakControlsPanel(final GraphEditor editor) {
 
         JButton tagPathBreakerSelfloopPinsButton = GuiUtils.createIconButton(
-                GuiUtils.createIconFromSVG("images/circuit-cycle-selfloop_pins.svg"),
+                "images/circuit-cycle-selfloop_pins.svg",
                 "Path breaker all self-loops",
                 l -> changePathBreaker(editor, c -> CycleUtils.tagPathBreakerSelfloopPins(c)));
 
         JButton tagPathBreakerAutoAppendButton = GuiUtils.createIconButton(
-                GuiUtils.createIconFromSVG("images/circuit-cycle-auto_append.svg"),
+                "images/circuit-cycle-auto_append.svg",
                 "Auto-append path breaker pins as necessary to complete cycle breaking",
                 l -> changePathBreaker(editor, c -> CycleUtils.tagPathBreakerAutoAppend(c)));
 
         JButton tagPathBreakerAutoDiscardButton = GuiUtils.createIconButton(
-                GuiUtils.createIconFromSVG("images/circuit-cycle-auto_discard.svg"),
+                "images/circuit-cycle-auto_discard.svg",
                 "Auto-discard path breaker pins that are redundant for cycle breaking",
                 l -> changePathBreaker(editor, c -> CycleUtils.tagPathBreakerAutoDiscard(c)));
 
         JButton tagPathBreakerClearAllButton = GuiUtils.createIconButton(
-                GuiUtils.createIconFromSVG("images/circuit-cycle-clear_all.svg"),
+                "images/circuit-cycle-clear_all.svg",
                 "Clear all path breaker pins",
                 l -> changePathBreaker(editor, c -> CycleUtils.tagPathBreakerClearAll(c)));
 
diff --git a/workcraft/CircuitPlugin/src/org/workcraft/plugins/circuit/tools/InitialisationAnalyserTool.java b/workcraft/CircuitPlugin/src/org/workcraft/plugins/circuit/tools/InitialisationAnalyserTool.java
index 0e2e952b6..25e4e3f83 100644
--- a/workcraft/CircuitPlugin/src/org/workcraft/plugins/circuit/tools/InitialisationAnalyserTool.java
+++ b/workcraft/CircuitPlugin/src/org/workcraft/plugins/circuit/tools/InitialisationAnalyserTool.java
@@ -71,34 +71,34 @@ public class InitialisationAnalyserTool extends AbstractGraphEditorTool {
 
     private JPanel getForcedControlsPanel(final GraphEditor editor) {
         JButton tagForceInitInputPortsButton = GuiUtils.createIconButton(
-                GuiUtils.createIconFromSVG("images/circuit-initialisation-input_ports.svg"),
-                "Force init all input ports (environment responsibility)");
-        tagForceInitInputPortsButton.addActionListener(l -> changeForceInit(editor, ResetUtils::tagForceInitInputPorts));
+                "images/circuit-initialisation-input_ports.svg",
+                "Force init all input ports (environment responsibility)",
+                l -> changeForceInit(editor, ResetUtils::tagForceInitInputPorts));
 
         JButton tagForceInitNecessaryPinsButton = GuiUtils.createIconButton(
-                GuiUtils.createIconFromSVG("images/circuit-initialisation-problematic_pins.svg"),
-                "Force init output pins with problematic initial state");
-        tagForceInitNecessaryPinsButton.addActionListener(l -> changeForceInit(editor, ResetUtils::tagForceInitProblematicPins));
+                "images/circuit-initialisation-problematic_pins.svg",
+                "Force init output pins with problematic initial state",
+                l -> changeForceInit(editor, ResetUtils::tagForceInitProblematicPins));
 
         JButton tagForceInitSequentialPinsButton = GuiUtils.createIconButton(
-                GuiUtils.createIconFromSVG("images/circuit-initialisation-sequential_pins.svg"),
-                "Force init output pins of sequential gates");
-        tagForceInitSequentialPinsButton.addActionListener(l -> changeForceInit(editor, ResetUtils::tagForceInitSequentialPins));
+                "images/circuit-initialisation-sequential_pins.svg",
+                "Force init output pins of sequential gates",
+                l -> changeForceInit(editor, ResetUtils::tagForceInitSequentialPins));
 
         JButton tagForceInitAutoAppendButton = GuiUtils.createIconButton(
-                GuiUtils.createIconFromSVG("images/circuit-initialisation-auto_append.svg"),
-                "Auto-append force init pins as necessary to complete initialisation");
-        tagForceInitAutoAppendButton.addActionListener(l -> changeForceInit(editor, ResetUtils::tagForceInitAutoAppend));
+                "images/circuit-initialisation-auto_append.svg",
+                "Auto-append force init pins as necessary to complete initialisation",
+                l -> changeForceInit(editor, ResetUtils::tagForceInitAutoAppend));
 
         JButton tagForceInitAutoDiscardButton = GuiUtils.createIconButton(
-                GuiUtils.createIconFromSVG("images/circuit-initialisation-auto_discard.svg"),
-                "Auto-discard force init pins that are redundant for initialisation");
-        tagForceInitAutoDiscardButton.addActionListener(l -> changeForceInit(editor, ResetUtils::tagForceInitAutoDiscard));
+                "images/circuit-initialisation-auto_discard.svg",
+                "Auto-discard force init pins that are redundant for initialisation",
+                l -> changeForceInit(editor, ResetUtils::tagForceInitAutoDiscard));
 
         JButton tagForceInitClearAllButton = GuiUtils.createIconButton(
-                GuiUtils.createIconFromSVG("images/circuit-initialisation-clear_all.svg"),
-                "Clear all force init ports and pins");
-        tagForceInitClearAllButton.addActionListener(l -> changeForceInit(editor, ResetUtils::tagForceInitClearAll));
+                "images/circuit-initialisation-clear_all.svg",
+                "Clear all force init ports and pins",
+                l -> changeForceInit(editor, ResetUtils::tagForceInitClearAll));
 
         JPanel buttonPanel = new JPanel();
         buttonPanel.add(tagForceInitInputPortsButton);
diff --git a/workcraft/CpogPlugin/src/org/workcraft/plugins/cpog/tools/CpogSelectionTool.java b/workcraft/CpogPlugin/src/org/workcraft/plugins/cpog/tools/CpogSelectionTool.java
index 6351537d3..3064a224a 100644
--- a/workcraft/CpogPlugin/src/org/workcraft/plugins/cpog/tools/CpogSelectionTool.java
+++ b/workcraft/CpogPlugin/src/org/workcraft/plugins/cpog/tools/CpogSelectionTool.java
@@ -40,6 +40,9 @@ import java.util.concurrent.ConcurrentLinkedQueue;
 
 public class CpogSelectionTool extends SelectionTool {
 
+    private static final String GROUP_ICON = "images/selection-page.svg";
+    private static final String GROUP_HINT = "Combine selection as a scenario (Alt-G)";
+
     private static final double minRadius = 2.0;
     private static final double expandRadius = 2.0;
 
@@ -211,10 +214,7 @@ public class CpogSelectionTool extends SelectionTool {
         panel.add(expressionScroll, BorderLayout.CENTER);
         panel.add(buttonPanel, BorderLayout.SOUTH);
 
-        JButton groupPageButton = GuiUtils.createIconButton(
-                GuiUtils.createIconFromSVG("images/selection-page.svg"),
-                "Combine selection as a scenario (Alt-G)",
-                event -> groupPageAction(editor));
+        JButton groupPageButton = GuiUtils.createIconButton(GROUP_ICON, GROUP_HINT, event -> groupPageAction(editor));
 
         JPanel groupPanel = getGroupPanel();
         if (groupPanel != null) {
diff --git a/workcraft/PolicyPlugin/src/org/workcraft/plugins/policy/tools/PolicySelectionTool.java b/workcraft/PolicyPlugin/src/org/workcraft/plugins/policy/tools/PolicySelectionTool.java
index 0948e1050..ed997b67c 100644
--- a/workcraft/PolicyPlugin/src/org/workcraft/plugins/policy/tools/PolicySelectionTool.java
+++ b/workcraft/PolicyPlugin/src/org/workcraft/plugins/policy/tools/PolicySelectionTool.java
@@ -23,6 +23,12 @@ import java.util.Set;
 
 public class PolicySelectionTool extends SelectionTool {
 
+    private static final String BUNDLE_ICON = "images/policy-selection-bundle.svg";
+    private static final String UNBUNDLE_ICON = "images/policy-selection-unbundle.svg";
+
+    private static final String BUNDLE_HINT = "Bundle selected transitions (" + DesktopApi.getMenuKeyName() + "-B)";
+    private static final String UNBUNDLE_HINT = "Unbundle selected transitions (" + DesktopApi.getMenuKeyName() + "+Shift-B)";
+
     public PolicySelectionTool() {
         super(true, false, true, true);
     }
@@ -30,17 +36,8 @@ public class PolicySelectionTool extends SelectionTool {
     @Override
     public void updateControlsToolbar(JToolBar toolbar, final GraphEditor editor) {
         super.updateControlsToolbar(toolbar, editor);
-
-        JButton bundleButton = GuiUtils.createIconButton(
-                GuiUtils.createIconFromSVG("images/policy-selection-bundle.svg"),
-                "Bundle selected transitions (" + DesktopApi.getMenuKeyName() + "-B)",
-                event -> selectionBundle(editor));
-
-        JButton unbundleButton = GuiUtils.createIconButton(
-                GuiUtils.createIconFromSVG("images/policy-selection-unbundle.svg"),
-                "Unbundle selected transitions (" + DesktopApi.getMenuKeyName() + "+Shift-B)",
-                event -> selectionUnbundle(editor));
-
+        JButton bundleButton = GuiUtils.createIconButton(BUNDLE_ICON, BUNDLE_HINT, event -> selectionBundle(editor));
+        JButton unbundleButton = GuiUtils.createIconButton(UNBUNDLE_ICON, UNBUNDLE_HINT, event -> selectionUnbundle(editor));
         toolbar.add(bundleButton);
         toolbar.add(unbundleButton);
         toolbar.addSeparator();
diff --git a/workcraft/WorkcraftCore/src/org/workcraft/gui/MainWindowIconManager.java b/workcraft/WorkcraftCore/src/org/workcraft/gui/MainWindowIconManager.java
index 5cafe78bd..5faa424a4 100644
--- a/workcraft/WorkcraftCore/src/org/workcraft/gui/MainWindowIconManager.java
+++ b/workcraft/WorkcraftCore/src/org/workcraft/gui/MainWindowIconManager.java
@@ -1,6 +1,5 @@
 package org.workcraft.gui;
 
-import org.workcraft.dom.visual.SizeHelper;
 import org.workcraft.utils.GuiUtils;
 
 import javax.swing.*;
@@ -34,10 +33,9 @@ public class MainWindowIconManager {
     }
 
     public static void apply(final MainWindow window) {
-        int size = SizeHelper.getIconSize();
         Thread thread = new Thread(() -> {
-            ImageIcon activeSvg = GuiUtils.createIconFromSVG("images/icon.svg", size, size, Color.WHITE);
-            ImageIcon inactiveSvg = GuiUtils.createIconFromSVG("images/icon-inactive.svg", size, size, Color.WHITE);
+            ImageIcon activeSvg = GuiUtils.createIconFromSVG("images/icon.svg");
+            ImageIcon inactiveSvg = GuiUtils.createIconFromSVG("images/icon-inactive.svg");
             final Image activeIcon = activeSvg.getImage();
             final Image inactiveIcon = inactiveSvg.getImage();
             try {
diff --git a/workcraft/WorkcraftCore/src/org/workcraft/gui/tools/SelectionTool.java b/workcraft/WorkcraftCore/src/org/workcraft/gui/tools/SelectionTool.java
index e94e1dc98..bd385e6e5 100644
--- a/workcraft/WorkcraftCore/src/org/workcraft/gui/tools/SelectionTool.java
+++ b/workcraft/WorkcraftCore/src/org/workcraft/gui/tools/SelectionTool.java
@@ -35,6 +35,25 @@ import java.util.*;
 
 public class SelectionTool extends AbstractGraphEditorTool {
 
+    public static final String GROUP_ICON = "images/selection-group.svg";
+    public static final String GROUP_HINT = "Group selection (" + DesktopApi.getMenuKeyName() + "-G)";
+    public static final String PAGE_ICON = "images/selection-page.svg";
+    public static final String PAGE_HHINT = "Combine selection into a page (Alt-G)";
+    public static final String UNGROUP_ICON = "images/selection-ungroup.svg";
+    public static final String UNGROUP_HINT = "Ungroup selection (" + DesktopApi.getMenuKeyName() + "+Shift-G)";
+    public static final String UP_LEVEL_ICON = "images/selection-level_up.svg";
+    public static final String UP_LEVEL_HINT = "Level up (PageUp)";
+    public static final String DOWN_LEVEL_ICON = "images/selection-level_down.svg";
+    public static final String DOWN_LEVEL_HINT = "Level down (PageDown)";
+    public static final String HORIZONTAL_FLIP_ICON = "images/selection-flip_horizontal.svg";
+    public static final String HORIZONTAL_FLIP_HINT = "Flip horizontal";
+    public static final String VERTICAL_FLIP_ICON = "images/selection-flip_vertical.svg";
+    public static final String VERTICAL_FLIP_HINT = "Flip vertical";
+    public static final String CW_ROTATE_ICON = "images/selection-rotate_clockwise.svg";
+    public static final String CW_ROTATE_HINT = "Rotate clockwise";
+    public static final String CCW_ROTATE_ICON = "images/selection-rotate_counterclockwise.svg";
+    public static final String CCW_ROTATE_HINT = "Rotate counterclockwise";
+
     public enum DrugState { NONE, MOVE, SELECT }
     public enum SelectionMode { NONE, ADD, REMOVE, REPLACE }
 
@@ -97,10 +116,7 @@ public class SelectionTool extends AbstractGraphEditorTool {
         super.updateControlsToolbar(toolbar, editor);
 
         if (enableGrouping) {
-            JButton groupButton = GuiUtils.createIconButton(
-                    GuiUtils.createIconFromSVG("images/selection-group.svg"),
-                    "Group selection (" + DesktopApi.getMenuKeyName() + "-G)");
-            groupButton.addActionListener(event -> {
+            JButton groupButton = GuiUtils.createIconButton(GROUP_ICON, GROUP_HINT, event -> {
                 groupSelection(editor);
                 editor.requestFocus();
             });
@@ -108,10 +124,7 @@ public class SelectionTool extends AbstractGraphEditorTool {
         }
 
         if (enablePaging) {
-            JButton groupPageButton = GuiUtils.createIconButton(
-                    GuiUtils.createIconFromSVG("images/selection-page.svg"),
-                    "Combine selection into a page (Alt-G)");
-            groupPageButton.addActionListener(event -> {
+            JButton groupPageButton = GuiUtils.createIconButton(PAGE_ICON, PAGE_HHINT, event -> {
                 pageSelection(editor);
                 editor.requestFocus();
             });
@@ -119,28 +132,19 @@ public class SelectionTool extends AbstractGraphEditorTool {
         }
 
         if (enableGrouping || enablePaging) {
-            JButton ungroupButton = GuiUtils.createIconButton(
-                    GuiUtils.createIconFromSVG("images/selection-ungroup.svg"),
-                    "Ungroup selection (" + DesktopApi.getMenuKeyName() + "+Shift-G)");
-            ungroupButton.addActionListener(event -> {
+            JButton ungroupButton = GuiUtils.createIconButton(UNGROUP_ICON, UNGROUP_HINT, event -> {
                 ungroupSelection(editor);
                 editor.requestFocus();
             });
             toolbar.add(ungroupButton);
 
-            JButton levelUpButton = GuiUtils.createIconButton(
-                    GuiUtils.createIconFromSVG("images/selection-level_up.svg"),
-                    "Level up (PageUp)");
-            levelUpButton.addActionListener(event -> {
+            JButton levelUpButton = GuiUtils.createIconButton(UP_LEVEL_ICON, UP_LEVEL_HINT, event -> {
                 changeLevelUp(editor);
                 editor.requestFocus();
             });
             toolbar.add(levelUpButton);
 
-            JButton levelDownButton = GuiUtils.createIconButton(
-                    GuiUtils.createIconFromSVG("images/selection-level_down.svg"),
-                    "Level down (PageDown)");
-            levelDownButton.addActionListener(event -> {
+            JButton levelDownButton = GuiUtils.createIconButton(DOWN_LEVEL_ICON, DOWN_LEVEL_HINT, event -> {
                 changeLevelDown(editor);
                 editor.requestFocus();
             });
@@ -150,19 +154,13 @@ public class SelectionTool extends AbstractGraphEditorTool {
             toolbar.addSeparator();
         }
         if (enableFlipping) {
-            JButton flipHorizontalButton = GuiUtils.createIconButton(
-                    GuiUtils.createIconFromSVG("images/selection-flip_horizontal.svg"),
-                    "Flip horizontal");
-            flipHorizontalButton.addActionListener(event -> {
+            JButton flipHorizontalButton = GuiUtils.createIconButton(HORIZONTAL_FLIP_ICON, HORIZONTAL_FLIP_HINT, event -> {
                 flipSelectionHorizontal(editor);
                 editor.requestFocus();
             });
             toolbar.add(flipHorizontalButton);
 
-            JButton flipVerticalButton = GuiUtils.createIconButton(
-                    GuiUtils.createIconFromSVG("images/selection-flip_vertical.svg"),
-                    "Flip vertical");
-            flipVerticalButton.addActionListener(event -> {
+            JButton flipVerticalButton = GuiUtils.createIconButton(VERTICAL_FLIP_ICON, VERTICAL_FLIP_HINT, event -> {
                 flipSelectionVertical(editor);
                 editor.requestFocus();
             });
@@ -170,19 +168,13 @@ public class SelectionTool extends AbstractGraphEditorTool {
         }
 
         if (enableRotating) {
-            JButton rotateClockwiseButton = GuiUtils.createIconButton(
-                    GuiUtils.createIconFromSVG("images/selection-rotate_clockwise.svg"),
-                    "Rotate clockwise");
-            rotateClockwiseButton.addActionListener(event -> {
+            JButton rotateClockwiseButton = GuiUtils.createIconButton(CW_ROTATE_ICON, CW_ROTATE_HINT, event -> {
                 rotateSelectionClockwise(editor);
                 editor.requestFocus();
             });
             toolbar.add(rotateClockwiseButton);
 
-            JButton rotateCounterclockwiseButton = GuiUtils.createIconButton(
-                    GuiUtils.createIconFromSVG("images/selection-rotate_counterclockwise.svg"),
-                    "Rotate counterclockwise");
-            rotateCounterclockwiseButton.addActionListener(event -> {
+            JButton rotateCounterclockwiseButton = GuiUtils.createIconButton(CCW_ROTATE_ICON, CCW_ROTATE_HINT, event -> {
                 rotateSelectionCounterclockwise(editor);
                 editor.requestFocus();
             });
diff --git a/workcraft/WorkcraftCore/src/org/workcraft/gui/tools/SimulationTool.java b/workcraft/WorkcraftCore/src/org/workcraft/gui/tools/SimulationTool.java
index 368257d60..36d24c2c4 100644
--- a/workcraft/WorkcraftCore/src/org/workcraft/gui/tools/SimulationTool.java
+++ b/workcraft/WorkcraftCore/src/org/workcraft/gui/tools/SimulationTool.java
@@ -36,18 +36,18 @@ import java.util.Map;
 
 public abstract class SimulationTool extends AbstractGraphEditorTool implements ClipboardOwner {
 
-    private static final ImageIcon PLAY_ICON = GuiUtils.createIconFromSVG("images/simulation-play.svg");
-    private static final ImageIcon PAUSE_ICON = GuiUtils.createIconFromSVG("images/simulation-pause.svg");
-    private static final ImageIcon BACKWARD_ICON = GuiUtils.createIconFromSVG("images/simulation-backward.svg");
-    private static final ImageIcon FORWARD_ICON = GuiUtils.createIconFromSVG("images/simulation-forward.svg");
-    private static final ImageIcon RECORD_ICON = GuiUtils.createIconFromSVG("images/simulation-record.svg");
-    private static final ImageIcon STOP_ICON = GuiUtils.createIconFromSVG("images/simulation-stop.svg");
-    private static final ImageIcon EJECT_ICON = GuiUtils.createIconFromSVG("images/simulation-eject.svg");
-    private static final ImageIcon TIMING_DIAGRAM_ICON = GuiUtils.createIconFromSVG("images/simulation-trace-graph.svg");
-    private static final ImageIcon COPY_STATE_ICON = GuiUtils.createIconFromSVG("images/simulation-trace-copy.svg");
-    private static final ImageIcon PASTE_STATE_ICON = GuiUtils.createIconFromSVG("images/simulation-trace-paste.svg");
-    private static final ImageIcon MERGE_TRACE_ICON = GuiUtils.createIconFromSVG("images/simulation-trace-merge.svg");
-    private static final ImageIcon SAVE_INITIAL_STATE_ICON = GuiUtils.createIconFromSVG("images/simulation-marking-save.svg");
+    private static final String PLAY_ICON = "images/simulation-play.svg";
+    private static final String PAUSE_ICON = "images/simulation-pause.svg";
+    private static final String BACKWARD_ICON = "images/simulation-backward.svg";
+    private static final String FORWARD_ICON = "images/simulation-forward.svg";
+    private static final String RECORD_ICON = "images/simulation-record.svg";
+    private static final String STOP_ICON = "images/simulation-stop.svg";
+    private static final String EJECT_ICON = "images/simulation-eject.svg";
+    private static final String TIMING_DIAGRAM_ICON = "images/simulation-trace-graph.svg";
+    private static final String COPY_STATE_ICON = "images/simulation-trace-copy.svg";
+    private static final String PASTE_STATE_ICON = "images/simulation-trace-paste.svg";
+    private static final String MERGE_TRACE_ICON = "images/simulation-trace-merge.svg";
+    private static final String SAVE_INITIAL_STATE_ICON = "images/simulation-marking-save.svg";
 
     private static final String PLAY_HINT = "Play through the trace";
     private static final String PAUSE_HINT = "Pause trace playback";
@@ -104,153 +104,125 @@ public abstract class SimulationTool extends AbstractGraphEditorTool implements
             return panel;
         }
 
-        playButton = GuiUtils.createIconButton(PLAY_ICON, PLAY_HINT);
-        backwardButton = GuiUtils.createIconButton(BACKWARD_ICON, BACKWARD_HINT);
-        forwardButton = GuiUtils.createIconButton(FORWARD_ICON, FORWARD_HINT);
-        recordButton = GuiUtils.createIconButton(RECORD_ICON, RECORD_HINT);
-        ejectButton = GuiUtils.createIconButton(EJECT_ICON, EJECT_HINT);
-
-        speedSlider = new SpeedSlider();
-
-        JButton generateGraphButton = GuiUtils.createIconButton(TIMING_DIAGRAM_ICON, TIMING_DIAGRAM_HINT);
-        JButton copyStateButton = GuiUtils.createIconButton(COPY_STATE_ICON, COPY_STATE_HINT);
-        JButton pasteStateButton = GuiUtils.createIconButton(PASTE_STATE_ICON, PASTE_STATE_HINT);
-        JButton mergeTraceButton = GuiUtils.createIconButton(MERGE_TRACE_ICON, MERGE_TRACE_HINT);
-        JButton saveInitStateButton = GuiUtils.createIconButton(SAVE_INITIAL_STATE_ICON, SAVE_INITIAL_STATE_HINT);
-
-        JPanel simulationControl = new JPanel();
-        simulationControl.add(playButton);
-        simulationControl.add(backwardButton);
-        simulationControl.add(forwardButton);
-        simulationControl.add(recordButton);
-        simulationControl.add(ejectButton);
-        GuiUtils.setButtonPanelLayout(simulationControl, playButton.getPreferredSize());
-
-        JPanel speedControl = new JPanel();
-        speedControl.add(speedSlider);
-        GuiUtils.setButtonPanelLayout(speedControl, speedSlider.getPreferredSize());
-
-        JPanel traceControl = new JPanel();
-        if (enableTraceGraph) {
-            traceControl.add(generateGraphButton);
-        }
-        traceControl.add(copyStateButton);
-        traceControl.add(pasteStateButton);
-        traceControl.add(mergeTraceButton);
-        traceControl.add(saveInitStateButton);
-        GuiUtils.setButtonPanelLayout(simulationControl, copyStateButton.getPreferredSize());
-
-        controlPanel = new JPanel();
-        controlPanel.setLayout(new WrapLayout());
-        controlPanel.add(simulationControl);
-        controlPanel.add(speedControl);
-        controlPanel.add(traceControl);
-
-        traceTable = new JTable(new TraceTableModel());
-        traceTable.getTableHeader().setDefaultRenderer(new FlatHeaderRenderer());
-        traceTable.getTableHeader().setReorderingAllowed(false);
-        traceTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
-        traceTable.setRowHeight(SizeHelper.getComponentHeightFromFont(traceTable.getFont()));
-        traceTable.setDefaultRenderer(Object.class, new TraceTableCellRenderer());
-
-        tracePane = new JScrollPane();
-        tracePane.setViewportView(traceTable);
-        tracePane.setMinimumSize(new Dimension(1, 50));
-
-        statePane = new JScrollPane();
-        statePane.setMinimumSize(new Dimension(1, 50));
-
-        splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, tracePane, statePane);
-        splitPane.setOneTouchExpandable(true);
-        splitPane.setResizeWeight(0.5);
-
-        infoPanel = new JPanel();
-        infoPanel.setLayout(new BorderLayout());
-        infoPanel.add(splitPane, BorderLayout.CENTER);
-        speedSlider.addChangeListener(e -> {
-            if (timer != null) {
-                timer.stop();
-                int delay = speedSlider.getDelay();
-                timer.setInitialDelay(delay);
-                timer.setDelay(delay);
-                timer.start();
-            }
-            updateState(editor);
-            editor.requestFocus();
-        });
-
-        recordButton.addActionListener(event -> {
+        playButton = GuiUtils.createIconButton(PLAY_ICON, PLAY_HINT, event -> {
             if (timer == null) {
-                timer = new Timer(speedSlider.getDelay(), event1 -> stepRandom(editor));
+                timer = new Timer(speedSlider.getDelay(), event1 -> stepForward(editor));
                 timer.start();
-                random = true;
-            } else if (random) {
+                random = false;
+            } else if (!random) {
                 timer.stop();
                 timer = null;
                 random = false;
             } else {
-                random = true;
+                random = false;
             }
             updateState(editor);
             editor.requestFocus();
         });
 
-        playButton.addActionListener(event -> {
+        backwardButton = GuiUtils.createIconButton(BACKWARD_ICON, BACKWARD_HINT, event -> {
+            stepBackward(editor);
+            editor.requestFocus();
+        });
+
+        forwardButton = GuiUtils.createIconButton(FORWARD_ICON, FORWARD_HINT, event -> {
+            stepForward(editor);
+            editor.requestFocus();
+        });
+
+        recordButton = GuiUtils.createIconButton(RECORD_ICON, RECORD_HINT, event -> {
             if (timer == null) {
-                timer = new Timer(speedSlider.getDelay(), event1 -> stepForward(editor));
+                timer = new Timer(speedSlider.getDelay(), event1 -> stepRandom(editor));
                 timer.start();
-                random = false;
-            } else if (!random) {
+                random = true;
+            } else if (random) {
                 timer.stop();
                 timer = null;
                 random = false;
             } else {
-                random = false;
+                random = true;
             }
             updateState(editor);
             editor.requestFocus();
         });
 
-        ejectButton.addActionListener(event -> {
+        ejectButton = GuiUtils.createIconButton(EJECT_ICON, EJECT_HINT, event -> {
             clearTraces(editor);
             editor.requestFocus();
         });
 
-        backwardButton.addActionListener(event -> {
-            stepBackward(editor);
-            editor.requestFocus();
-        });
-
-        forwardButton.addActionListener(event -> {
-            stepForward(editor);
+        speedSlider = new SpeedSlider();
+        speedSlider.addChangeListener(e -> {
+            if (timer != null) {
+                timer.stop();
+                int delay = speedSlider.getDelay();
+                timer.setInitialDelay(delay);
+                timer.setDelay(delay);
+                timer.start();
+            }
+            updateState(editor);
             editor.requestFocus();
         });
 
-        generateGraphButton.addActionListener(event -> {
+        JButton generateGraphButton = GuiUtils.createIconButton(TIMING_DIAGRAM_ICON, TIMING_DIAGRAM_HINT, event -> {
             generateTraceGraph(editor);
             editor.requestFocus();
         });
 
-        copyStateButton.addActionListener(event -> {
+        JButton copyStateButton = GuiUtils.createIconButton(COPY_STATE_ICON, COPY_STATE_HINT, event -> {
             copyState(editor);
             editor.requestFocus();
         });
 
-        pasteStateButton.addActionListener(event -> {
+        JButton pasteStateButton = GuiUtils.createIconButton(PASTE_STATE_ICON, PASTE_STATE_HINT, event -> {
             pasteState(editor);
             editor.requestFocus();
         });
 
-        mergeTraceButton.addActionListener(event -> {
+        JButton mergeTraceButton = GuiUtils.createIconButton(MERGE_TRACE_ICON, MERGE_TRACE_HINT, event -> {
             mergeTrace(editor);
             editor.requestFocus();
         });
 
-        saveInitStateButton.addActionListener(event -> {
+        JButton saveInitStateButton = GuiUtils.createIconButton(SAVE_INITIAL_STATE_ICON, SAVE_INITIAL_STATE_HINT, event -> {
             savedState = readUnderlyingModelState();
             editor.requestFocus();
         });
 
+        JPanel simulationControl = new JPanel();
+        simulationControl.add(playButton);
+        simulationControl.add(backwardButton);
+        simulationControl.add(forwardButton);
+        simulationControl.add(recordButton);
+        simulationControl.add(ejectButton);
+        GuiUtils.setButtonPanelLayout(simulationControl, playButton.getPreferredSize());
+
+        JPanel speedControl = new JPanel();
+        speedControl.add(speedSlider);
+        GuiUtils.setButtonPanelLayout(speedControl, speedSlider.getPreferredSize());
+
+        JPanel traceControl = new JPanel();
+        if (enableTraceGraph) {
+            traceControl.add(generateGraphButton);
+        }
+        traceControl.add(copyStateButton);
+        traceControl.add(pasteStateButton);
+        traceControl.add(mergeTraceButton);
+        traceControl.add(saveInitStateButton);
+        GuiUtils.setButtonPanelLayout(simulationControl, copyStateButton.getPreferredSize());
+
+        controlPanel = new JPanel();
+        controlPanel.setLayout(new WrapLayout());
+        controlPanel.add(simulationControl);
+        controlPanel.add(speedControl);
+        controlPanel.add(traceControl);
+
+        traceTable = new JTable(new TraceTableModel());
+        traceTable.getTableHeader().setDefaultRenderer(new FlatHeaderRenderer());
+        traceTable.getTableHeader().setReorderingAllowed(false);
+        traceTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+        traceTable.setRowHeight(SizeHelper.getComponentHeightFromFont(traceTable.getFont()));
+        traceTable.setDefaultRenderer(Object.class, new TraceTableCellRenderer());
         traceTable.addMouseListener(new MouseAdapter() {
             @Override
             public void mouseClicked(MouseEvent e) {
@@ -285,6 +257,21 @@ public abstract class SimulationTool extends AbstractGraphEditorTool implements
             }
         });
 
+        tracePane = new JScrollPane();
+        tracePane.setViewportView(traceTable);
+        tracePane.setMinimumSize(new Dimension(1, 50));
+
+        statePane = new JScrollPane();
+        statePane.setMinimumSize(new Dimension(1, 50));
+
+        splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, tracePane, statePane);
+        splitPane.setOneTouchExpandable(true);
+        splitPane.setResizeWeight(0.5);
+
+        infoPanel = new JPanel();
+        infoPanel.setLayout(new BorderLayout());
+        infoPanel.add(splitPane, BorderLayout.CENTER);
+
         panel = new JPanel();
         panel.setLayout(new BorderLayout());
         panel.add(controlPanel, BorderLayout.NORTH);
@@ -349,26 +336,26 @@ public abstract class SimulationTool extends AbstractGraphEditorTool implements
 
     public void updateState(final GraphEditor editor) {
         if (timer == null) {
-            playButton.setIcon(PLAY_ICON);
+            playButton.setIcon(GuiUtils.createIconFromSVG(PLAY_ICON));
             playButton.setToolTipText(PLAY_HINT);
-            recordButton.setIcon(RECORD_ICON);
+            recordButton.setIcon(GuiUtils.createIconFromSVG(RECORD_ICON));
             recordButton.setToolTipText(RECORD_HINT);
         } else {
             if (random) {
-                playButton.setIcon(PLAY_ICON);
+                playButton.setIcon(GuiUtils.createIconFromSVG(PLAY_ICON));
                 playButton.setToolTipText(PLAY_HINT);
-                recordButton.setIcon(STOP_ICON);
+                recordButton.setIcon(GuiUtils.createIconFromSVG(STOP_ICON));
                 recordButton.setToolTipText(STOP_HINT);
                 timer.setDelay(speedSlider.getDelay());
             } else if (branchTrace.canProgress() || (branchTrace.isEmpty() && mainTrace.canProgress())) {
-                playButton.setIcon(PAUSE_ICON);
+                playButton.setIcon(GuiUtils.createIconFromSVG(PAUSE_ICON));
                 playButton.setToolTipText(PAUSE_HINT);
-                recordButton.setIcon(RECORD_ICON);
+                recordButton.setIcon(GuiUtils.createIconFromSVG(RECORD_ICON));
                 timer.setDelay(speedSlider.getDelay());
             } else {
-                playButton.setIcon(PLAY_ICON);
+                playButton.setIcon(GuiUtils.createIconFromSVG(PLAY_ICON));
                 playButton.setToolTipText(PLAY_HINT);
-                recordButton.setIcon(RECORD_ICON);
+                recordButton.setIcon(GuiUtils.createIconFromSVG(RECORD_ICON));
                 recordButton.setToolTipText(RECORD_HINT);
                 timer.stop();
                 timer = null;
diff --git a/workcraft/WorkcraftCore/src/org/workcraft/utils/GuiUtils.java b/workcraft/WorkcraftCore/src/org/workcraft/utils/GuiUtils.java
index 1dd8a9c6c..a601555d6 100644
--- a/workcraft/WorkcraftCore/src/org/workcraft/utils/GuiUtils.java
+++ b/workcraft/WorkcraftCore/src/org/workcraft/utils/GuiUtils.java
@@ -81,16 +81,7 @@ public class GuiUtils {
         return ImageIO.read(res);
     }
 
-    public static ImageIcon createIconFromImage(String path) {
-        URL res = ClassLoader.getSystemResource(path);
-        if (res == null) {
-            System.err.println("Missing icon: " + path);
-            return null;
-        }
-        return new ImageIcon(res);
-    }
-
-    public static ImageIcon createIconFromSVG(String path, int width, int height, Color background) {
+    private static ImageIcon createIconFromSVG(String path, int width, int height, Color background) {
         try {
             System.setProperty("org.apache.batik.warn_destination", "false");
             Document document;
@@ -139,23 +130,14 @@ public class GuiUtils {
         }
     }
 
-    public static ImageIcon createIconFromSVG(String path) {
+    public static ImageIcon createIconFromSVG(String svgPath) {
         int iconSize = SizeHelper.getToolIconSize();
-        return createIconFromSVG(path, iconSize, iconSize);
-    }
-
-    public static ImageIcon createIconFromSVG(String path, int width, int height) {
-        return createIconFromSVG(path, width, height, null);
-    }
-
-    public static Cursor createCursorFromImage(String path) {
-        ImageIcon icon = createIconFromImage(path);
-        return createCursorFromIcon(icon, path);
+        return createIconFromSVG(svgPath, iconSize, iconSize, null);
     }
 
-    public static Cursor createCursorFromSVG(String path) {
-        ImageIcon icon = createIconFromSVG(path);
-        return createCursorFromIcon(icon, path);
+    public static Cursor createCursorFromSVG(String svgPath) {
+        ImageIcon icon = createIconFromSVG(svgPath);
+        return createCursorFromIcon(icon, svgPath);
     }
 
     public static Cursor createCursorFromIcon(ImageIcon icon, String name) {
@@ -181,7 +163,8 @@ public class GuiUtils {
         return toolkit.createCustomCursor(cursorImage, hotSpot, name);
     }
 
-    public static JButton createIconButton(Icon icon, String toolTip, ActionListener action) {
+    public static JButton createIconButton(String svgPath, String toolTip, ActionListener action) {
+        ImageIcon icon = createIconFromSVG(svgPath);
         JButton button = createIconButton(icon, toolTip);
         button.addActionListener(action);
         return button;