Demo: added "Options > Smooth Scrolling" to menu (issue #50)

This commit is contained in:
Karl Tauber
2020-07-25 13:36:42 +02:00
parent b67b701d1e
commit 82514ccbfc
2 changed files with 21 additions and 0 deletions

View File

@@ -266,6 +266,10 @@ class DemoFrame
repaint();
}
private void smoothScrollingChanged() {
UIManager.put( "ScrollPane.smoothScrolling", smoothScrollingMenuItem.isSelected() );
}
private void animatedLafChangeChanged() {
System.setProperty( "flatlaf.animatedLafChange", String.valueOf( animatedLafChangeMenuItem.isSelected() ) );
}
@@ -505,6 +509,7 @@ class DemoFrame
showTitleBarIconMenuItem = new JCheckBoxMenuItem();
underlineMenuSelectionMenuItem = new JCheckBoxMenuItem();
alwaysShowMnemonicsMenuItem = new JCheckBoxMenuItem();
smoothScrollingMenuItem = new JCheckBoxMenuItem();
animatedLafChangeMenuItem = new JCheckBoxMenuItem();
JMenuItem showHintsMenuItem = new JMenuItem();
JMenuItem showUIDefaultsInspectorMenuItem = new JMenuItem();
@@ -793,6 +798,12 @@ class DemoFrame
alwaysShowMnemonicsMenuItem.addActionListener(e -> alwaysShowMnemonics());
optionsMenu.add(alwaysShowMnemonicsMenuItem);
//---- smoothScrollingMenuItem ----
smoothScrollingMenuItem.setText("Smooth Scrolling");
smoothScrollingMenuItem.setSelected(true);
smoothScrollingMenuItem.addActionListener(e -> smoothScrollingChanged());
optionsMenu.add(smoothScrollingMenuItem);
//---- animatedLafChangeMenuItem ----
animatedLafChangeMenuItem.setText("Animated Laf Change");
animatedLafChangeMenuItem.setSelected(true);
@@ -981,6 +992,7 @@ class DemoFrame
private JCheckBoxMenuItem showTitleBarIconMenuItem;
private JCheckBoxMenuItem underlineMenuSelectionMenuItem;
private JCheckBoxMenuItem alwaysShowMnemonicsMenuItem;
private JCheckBoxMenuItem smoothScrollingMenuItem;
private JCheckBoxMenuItem animatedLafChangeMenuItem;
private JMenuItem aboutMenuItem;
private JToolBar toolBar;

View File

@@ -418,6 +418,15 @@ new FormModel {
}
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "alwaysShowMnemonics", false ) )
} )
add( new FormComponent( "javax.swing.JCheckBoxMenuItem" ) {
name: "smoothScrollingMenuItem"
"text": "Smooth Scrolling"
"selected": true
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "smoothScrollingChanged", false ) )
} )
add( new FormComponent( "javax.swing.JCheckBoxMenuItem" ) {
name: "animatedLafChangeMenuItem"
"text": "Animated Laf Change"