From 35fa3197c886db85214365c08dad5b957a4517cf Mon Sep 17 00:00:00 2001 From: Karl Tauber Date: Fri, 4 Aug 2023 12:08:04 +0200 Subject: [PATCH] Demo: moved SVG icons to JFormDesigner forms --- .../com/formdev/flatlaf/demo/DemoFrame.java | 30 +++++++++---------- .../com/formdev/flatlaf/demo/DemoFrame.jfd | 14 ++++++++- .../demo/intellijthemes/IJThemesPanel.java | 4 +-- .../demo/intellijthemes/IJThemesPanel.jfd | 4 ++- .../themeeditor/FlatFindReplaceBar.java | 12 ++++---- .../themeeditor/FlatFindReplaceBar.jfd | 7 ++++- .../themeeditor/FlatThemeFileEditor.java | 2 +- .../themeeditor/FlatThemeFileEditor.jfd | 3 +- 8 files changed, 47 insertions(+), 29 deletions(-) diff --git a/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/DemoFrame.java b/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/DemoFrame.java index fde38fc5..bfedf7a5 100644 --- a/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/DemoFrame.java +++ b/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/DemoFrame.java @@ -591,6 +591,7 @@ class DemoFrame undoMenuItem.setText("Undo"); undoMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Z, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); undoMenuItem.setMnemonic('U'); + undoMenuItem.setIcon(new FlatSVGIcon("com/formdev/flatlaf/demo/icons/undo.svg")); undoMenuItem.addActionListener(e -> menuItemActionPerformed(e)); editMenu.add(undoMenuItem); @@ -598,6 +599,7 @@ class DemoFrame redoMenuItem.setText("Redo"); redoMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Y, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); redoMenuItem.setMnemonic('R'); + redoMenuItem.setIcon(new FlatSVGIcon("com/formdev/flatlaf/demo/icons/redo.svg")); redoMenuItem.addActionListener(e -> menuItemActionPerformed(e)); editMenu.add(redoMenuItem); editMenu.addSeparator(); @@ -606,18 +608,21 @@ class DemoFrame cutMenuItem.setText("Cut"); cutMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); cutMenuItem.setMnemonic('C'); + cutMenuItem.setIcon(new FlatSVGIcon("com/formdev/flatlaf/demo/icons/menu-cut.svg")); editMenu.add(cutMenuItem); //---- copyMenuItem ---- copyMenuItem.setText("Copy"); copyMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); copyMenuItem.setMnemonic('O'); + copyMenuItem.setIcon(new FlatSVGIcon("com/formdev/flatlaf/demo/icons/copy.svg")); editMenu.add(copyMenuItem); //---- pasteMenuItem ---- pasteMenuItem.setText("Paste"); pasteMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); pasteMenuItem.setMnemonic('P'); + pasteMenuItem.setIcon(new FlatSVGIcon("com/formdev/flatlaf/demo/icons/menu-paste.svg")); editMenu.add(pasteMenuItem); editMenu.addSeparator(); @@ -827,34 +832,41 @@ class DemoFrame //---- backButton ---- backButton.setToolTipText("Back"); + backButton.setIcon(new FlatSVGIcon("com/formdev/flatlaf/demo/icons/back.svg")); toolBar.add(backButton); //---- forwardButton ---- forwardButton.setToolTipText("Forward"); + forwardButton.setIcon(new FlatSVGIcon("com/formdev/flatlaf/demo/icons/forward.svg")); toolBar.add(forwardButton); toolBar.addSeparator(); //---- cutButton ---- cutButton.setToolTipText("Cut"); + cutButton.setIcon(new FlatSVGIcon("com/formdev/flatlaf/demo/icons/menu-cut.svg")); toolBar.add(cutButton); //---- copyButton ---- copyButton.setToolTipText("Copy"); + copyButton.setIcon(new FlatSVGIcon("com/formdev/flatlaf/demo/icons/copy.svg")); toolBar.add(copyButton); //---- pasteButton ---- pasteButton.setToolTipText("Paste"); + pasteButton.setIcon(new FlatSVGIcon("com/formdev/flatlaf/demo/icons/menu-paste.svg")); toolBar.add(pasteButton); toolBar.addSeparator(); //---- refreshButton ---- refreshButton.setToolTipText("Refresh"); + refreshButton.setIcon(new FlatSVGIcon("com/formdev/flatlaf/demo/icons/refresh.svg")); toolBar.add(refreshButton); toolBar.addSeparator(); //---- showToggleButton ---- showToggleButton.setSelected(true); showToggleButton.setToolTipText("Show Details"); + showToggleButton.setIcon(new FlatSVGIcon("com/formdev/flatlaf/demo/icons/show.svg")); toolBar.add(showToggleButton); } contentPane.add(toolBar, BorderLayout.NORTH); @@ -901,21 +913,6 @@ class DemoFrame menuBar1.add( Box.createGlue() ); menuBar1.add( usersButton ); - undoMenuItem.setIcon( new FlatSVGIcon( "com/formdev/flatlaf/demo/icons/undo.svg" ) ); - redoMenuItem.setIcon( new FlatSVGIcon( "com/formdev/flatlaf/demo/icons/redo.svg" ) ); - - cutMenuItem.setIcon( new FlatSVGIcon( "com/formdev/flatlaf/demo/icons/menu-cut.svg" ) ); - copyMenuItem.setIcon( new FlatSVGIcon( "com/formdev/flatlaf/demo/icons/copy.svg" ) ); - pasteMenuItem.setIcon( new FlatSVGIcon( "com/formdev/flatlaf/demo/icons/menu-paste.svg" ) ); - - backButton.setIcon( new FlatSVGIcon( "com/formdev/flatlaf/demo/icons/back.svg" ) ); - forwardButton.setIcon( new FlatSVGIcon( "com/formdev/flatlaf/demo/icons/forward.svg" ) ); - cutButton.setIcon( new FlatSVGIcon( "com/formdev/flatlaf/demo/icons/menu-cut.svg" ) ); - copyButton.setIcon( new FlatSVGIcon( "com/formdev/flatlaf/demo/icons/copy.svg" ) ); - pasteButton.setIcon( new FlatSVGIcon( "com/formdev/flatlaf/demo/icons/menu-paste.svg" ) ); - refreshButton.setIcon( new FlatSVGIcon( "com/formdev/flatlaf/demo/icons/refresh.svg" ) ); - showToggleButton.setIcon( new FlatSVGIcon( "com/formdev/flatlaf/demo/icons/show.svg" ) ); - cutMenuItem.addActionListener( new DefaultEditorKit.CutAction() ); copyMenuItem.addActionListener( new DefaultEditorKit.CopyAction() ); pasteMenuItem.addActionListener( new DefaultEditorKit.PasteAction() ); @@ -950,6 +947,9 @@ class DemoFrame if( SystemInfo.isMacOS ) unsupported( underlineMenuSelectionMenuItem ); + if( "false".equals( System.getProperty( "flatlaf.animatedLafChange" ) ) ) + animatedLafChangeMenuItem.setSelected( false ); + // remove contentPanel bottom insets MigLayout layout = (MigLayout) contentPanel.getLayout(); LC lc = ConstraintParser.parseLayoutConstraint( (String) layout.getLayoutConstraints() ); diff --git a/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/DemoFrame.jfd b/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/DemoFrame.jfd index f561a71a..ba3f2d4f 100644 --- a/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/DemoFrame.jfd +++ b/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/DemoFrame.jfd @@ -1,4 +1,4 @@ -JFDML JFormDesigner: "7.0.4.0.360" Java: "17" encoding: "UTF-8" +JFDML JFormDesigner: "8.1.0.0.283" Java: "19.0.2" encoding: "UTF-8" new FormModel { contentType: "form/swing" @@ -21,10 +21,12 @@ new FormModel { add( new FormComponent( "javax.swing.JButton" ) { name: "backButton" "toolTipText": "Back" + "icon": new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/demo/icons/back.svg" ) } ) add( new FormComponent( "javax.swing.JButton" ) { name: "forwardButton" "toolTipText": "Forward" + "icon": new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/demo/icons/forward.svg" ) } ) add( new FormComponent( "javax.swing.JToolBar$Separator" ) { name: "separator5" @@ -32,14 +34,17 @@ new FormModel { add( new FormComponent( "javax.swing.JButton" ) { name: "cutButton" "toolTipText": "Cut" + "icon": new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/demo/icons/menu-cut.svg" ) } ) add( new FormComponent( "javax.swing.JButton" ) { name: "copyButton" "toolTipText": "Copy" + "icon": new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/demo/icons/copy.svg" ) } ) add( new FormComponent( "javax.swing.JButton" ) { name: "pasteButton" "toolTipText": "Paste" + "icon": new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/demo/icons/menu-paste.svg" ) } ) add( new FormComponent( "javax.swing.JToolBar$Separator" ) { name: "separator6" @@ -47,6 +52,7 @@ new FormModel { add( new FormComponent( "javax.swing.JButton" ) { name: "refreshButton" "toolTipText": "Refresh" + "icon": new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/demo/icons/refresh.svg" ) } ) add( new FormComponent( "javax.swing.JToolBar$Separator" ) { name: "separator7" @@ -55,6 +61,7 @@ new FormModel { name: "showToggleButton" "selected": true "toolTipText": "Show Details" + "icon": new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/demo/icons/show.svg" ) } ) }, new FormLayoutConstraints( class java.lang.String ) { "value": "North" @@ -185,6 +192,7 @@ new FormModel { "text": "Undo" "accelerator": static javax.swing.KeyStroke getKeyStroke( 90, 4226, false ) "mnemonic": 85 + "icon": new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/demo/icons/undo.svg" ) addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "menuItemActionPerformed", true ) ) } ) add( new FormComponent( "javax.swing.JMenuItem" ) { @@ -192,6 +200,7 @@ new FormModel { "text": "Redo" "accelerator": static javax.swing.KeyStroke getKeyStroke( 89, 4226, false ) "mnemonic": 82 + "icon": new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/demo/icons/redo.svg" ) addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "menuItemActionPerformed", true ) ) } ) add( new FormComponent( "javax.swing.JPopupMenu$Separator" ) { @@ -202,18 +211,21 @@ new FormModel { "text": "Cut" "accelerator": static javax.swing.KeyStroke getKeyStroke( 88, 4226, false ) "mnemonic": 67 + "icon": new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/demo/icons/menu-cut.svg" ) } ) add( new FormComponent( "javax.swing.JMenuItem" ) { name: "copyMenuItem" "text": "Copy" "accelerator": static javax.swing.KeyStroke getKeyStroke( 67, 4226, false ) "mnemonic": 79 + "icon": new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/demo/icons/copy.svg" ) } ) add( new FormComponent( "javax.swing.JMenuItem" ) { name: "pasteMenuItem" "text": "Paste" "accelerator": static javax.swing.KeyStroke getKeyStroke( 86, 4226, false ) "mnemonic": 80 + "icon": new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/demo/icons/menu-paste.svg" ) } ) add( new FormComponent( "javax.swing.JPopupMenu$Separator" ) { name: "separator3" diff --git a/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/intellijthemes/IJThemesPanel.java b/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/intellijthemes/IJThemesPanel.java index 4e6cf41f..a8603da4 100644 --- a/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/intellijthemes/IJThemesPanel.java +++ b/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/intellijthemes/IJThemesPanel.java @@ -88,8 +88,6 @@ public class IJThemesPanel saveButton.setEnabled( false ); sourceCodeButton.setEnabled( false ); - saveButton.setIcon( new FlatSVGIcon( "com/formdev/flatlaf/demo/icons/download.svg" ) ); - sourceCodeButton.setIcon( new FlatSVGIcon( "com/formdev/flatlaf/demo/icons/github.svg" ) ); // create renderer themesList.setCellRenderer( new DefaultListCellRenderer() { @@ -491,11 +489,13 @@ public class IJThemesPanel //---- saveButton ---- saveButton.setToolTipText("Save .theme.json of selected IntelliJ theme to file."); + saveButton.setIcon(new FlatSVGIcon("com/formdev/flatlaf/demo/icons/download.svg")); saveButton.addActionListener(e -> saveTheme()); toolBar.add(saveButton); //---- sourceCodeButton ---- sourceCodeButton.setToolTipText("Opens the source code repository of selected IntelliJ theme in the browser."); + sourceCodeButton.setIcon(new FlatSVGIcon("com/formdev/flatlaf/demo/icons/github.svg")); sourceCodeButton.addActionListener(e -> browseSourceCode()); toolBar.add(sourceCodeButton); } diff --git a/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/intellijthemes/IJThemesPanel.jfd b/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/intellijthemes/IJThemesPanel.jfd index 8674fb70..efa7f335 100644 --- a/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/intellijthemes/IJThemesPanel.jfd +++ b/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/intellijthemes/IJThemesPanel.jfd @@ -1,4 +1,4 @@ -JFDML JFormDesigner: "7.0.2.0.298" Java: "14" encoding: "UTF-8" +JFDML JFormDesigner: "8.1.0.0.283" Java: "19.0.2" encoding: "UTF-8" new FormModel { contentType: "form/swing" @@ -24,11 +24,13 @@ new FormModel { add( new FormComponent( "javax.swing.JButton" ) { name: "saveButton" "toolTipText": "Save .theme.json of selected IntelliJ theme to file." + "icon": new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/demo/icons/download.svg" ) addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "saveTheme", false ) ) } ) add( new FormComponent( "javax.swing.JButton" ) { name: "sourceCodeButton" "toolTipText": "Opens the source code repository of selected IntelliJ theme in the browser." + "icon": new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/demo/icons/github.svg" ) addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "browseSourceCode", false ) ) } ) }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { diff --git a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatFindReplaceBar.java b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatFindReplaceBar.java index fb16f07a..e44e8ffd 100644 --- a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatFindReplaceBar.java +++ b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatFindReplaceBar.java @@ -70,13 +70,6 @@ class FlatFindReplaceBar actionMap.put( "editorPageUp", new ConsumerAction( e -> notifyEditorAction( "page-up" ) ) ); actionMap.put( "editorPageDown", new ConsumerAction( e -> notifyEditorAction( "page-down" ) ) ); - findPreviousButton.setIcon( new FlatSVGIcon( "com/formdev/flatlaf/themeeditor/icons/findAndShowPrevMatches.svg" ) ); - findNextButton.setIcon( new FlatSVGIcon( "com/formdev/flatlaf/themeeditor/icons/findAndShowNextMatches.svg" ) ); - matchCaseToggleButton.setIcon( new FlatSVGIcon( "com/formdev/flatlaf/themeeditor/icons/matchCase.svg" ) ); - matchWholeWordToggleButton.setIcon( new FlatSVGIcon( "com/formdev/flatlaf/themeeditor/icons/words.svg" ) ); - regexToggleButton.setIcon( new FlatSVGIcon( "com/formdev/flatlaf/themeeditor/icons/regex.svg" ) ); - closeButton.setIcon( new FlatSVGIcon( "com/formdev/flatlaf/themeeditor/icons/close.svg" ) ); - registerKeyboardAction( e -> close(), KeyStroke.getKeyStroke( KeyEvent.VK_ESCAPE, 0, false ), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT ); @@ -335,27 +328,32 @@ class FlatFindReplaceBar //---- findPreviousButton ---- findPreviousButton.setToolTipText("Previous Occurrence"); + findPreviousButton.setIcon(new FlatSVGIcon("com/formdev/flatlaf/themeeditor/icons/findAndShowPrevMatches.svg")); findPreviousButton.addActionListener(e -> findPrevious()); findToolBar.add(findPreviousButton); //---- findNextButton ---- findNextButton.setToolTipText("Next Occurrence"); + findNextButton.setIcon(new FlatSVGIcon("com/formdev/flatlaf/themeeditor/icons/findAndShowNextMatches.svg")); findNextButton.addActionListener(e -> findNext()); findToolBar.add(findNextButton); findToolBar.addSeparator(); //---- matchCaseToggleButton ---- matchCaseToggleButton.setToolTipText("Match Case"); + matchCaseToggleButton.setIcon(new FlatSVGIcon("com/formdev/flatlaf/themeeditor/icons/matchCase.svg")); matchCaseToggleButton.addActionListener(e -> matchCaseChanged()); findToolBar.add(matchCaseToggleButton); //---- matchWholeWordToggleButton ---- matchWholeWordToggleButton.setToolTipText("Match Whole Word"); + matchWholeWordToggleButton.setIcon(new FlatSVGIcon("com/formdev/flatlaf/themeeditor/icons/words.svg")); matchWholeWordToggleButton.addActionListener(e -> matchWholeWordChanged()); findToolBar.add(matchWholeWordToggleButton); //---- regexToggleButton ---- regexToggleButton.setToolTipText("Regex"); + regexToggleButton.setIcon(new FlatSVGIcon("com/formdev/flatlaf/themeeditor/icons/regex.svg")); regexToggleButton.addActionListener(e -> regexChanged()); findToolBar.add(regexToggleButton); } diff --git a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatFindReplaceBar.jfd b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatFindReplaceBar.jfd index 4f1c399b..728367c1 100644 --- a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatFindReplaceBar.jfd +++ b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatFindReplaceBar.jfd @@ -1,4 +1,4 @@ -JFDML JFormDesigner: "7.0.4.0.360" Java: "16" encoding: "UTF-8" +JFDML JFormDesigner: "8.1.0.0.283" Java: "19.0.2" encoding: "UTF-8" new FormModel { contentType: "form/swing" @@ -34,11 +34,13 @@ new FormModel { add( new FormComponent( "javax.swing.JButton" ) { name: "findPreviousButton" "toolTipText": "Previous Occurrence" + "icon": new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/themeeditor/icons/findAndShowPrevMatches.svg" ) addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "findPrevious", false ) ) } ) add( new FormComponent( "javax.swing.JButton" ) { name: "findNextButton" "toolTipText": "Next Occurrence" + "icon": new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/themeeditor/icons/findAndShowNextMatches.svg" ) addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "findNext", false ) ) } ) add( new FormComponent( "javax.swing.JToolBar$Separator" ) { @@ -47,16 +49,19 @@ new FormModel { add( new FormComponent( "javax.swing.JToggleButton" ) { name: "matchCaseToggleButton" "toolTipText": "Match Case" + "icon": new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/themeeditor/icons/matchCase.svg" ) addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "matchCaseChanged", false ) ) } ) add( new FormComponent( "javax.swing.JToggleButton" ) { name: "matchWholeWordToggleButton" "toolTipText": "Match Whole Word" + "icon": new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/themeeditor/icons/words.svg" ) addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "matchWholeWordChanged", false ) ) } ) add( new FormComponent( "javax.swing.JToggleButton" ) { name: "regexToggleButton" "toolTipText": "Regex" + "icon": new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/themeeditor/icons/regex.svg" ) addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "regexChanged", false ) ) } ) }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { 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 c2535f69..9fdf8a98 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 @@ -140,7 +140,6 @@ class FlatThemeFileEditor directoryField.setRenderer( new DirectoryRenderer( directoryField ) ); - openDirectoryButton.setIcon( new FlatSVGIcon( "com/formdev/flatlaf/themeeditor/icons/menu-open.svg" ) ); if( UIManager.getLookAndFeel() instanceof FlatDarkLaf ) darkLafMenuItem.setSelected( true ); @@ -1045,6 +1044,7 @@ class FlatThemeFileEditor openDirectoryMenuItem.setText("Open Directory..."); openDirectoryMenuItem.setMnemonic('O'); openDirectoryMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); + openDirectoryMenuItem.setIcon(new FlatSVGIcon("com/formdev/flatlaf/themeeditor/icons/menu-open.svg")); openDirectoryMenuItem.addActionListener(e -> openDirectory()); fileMenu.add(openDirectoryMenuItem); 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 3eb1808b..23e6f475 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 @@ -1,4 +1,4 @@ -JFDML JFormDesigner: "7.0.5.0.382" Java: "16" encoding: "UTF-8" +JFDML JFormDesigner: "8.1.0.0.283" Java: "19.0.2" encoding: "UTF-8" new FormModel { contentType: "form/swing" @@ -65,6 +65,7 @@ new FormModel { "text": "Open Directory..." "mnemonic": 79 "accelerator": static javax.swing.KeyStroke getKeyStroke( 79, 4226, 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 ) ) } ) add( new FormComponent( "javax.swing.JMenuItem" ) {