From e337e5bbd82cd30a3aad406ddf0ad5238f9190cc Mon Sep 17 00:00:00 2001 From: Karl Tauber Date: Tue, 17 Nov 2020 18:07:11 +0100 Subject: [PATCH] JIDE: RangeSlider: - updated with latest changes from FlatSliderUI - use static FlatSliderUI methods for thumb painting - hover/pressed feedback on single thumb - hover/pressed feedback on middle track and both thumbs - added JSlider components to FlatRangeSliderTest for easier testing/comparing --- .../com/formdev/flatlaf/ui/FlatSliderUI.java | 37 ++++-- .../flatlaf/jideoss/ui/FlatRangeSliderUI.java | 83 ++++++------- .../uidefaults/FlatTestLaf_1.8.0_202.txt | 2 + .../jideoss/FlatJideOssDefaultsTestAddon.java | 32 +++++ .../testing/jideoss/FlatRangeSliderTest.java | 115 +++++++++++++----- .../testing/jideoss/FlatRangeSliderTest.jfd | 93 ++++++++++++-- .../com.formdev.flatlaf.FlatDefaultsAddon | 1 + .../testing/jideoss/FlatTestLaf.properties | 20 +++ 8 files changed, 288 insertions(+), 95 deletions(-) create mode 100644 flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/jideoss/FlatJideOssDefaultsTestAddon.java create mode 100644 flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/jideoss/FlatTestLaf.properties diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatSliderUI.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatSliderUI.java index 83a1e7e2..d5323d11 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatSliderUI.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatSliderUI.java @@ -20,6 +20,7 @@ import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; +import java.awt.Rectangle; import java.awt.event.MouseEvent; import java.awt.geom.Path2D; import java.awt.geom.RoundRectangle2D; @@ -206,9 +207,19 @@ public class FlatSliderUI @Override public void paintThumb( Graphics g ) { - g.setColor( FlatUIUtils.deriveColor( getThumbColor(), thumbColor ) ); + Color color = stateColor( slider, thumbHover, thumbPressed, + thumbColor, disabledThumbColor, focusColor, hoverThumbColor, pressedThumbColor ); + color = FlatUIUtils.deriveColor( color, thumbColor ); - if( isRoundThumb() ) + paintThumb( g, slider, thumbRect, isRoundThumb(), color ); + } + + public static void paintThumb( Graphics g, JSlider slider, Rectangle thumbRect, boolean roundThumb, + Color thumbColor ) + { + g.setColor( thumbColor ); + + if( roundThumb ) g.fillOval( thumbRect.x, thumbRect.y, thumbRect.width, thumbRect.height ); else { double w = thumbRect.width; @@ -236,16 +247,18 @@ public class FlatSliderUI } } - protected Color getThumbColor() { - if( !slider.isEnabled() ) - return disabledThumbColor; - if( thumbPressed && pressedThumbColor != null ) - return pressedThumbColor; - if( thumbHover && hoverThumbColor != null ) - return hoverThumbColor; - if( FlatUIUtils.isPermanentFocusOwner( slider ) ) - return focusColor; - return thumbColor; + public static Color stateColor( JSlider slider, boolean hover, boolean pressed, + Color enabledColor, Color disabledColor, Color focusedColor, Color hoverColor, Color pressedColor ) + { + if( disabledColor != null && !slider.isEnabled() ) + return disabledColor; + if( pressedColor != null && pressed ) + return pressedColor; + if( hoverColor != null && hover ) + return hoverColor; + if( focusedColor != null && FlatUIUtils.isPermanentFocusOwner( slider ) ) + return focusedColor; + return enabledColor; } protected boolean isRoundThumb() { diff --git a/flatlaf-jide-oss/src/main/java/com/formdev/flatlaf/jideoss/ui/FlatRangeSliderUI.java b/flatlaf-jide-oss/src/main/java/com/formdev/flatlaf/jideoss/ui/FlatRangeSliderUI.java index 5e8ea9dc..3e2ccad5 100644 --- a/flatlaf-jide-oss/src/main/java/com/formdev/flatlaf/jideoss/ui/FlatRangeSliderUI.java +++ b/flatlaf-jide-oss/src/main/java/com/formdev/flatlaf/jideoss/ui/FlatRangeSliderUI.java @@ -22,7 +22,6 @@ import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Point; import java.awt.Rectangle; -import java.awt.geom.Path2D; import java.awt.geom.RoundRectangle2D; import java.util.Dictionary; import java.util.Enumeration; @@ -31,6 +30,7 @@ import javax.swing.JSlider; import javax.swing.LookAndFeel; import javax.swing.UIManager; import javax.swing.plaf.ComponentUI; +import com.formdev.flatlaf.ui.FlatSliderUI; import com.formdev.flatlaf.ui.FlatUIUtils; import com.formdev.flatlaf.util.UIScale; import com.jidesoft.plaf.basic.BasicRangeSliderUI; @@ -41,14 +41,18 @@ import com.jidesoft.plaf.basic.BasicRangeSliderUI; public class FlatRangeSliderUI extends BasicRangeSliderUI { - private int trackWidth; - private int thumbWidth; + protected int trackWidth; + protected int thumbWidth; - private Color trackColor; - private Color thumbColor; - private Color focusColor; - private Color hoverColor; - private Color disabledForeground; + protected Color trackColor; + protected Color thumbColor; + protected Color focusColor; + protected Color hoverTrackColor; + protected Color hoverThumbColor; + protected Color pressedTrackColor; + protected Color pressedThumbColor; + protected Color disabledTrackColor; + protected Color disabledThumbColor; private Rectangle firstThumbRect; @@ -102,8 +106,12 @@ public class FlatRangeSliderUI trackColor = UIManager.getColor( "Slider.trackColor" ); thumbColor = UIManager.getColor( "Slider.thumbColor" ); focusColor = FlatUIUtils.getUIColor( "Slider.focusedColor", "Component.focusColor" ); - hoverColor = FlatUIUtils.getUIColor( "Slider.hoverColor", focusColor ); - disabledForeground = UIManager.getColor( "Slider.disabledForeground" ); + hoverTrackColor = FlatUIUtils.getUIColor( "Slider.hoverTrackColor", "Slider.hoverThumbColor" ); + hoverThumbColor = UIManager.getColor( "Slider.hoverThumbColor" ); + pressedTrackColor = FlatUIUtils.getUIColor( "Slider.pressedTrackColor", "Slider.pressedThumbColor" ); + pressedThumbColor = UIManager.getColor( "Slider.pressedThumbColor" ); + disabledTrackColor = UIManager.getColor( "Slider.disabledTrackColor" ); + disabledThumbColor = UIManager.getColor( "Slider.disabledThumbColor" ); } @Override @@ -113,8 +121,12 @@ public class FlatRangeSliderUI trackColor = null; thumbColor = null; focusColor = null; - hoverColor = null; - disabledForeground = null; + hoverTrackColor = null; + hoverThumbColor = null; + pressedTrackColor = null; + pressedThumbColor = null; + disabledTrackColor = null; + disabledThumbColor = null; } @Override @@ -220,50 +232,33 @@ public class FlatRangeSliderUI } if( coloredTrack != null ) { - g.setColor( FlatUIUtils.deriveColor( FlatUIUtils.isPermanentFocusOwner( slider ) ? focusColor : (hover ? hoverColor : thumbColor), thumbColor ) ); + boolean trackHover = hover && rollover1 && rollover2; + boolean trackPressed = pressed1 && pressed2; + + Color color = FlatSliderUI.stateColor( slider, trackHover, trackPressed, + thumbColor, null, null, hoverTrackColor, pressedTrackColor ); + + g.setColor( FlatUIUtils.deriveColor( color, thumbColor ) ); ((Graphics2D)g).fill( coloredTrack ); } - g.setColor( enabled ? trackColor : disabledForeground ); + g.setColor( enabled ? trackColor : disabledTrackColor ); ((Graphics2D)g).fill( track ); } @Override public void paintThumb( Graphics g ) { - g.setColor( FlatUIUtils.deriveColor( slider.isEnabled() - ? (FlatUIUtils.isPermanentFocusOwner( slider ) ? focusColor : (hover ? hoverColor : thumbColor)) - : disabledForeground, - thumbColor ) ); + boolean thumbHover = hover && ((!second && rollover1) || (second && rollover2)); + boolean thumbPressed = (!second && pressed1) || (second && pressed2); - if( isRoundThumb() ) - g.fillOval( thumbRect.x, thumbRect.y, thumbRect.width, thumbRect.height ); - else { - double w = thumbRect.width; - double h = thumbRect.height; - double wh = w / 2; + Color color = FlatSliderUI.stateColor( slider, thumbHover, thumbPressed, + thumbColor, disabledThumbColor, focusColor, hoverThumbColor, pressedThumbColor ); + color = FlatUIUtils.deriveColor( color, thumbColor ); - Path2D thumb = FlatUIUtils.createPath( 0,0, w,0, w,(h - wh), wh,h, 0,(h - wh) ); - - Graphics2D g2 = (Graphics2D) g.create(); - try { - g2.translate( thumbRect.x, thumbRect.y ); - if( slider.getOrientation() == JSlider.VERTICAL ) { - if( slider.getComponentOrientation().isLeftToRight() ) { - g2.translate( 0, thumbRect.height ); - g2.rotate( Math.toRadians( 270 ) ); - } else { - g2.translate( thumbRect.width, 0 ); - g2.rotate( Math.toRadians( 90 ) ); - } - } - g2.fill( thumb ); - } finally { - g2.dispose(); - } - } + FlatSliderUI.paintThumb( g, slider, thumbRect, isRoundThumb(), color ); } - private boolean isRoundThumb() { + protected boolean isRoundThumb() { return !slider.getPaintTicks() && !slider.getPaintLabels(); } } diff --git a/flatlaf-testing/dumps/uidefaults/FlatTestLaf_1.8.0_202.txt b/flatlaf-testing/dumps/uidefaults/FlatTestLaf_1.8.0_202.txt index 488f902e..d656b7f1 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatTestLaf_1.8.0_202.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatTestLaf_1.8.0_202.txt @@ -843,10 +843,12 @@ Slider.foreground #ff0000 javax.swing.plaf.ColorUIResource [UI] Slider.highlight #ffffff javax.swing.plaf.ColorUIResource [UI] Slider.horizontalSize 200,21 java.awt.Dimension Slider.hoverThumbColor #0000ff javax.swing.plaf.ColorUIResource [UI] +Slider.hoverTrackColor #4444ff javax.swing.plaf.ColorUIResource [UI] Slider.minimumHorizontalSize 36,21 java.awt.Dimension Slider.minimumVerticalSize 21,36 java.awt.Dimension Slider.onlyLeftMouseButtonDrag true Slider.pressedThumbColor #00ff00 javax.swing.plaf.ColorUIResource [UI] +Slider.pressedTrackColor #88ff88 javax.swing.plaf.ColorUIResource [UI] Slider.shadow #a0a0a0 javax.swing.plaf.ColorUIResource [UI] Slider.thumbColor #880000 javax.swing.plaf.ColorUIResource [UI] Slider.thumbWidth 11 diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/jideoss/FlatJideOssDefaultsTestAddon.java b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/jideoss/FlatJideOssDefaultsTestAddon.java new file mode 100644 index 00000000..f1219583 --- /dev/null +++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/jideoss/FlatJideOssDefaultsTestAddon.java @@ -0,0 +1,32 @@ +/* + * Copyright 2020 FormDev Software GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.formdev.flatlaf.testing.jideoss; + +import com.formdev.flatlaf.FlatDefaultsAddon; + +/** + * JIDE Common Layer addon for FlatLaf for testing. + *

+ * Finds JIDE Common Layer addon .properties file for the given LaF class + * in the same package as this class. + * + * @author Karl Tauber + */ +public class FlatJideOssDefaultsTestAddon + extends FlatDefaultsAddon +{ +} diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/jideoss/FlatRangeSliderTest.java b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/jideoss/FlatRangeSliderTest.java index 1b54b8ef..00eaa0a5 100644 --- a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/jideoss/FlatRangeSliderTest.java +++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/jideoss/FlatRangeSliderTest.java @@ -18,6 +18,7 @@ package com.formdev.flatlaf.testing.jideoss; import javax.swing.JCheckBox; import javax.swing.JLabel; +import javax.swing.JSlider; import javax.swing.SwingConstants; import javax.swing.SwingUtilities; import javax.swing.UIManager; @@ -50,13 +51,19 @@ public class FlatRangeSliderTest } private void paintLabels() { - horizontalRangeSlider.setPaintLabels( paintLabel.isSelected() ); - verticalRangeSlider.setPaintLabels( paintLabel.isSelected() ); + boolean selected = paintLabel.isSelected(); + horizontalRangeSlider.setPaintLabels( selected ); + verticalRangeSlider.setPaintLabels( selected ); + horizontalSlider.setPaintLabels( selected ); + verticalSlider.setPaintLabels( selected ); } private void paintTicks() { - horizontalRangeSlider.setPaintTicks( paintTick.isSelected() ); - verticalRangeSlider.setPaintTicks( paintTick.isSelected() ); + boolean selected = paintTick.isSelected(); + horizontalRangeSlider.setPaintTicks( selected ); + verticalRangeSlider.setPaintTicks( selected ); + horizontalSlider.setPaintTicks( selected ); + verticalSlider.setPaintTicks( selected ); } private void initComponents() { @@ -64,8 +71,14 @@ public class FlatRangeSliderTest JLabel tabbedPaneLabel = new JLabel(); JLabel horizontalLabel = new JLabel(); horizontalRangeSlider = new RangeSlider(); + horizontalSlider = new JSlider(); + horizontalRangeSlider2 = new RangeSlider(); + horizontalSlider2 = new JSlider(); JLabel verticalLabel = new JLabel(); verticalRangeSlider = new RangeSlider(); + verticalSlider = new JSlider(); + verticalRangeSlider2 = new RangeSlider(); + verticalSlider2 = new JSlider(); paintTick = new JCheckBox(); paintLabel = new JCheckBox(); @@ -74,10 +87,13 @@ public class FlatRangeSliderTest "insets dialog,hidemode 3", // columns "[left]" + - "[fill]", + "[240,left]", // rows "[fill]" + "[center]" + + "[]" + + "[]" + + "[]" + "[grow,fill]" + "[]")); @@ -88,57 +104,92 @@ public class FlatRangeSliderTest //---- horizontalLabel ---- horizontalLabel.setText("Horizontal"); add(horizontalLabel, "cell 0 1"); - add(horizontalRangeSlider, "cell 1 1"); + + //---- horizontalRangeSlider ---- + horizontalRangeSlider.setLowValue(30); + horizontalRangeSlider.setHighValue(80); + horizontalRangeSlider.setMajorTickSpacing(10); + horizontalRangeSlider.setMinorTickSpacing(5); + horizontalRangeSlider.setPaintTicks(true); + horizontalRangeSlider.setPaintLabels(true); + add(horizontalRangeSlider, "cell 1 1,growx"); + + //---- horizontalSlider ---- + horizontalSlider.setMinorTickSpacing(5); + horizontalSlider.setPaintTicks(true); + horizontalSlider.setMajorTickSpacing(10); + horizontalSlider.setPaintLabels(true); + horizontalSlider.setValue(30); + add(horizontalSlider, "cell 1 2,growx"); + + //---- horizontalRangeSlider2 ---- + horizontalRangeSlider2.setLowValue(30); + horizontalRangeSlider2.setHighValue(80); + add(horizontalRangeSlider2, "cell 1 3,growx"); + + //---- horizontalSlider2 ---- + horizontalSlider2.setValue(30); + add(horizontalSlider2, "cell 1 4,growx"); //---- verticalLabel ---- verticalLabel.setText("Vertical"); - add(verticalLabel, "cell 0 2,aligny top,growy 0"); + add(verticalLabel, "cell 0 5,aligny top,growy 0"); //---- verticalRangeSlider ---- verticalRangeSlider.setOrientation(SwingConstants.VERTICAL); - add(verticalRangeSlider, "cell 1 2,alignx left,growx 0"); + verticalRangeSlider.setLowValue(30); + verticalRangeSlider.setHighValue(80); + verticalRangeSlider.setMajorTickSpacing(10); + verticalRangeSlider.setMinorTickSpacing(5); + verticalRangeSlider.setPaintTicks(true); + verticalRangeSlider.setPaintLabels(true); + add(verticalRangeSlider, "cell 1 5,alignx left,growx 0"); + + //---- verticalSlider ---- + verticalSlider.setMinorTickSpacing(5); + verticalSlider.setPaintTicks(true); + verticalSlider.setMajorTickSpacing(10); + verticalSlider.setPaintLabels(true); + verticalSlider.setOrientation(SwingConstants.VERTICAL); + verticalSlider.setValue(30); + add(verticalSlider, "cell 1 5"); + + //---- verticalRangeSlider2 ---- + verticalRangeSlider2.setOrientation(SwingConstants.VERTICAL); + verticalRangeSlider2.setLowValue(30); + verticalRangeSlider2.setHighValue(80); + add(verticalRangeSlider2, "cell 1 5"); + + //---- verticalSlider2 ---- + verticalSlider2.setOrientation(SwingConstants.VERTICAL); + verticalSlider2.setValue(30); + add(verticalSlider2, "cell 1 5"); //---- paintTick ---- paintTick.setText("PaintTicks"); paintTick.setMnemonic('T'); paintTick.setSelected(true); paintTick.addActionListener(e -> paintTicks()); - add(paintTick, "cell 0 3 2 1"); + add(paintTick, "cell 0 6 2 1"); //---- paintLabel ---- paintLabel.setText("PaintLabels"); paintLabel.setMnemonic('L'); paintLabel.setSelected(true); paintLabel.addActionListener(e -> paintLabels()); - add(paintLabel, "cell 0 3 2 1"); + add(paintLabel, "cell 0 6 2 1"); // JFormDesigner - End of component initialization //GEN-END:initComponents - - horizontalRangeSlider.setOrientation( SwingConstants.HORIZONTAL ); - horizontalRangeSlider.setMinimum( 0 ); - horizontalRangeSlider.setMaximum( 100 ); - horizontalRangeSlider.setLowValue( 10 ); - horizontalRangeSlider.setHighValue( 90 ); - horizontalRangeSlider.setLabelTable( horizontalRangeSlider.createStandardLabels( 10 ) ); - horizontalRangeSlider.setMinorTickSpacing( 5 ); - horizontalRangeSlider.setMajorTickSpacing( 10 ); - horizontalRangeSlider.setPaintTicks( true ); - horizontalRangeSlider.setPaintLabels( true ); - - verticalRangeSlider.setOrientation( SwingConstants.VERTICAL ); - verticalRangeSlider.setMinimum( 0 ); - verticalRangeSlider.setMaximum( 100 ); - verticalRangeSlider.setLowValue( 10 ); - verticalRangeSlider.setHighValue( 90 ); - verticalRangeSlider.setLabelTable( horizontalRangeSlider.createStandardLabels( 10 ) ); - verticalRangeSlider.setMinorTickSpacing( 5 ); - verticalRangeSlider.setMajorTickSpacing( 10 ); - verticalRangeSlider.setPaintTicks( true ); - verticalRangeSlider.setPaintLabels( true ); } // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables private RangeSlider horizontalRangeSlider; + private JSlider horizontalSlider; + private RangeSlider horizontalRangeSlider2; + private JSlider horizontalSlider2; private RangeSlider verticalRangeSlider; + private JSlider verticalSlider; + private RangeSlider verticalRangeSlider2; + private JSlider verticalSlider2; private JCheckBox paintTick; private JCheckBox paintLabel; // JFormDesigner - End of variables declaration //GEN-END:variables diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/jideoss/FlatRangeSliderTest.jfd b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/jideoss/FlatRangeSliderTest.jfd index 2cef9f84..7cd55f14 100644 --- a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/jideoss/FlatRangeSliderTest.jfd +++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/jideoss/FlatRangeSliderTest.jfd @@ -8,8 +8,8 @@ new FormModel { } add( new FormContainer( "com.formdev.flatlaf.testing.FlatTestPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) { "$layoutConstraints": "insets dialog,hidemode 3" - "$columnConstraints": "[left][fill]" - "$rowConstraints": "[fill][center][grow,fill][]" + "$columnConstraints": "[left][240,left]" + "$rowConstraints": "[fill][center][][][][grow,fill][]" } ) { name: "this" add( new FormComponent( "javax.swing.JLabel" ) { @@ -26,26 +26,105 @@ new FormModel { } ) add( new FormComponent( "com.jidesoft.swing.RangeSlider" ) { name: "horizontalRangeSlider" + "lowValue": 30 + "highValue": 80 + "majorTickSpacing": 10 + "minorTickSpacing": 5 + "paintTicks": true + "paintLabels": true auxiliary() { "JavaCodeGenerator.variableLocal": false } }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 1 1" + "value": "cell 1 1,growx" + } ) + add( new FormComponent( "javax.swing.JSlider" ) { + name: "horizontalSlider" + "minorTickSpacing": 5 + "paintTicks": true + "majorTickSpacing": 10 + "paintLabels": true + "value": 30 + auxiliary() { + "JavaCodeGenerator.variableLocal": false + } + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 2,growx" + } ) + add( new FormComponent( "com.jidesoft.swing.RangeSlider" ) { + name: "horizontalRangeSlider2" + "lowValue": 30 + "highValue": 80 + auxiliary() { + "JavaCodeGenerator.variableLocal": false + } + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 3,growx" + } ) + add( new FormComponent( "javax.swing.JSlider" ) { + name: "horizontalSlider2" + "value": 30 + auxiliary() { + "JavaCodeGenerator.variableLocal": false + } + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 4,growx" } ) add( new FormComponent( "javax.swing.JLabel" ) { name: "verticalLabel" "text": "Vertical" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 0 2,aligny top,growy 0" + "value": "cell 0 5,aligny top,growy 0" } ) add( new FormComponent( "com.jidesoft.swing.RangeSlider" ) { name: "verticalRangeSlider" "orientation": 1 + "lowValue": 30 + "highValue": 80 + "majorTickSpacing": 10 + "minorTickSpacing": 5 + "paintTicks": true + "paintLabels": true auxiliary() { "JavaCodeGenerator.variableLocal": false } }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 1 2,alignx left,growx 0" + "value": "cell 1 5,alignx left,growx 0" + } ) + add( new FormComponent( "javax.swing.JSlider" ) { + name: "verticalSlider" + "minorTickSpacing": 5 + "paintTicks": true + "majorTickSpacing": 10 + "paintLabels": true + "orientation": 1 + "value": 30 + auxiliary() { + "JavaCodeGenerator.variableLocal": false + } + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 5" + } ) + add( new FormComponent( "com.jidesoft.swing.RangeSlider" ) { + name: "verticalRangeSlider2" + "orientation": 1 + "lowValue": 30 + "highValue": 80 + auxiliary() { + "JavaCodeGenerator.variableLocal": false + } + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 5" + } ) + add( new FormComponent( "javax.swing.JSlider" ) { + name: "verticalSlider2" + "orientation": 1 + "value": 30 + auxiliary() { + "JavaCodeGenerator.variableLocal": false + } + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 5" } ) add( new FormComponent( "javax.swing.JCheckBox" ) { name: "paintTick" @@ -57,7 +136,7 @@ new FormModel { } addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "paintTicks", false ) ) }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 0 3 2 1" + "value": "cell 0 6 2 1" } ) add( new FormComponent( "javax.swing.JCheckBox" ) { name: "paintLabel" @@ -69,7 +148,7 @@ new FormModel { } addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "paintLabels", false ) ) }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 0 3 2 1" + "value": "cell 0 6 2 1" } ) }, new FormLayoutConstraints( null ) { "location": new java.awt.Point( 0, 0 ) diff --git a/flatlaf-testing/src/main/resources/META-INF/services/com.formdev.flatlaf.FlatDefaultsAddon b/flatlaf-testing/src/main/resources/META-INF/services/com.formdev.flatlaf.FlatDefaultsAddon index d0cccba9..b2b6b9dc 100644 --- a/flatlaf-testing/src/main/resources/META-INF/services/com.formdev.flatlaf.FlatDefaultsAddon +++ b/flatlaf-testing/src/main/resources/META-INF/services/com.formdev.flatlaf.FlatDefaultsAddon @@ -1 +1,2 @@ +com.formdev.flatlaf.testing.jideoss.FlatJideOssDefaultsTestAddon com.formdev.flatlaf.testing.swingx.FlatSwingXDefaultsTestAddon diff --git a/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/jideoss/FlatTestLaf.properties b/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/jideoss/FlatTestLaf.properties new file mode 100644 index 00000000..31b74e10 --- /dev/null +++ b/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/jideoss/FlatTestLaf.properties @@ -0,0 +1,20 @@ +# +# Copyright 2020 FormDev Software GmbH +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +#---- RangeSlider ---- + +Slider.hoverTrackColor=#44f +Slider.pressedTrackColor=#8f8