From 270e998e8645ddbe05f3225d3fd338c05dfdc2bf Mon Sep 17 00:00:00 2001 From: Karl Tauber Date: Sat, 5 Aug 2023 19:18:51 +0200 Subject: [PATCH] Theme Editor: - fixed missing icon on "open" button (regression in commit 35fa3197c886db85214365c08dad5b957a4517cf) - added icons to "File" menu for add and save actions --- .../com/formdev/flatlaf/themeeditor/FlatThemeFileEditor.java | 3 +++ .../com/formdev/flatlaf/themeeditor/FlatThemeFileEditor.jfd | 3 +++ .../com/formdev/flatlaf/themeeditor/icons/menu-saveall.svg | 4 ++++ 3 files changed, 10 insertions(+) create mode 100644 flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/icons/menu-saveall.svg diff --git a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemeFileEditor.java b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemeFileEditor.java index 9fdf8a98..434d4de8 100644 --- a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemeFileEditor.java +++ b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemeFileEditor.java @@ -1052,6 +1052,7 @@ class FlatThemeFileEditor newPropertiesFileMenuItem.setText("New Properties File..."); newPropertiesFileMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); newPropertiesFileMenuItem.setMnemonic('N'); + newPropertiesFileMenuItem.setIcon(new FlatSVGIcon("com/formdev/flatlaf/themeeditor/icons/add.svg")); newPropertiesFileMenuItem.addActionListener(e -> newPropertiesFile()); fileMenu.add(newPropertiesFileMenuItem); @@ -1059,6 +1060,7 @@ class FlatThemeFileEditor saveAllMenuItem.setText("Save All"); saveAllMenuItem.setMnemonic('S'); saveAllMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); + saveAllMenuItem.setIcon(new FlatSVGIcon("com/formdev/flatlaf/themeeditor/icons/menu-saveall.svg")); saveAllMenuItem.addActionListener(e -> saveAll()); fileMenu.add(saveAllMenuItem); fileMenu.addSeparator(); @@ -1230,6 +1232,7 @@ class FlatThemeFileEditor //---- openDirectoryButton ---- openDirectoryButton.setFocusable(false); + openDirectoryButton.setIcon(new FlatSVGIcon("com/formdev/flatlaf/themeeditor/icons/menu-open.svg")); openDirectoryButton.addActionListener(e -> openDirectory()); controlPanel.add(openDirectoryButton, "cell 2 0"); } diff --git a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemeFileEditor.jfd b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemeFileEditor.jfd index 23e6f475..19666bf6 100644 --- a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemeFileEditor.jfd +++ b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemeFileEditor.jfd @@ -40,6 +40,7 @@ new FormModel { add( new FormComponent( "javax.swing.JButton" ) { name: "openDirectoryButton" "focusable": false + "icon": new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/themeeditor/icons/menu-open.svg" ) addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "openDirectory", false ) ) }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 2 0" @@ -73,6 +74,7 @@ new FormModel { "text": "New Properties File..." "accelerator": static javax.swing.KeyStroke getKeyStroke( 78, 4356, false ) "mnemonic": 78 + "icon": new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/themeeditor/icons/add.svg" ) addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "newPropertiesFile", false ) ) } ) add( new FormComponent( "javax.swing.JMenuItem" ) { @@ -80,6 +82,7 @@ new FormModel { "text": "Save All" "mnemonic": 83 "accelerator": static javax.swing.KeyStroke getKeyStroke( 83, 4226, false ) + "icon": new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/themeeditor/icons/menu-saveall.svg" ) addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "saveAll", false ) ) } ) add( new FormComponent( "javax.swing.JPopupMenu$Separator" ) { diff --git a/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/icons/menu-saveall.svg b/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/icons/menu-saveall.svg new file mode 100644 index 00000000..23905d0b --- /dev/null +++ b/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/icons/menu-saveall.svg @@ -0,0 +1,4 @@ + + + +