Theme Editor:

- fixed missing icon on "open" button (regression in commit 35fa3197c8)
- added icons to "File" menu for add and save actions
This commit is contained in:
Karl Tauber
2023-08-05 19:18:51 +02:00
parent c395386c05
commit 270e998e86
3 changed files with 10 additions and 0 deletions

View File

@@ -1052,6 +1052,7 @@ class FlatThemeFileEditor
newPropertiesFileMenuItem.setText("New Properties File..."); newPropertiesFileMenuItem.setText("New Properties File...");
newPropertiesFileMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); newPropertiesFileMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
newPropertiesFileMenuItem.setMnemonic('N'); newPropertiesFileMenuItem.setMnemonic('N');
newPropertiesFileMenuItem.setIcon(new FlatSVGIcon("com/formdev/flatlaf/themeeditor/icons/add.svg"));
newPropertiesFileMenuItem.addActionListener(e -> newPropertiesFile()); newPropertiesFileMenuItem.addActionListener(e -> newPropertiesFile());
fileMenu.add(newPropertiesFileMenuItem); fileMenu.add(newPropertiesFileMenuItem);
@@ -1059,6 +1060,7 @@ class FlatThemeFileEditor
saveAllMenuItem.setText("Save All"); saveAllMenuItem.setText("Save All");
saveAllMenuItem.setMnemonic('S'); saveAllMenuItem.setMnemonic('S');
saveAllMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); 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()); saveAllMenuItem.addActionListener(e -> saveAll());
fileMenu.add(saveAllMenuItem); fileMenu.add(saveAllMenuItem);
fileMenu.addSeparator(); fileMenu.addSeparator();
@@ -1230,6 +1232,7 @@ class FlatThemeFileEditor
//---- openDirectoryButton ---- //---- openDirectoryButton ----
openDirectoryButton.setFocusable(false); openDirectoryButton.setFocusable(false);
openDirectoryButton.setIcon(new FlatSVGIcon("com/formdev/flatlaf/themeeditor/icons/menu-open.svg"));
openDirectoryButton.addActionListener(e -> openDirectory()); openDirectoryButton.addActionListener(e -> openDirectory());
controlPanel.add(openDirectoryButton, "cell 2 0"); controlPanel.add(openDirectoryButton, "cell 2 0");
} }

View File

@@ -40,6 +40,7 @@ new FormModel {
add( new FormComponent( "javax.swing.JButton" ) { add( new FormComponent( "javax.swing.JButton" ) {
name: "openDirectoryButton" name: "openDirectoryButton"
"focusable": false "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 ) ) addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "openDirectory", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 0" "value": "cell 2 0"
@@ -73,6 +74,7 @@ new FormModel {
"text": "New Properties File..." "text": "New Properties File..."
"accelerator": static javax.swing.KeyStroke getKeyStroke( 78, 4356, false ) "accelerator": static javax.swing.KeyStroke getKeyStroke( 78, 4356, false )
"mnemonic": 78 "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 ) ) addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "newPropertiesFile", false ) )
} ) } )
add( new FormComponent( "javax.swing.JMenuItem" ) { add( new FormComponent( "javax.swing.JMenuItem" ) {
@@ -80,6 +82,7 @@ new FormModel {
"text": "Save All" "text": "Save All"
"mnemonic": 83 "mnemonic": 83
"accelerator": static javax.swing.KeyStroke getKeyStroke( 83, 4226, false ) "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 ) ) addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "saveAll", false ) )
} ) } )
add( new FormComponent( "javax.swing.JPopupMenu$Separator" ) { add( new FormComponent( "javax.swing.JPopupMenu$Separator" ) {

View File

@@ -0,0 +1,4 @@
<!-- Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -->
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<path fill="#6E6E6E" fill-rule="evenodd" d="M11,14 L11,11 L5,11 L5,14 L2,14 L2,2 L14,2 L14,14 L11,14 Z M4,4 L4,8 L12,8 L12,4 L4,4 Z M6,12 L10,12 L10,14 L6,14 L6,12 Z"/>
</svg>

After

Width:  |  Height:  |  Size: 409 B