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
This commit is contained in:
Karl Tauber
2020-11-17 18:07:11 +01:00
parent 6e55e0a183
commit e337e5bbd8
8 changed files with 288 additions and 95 deletions

View File

@@ -20,6 +20,7 @@ import java.awt.Color;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.geom.Path2D; import java.awt.geom.Path2D;
import java.awt.geom.RoundRectangle2D; import java.awt.geom.RoundRectangle2D;
@@ -206,9 +207,19 @@ public class FlatSliderUI
@Override @Override
public void paintThumb( Graphics g ) { 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 ); g.fillOval( thumbRect.x, thumbRect.y, thumbRect.width, thumbRect.height );
else { else {
double w = thumbRect.width; double w = thumbRect.width;
@@ -236,16 +247,18 @@ public class FlatSliderUI
} }
} }
protected Color getThumbColor() { public static Color stateColor( JSlider slider, boolean hover, boolean pressed,
if( !slider.isEnabled() ) Color enabledColor, Color disabledColor, Color focusedColor, Color hoverColor, Color pressedColor )
return disabledThumbColor; {
if( thumbPressed && pressedThumbColor != null ) if( disabledColor != null && !slider.isEnabled() )
return pressedThumbColor; return disabledColor;
if( thumbHover && hoverThumbColor != null ) if( pressedColor != null && pressed )
return hoverThumbColor; return pressedColor;
if( FlatUIUtils.isPermanentFocusOwner( slider ) ) if( hoverColor != null && hover )
return focusColor; return hoverColor;
return thumbColor; if( focusedColor != null && FlatUIUtils.isPermanentFocusOwner( slider ) )
return focusedColor;
return enabledColor;
} }
protected boolean isRoundThumb() { protected boolean isRoundThumb() {

View File

@@ -22,7 +22,6 @@ import java.awt.Graphics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.Point; import java.awt.Point;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.awt.geom.Path2D;
import java.awt.geom.RoundRectangle2D; import java.awt.geom.RoundRectangle2D;
import java.util.Dictionary; import java.util.Dictionary;
import java.util.Enumeration; import java.util.Enumeration;
@@ -31,6 +30,7 @@ import javax.swing.JSlider;
import javax.swing.LookAndFeel; import javax.swing.LookAndFeel;
import javax.swing.UIManager; import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI; import javax.swing.plaf.ComponentUI;
import com.formdev.flatlaf.ui.FlatSliderUI;
import com.formdev.flatlaf.ui.FlatUIUtils; import com.formdev.flatlaf.ui.FlatUIUtils;
import com.formdev.flatlaf.util.UIScale; import com.formdev.flatlaf.util.UIScale;
import com.jidesoft.plaf.basic.BasicRangeSliderUI; import com.jidesoft.plaf.basic.BasicRangeSliderUI;
@@ -41,14 +41,18 @@ import com.jidesoft.plaf.basic.BasicRangeSliderUI;
public class FlatRangeSliderUI public class FlatRangeSliderUI
extends BasicRangeSliderUI extends BasicRangeSliderUI
{ {
private int trackWidth; protected int trackWidth;
private int thumbWidth; protected int thumbWidth;
private Color trackColor; protected Color trackColor;
private Color thumbColor; protected Color thumbColor;
private Color focusColor; protected Color focusColor;
private Color hoverColor; protected Color hoverTrackColor;
private Color disabledForeground; protected Color hoverThumbColor;
protected Color pressedTrackColor;
protected Color pressedThumbColor;
protected Color disabledTrackColor;
protected Color disabledThumbColor;
private Rectangle firstThumbRect; private Rectangle firstThumbRect;
@@ -102,8 +106,12 @@ public class FlatRangeSliderUI
trackColor = UIManager.getColor( "Slider.trackColor" ); trackColor = UIManager.getColor( "Slider.trackColor" );
thumbColor = UIManager.getColor( "Slider.thumbColor" ); thumbColor = UIManager.getColor( "Slider.thumbColor" );
focusColor = FlatUIUtils.getUIColor( "Slider.focusedColor", "Component.focusColor" ); focusColor = FlatUIUtils.getUIColor( "Slider.focusedColor", "Component.focusColor" );
hoverColor = FlatUIUtils.getUIColor( "Slider.hoverColor", focusColor ); hoverTrackColor = FlatUIUtils.getUIColor( "Slider.hoverTrackColor", "Slider.hoverThumbColor" );
disabledForeground = UIManager.getColor( "Slider.disabledForeground" ); 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 @Override
@@ -113,8 +121,12 @@ public class FlatRangeSliderUI
trackColor = null; trackColor = null;
thumbColor = null; thumbColor = null;
focusColor = null; focusColor = null;
hoverColor = null; hoverTrackColor = null;
disabledForeground = null; hoverThumbColor = null;
pressedTrackColor = null;
pressedThumbColor = null;
disabledTrackColor = null;
disabledThumbColor = null;
} }
@Override @Override
@@ -220,50 +232,33 @@ public class FlatRangeSliderUI
} }
if( coloredTrack != null ) { 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 ); ((Graphics2D)g).fill( coloredTrack );
} }
g.setColor( enabled ? trackColor : disabledForeground ); g.setColor( enabled ? trackColor : disabledTrackColor );
((Graphics2D)g).fill( track ); ((Graphics2D)g).fill( track );
} }
@Override @Override
public void paintThumb( Graphics g ) { public void paintThumb( Graphics g ) {
g.setColor( FlatUIUtils.deriveColor( slider.isEnabled() boolean thumbHover = hover && ((!second && rollover1) || (second && rollover2));
? (FlatUIUtils.isPermanentFocusOwner( slider ) ? focusColor : (hover ? hoverColor : thumbColor)) boolean thumbPressed = (!second && pressed1) || (second && pressed2);
: disabledForeground,
thumbColor ) );
if( isRoundThumb() ) Color color = FlatSliderUI.stateColor( slider, thumbHover, thumbPressed,
g.fillOval( thumbRect.x, thumbRect.y, thumbRect.width, thumbRect.height ); thumbColor, disabledThumbColor, focusColor, hoverThumbColor, pressedThumbColor );
else { color = FlatUIUtils.deriveColor( color, thumbColor );
double w = thumbRect.width;
double h = thumbRect.height;
double wh = w / 2;
Path2D thumb = FlatUIUtils.createPath( 0,0, w,0, w,(h - wh), wh,h, 0,(h - wh) ); FlatSliderUI.paintThumb( g, slider, thumbRect, isRoundThumb(), color );
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();
}
}
} }
private boolean isRoundThumb() { protected boolean isRoundThumb() {
return !slider.getPaintTicks() && !slider.getPaintLabels(); return !slider.getPaintTicks() && !slider.getPaintLabels();
} }
} }

View File

@@ -843,10 +843,12 @@ Slider.foreground #ff0000 javax.swing.plaf.ColorUIResource [UI]
Slider.highlight #ffffff javax.swing.plaf.ColorUIResource [UI] Slider.highlight #ffffff javax.swing.plaf.ColorUIResource [UI]
Slider.horizontalSize 200,21 java.awt.Dimension Slider.horizontalSize 200,21 java.awt.Dimension
Slider.hoverThumbColor #0000ff javax.swing.plaf.ColorUIResource [UI] Slider.hoverThumbColor #0000ff javax.swing.plaf.ColorUIResource [UI]
Slider.hoverTrackColor #4444ff javax.swing.plaf.ColorUIResource [UI]
Slider.minimumHorizontalSize 36,21 java.awt.Dimension Slider.minimumHorizontalSize 36,21 java.awt.Dimension
Slider.minimumVerticalSize 21,36 java.awt.Dimension Slider.minimumVerticalSize 21,36 java.awt.Dimension
Slider.onlyLeftMouseButtonDrag true Slider.onlyLeftMouseButtonDrag true
Slider.pressedThumbColor #00ff00 javax.swing.plaf.ColorUIResource [UI] 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.shadow #a0a0a0 javax.swing.plaf.ColorUIResource [UI]
Slider.thumbColor #880000 javax.swing.plaf.ColorUIResource [UI] Slider.thumbColor #880000 javax.swing.plaf.ColorUIResource [UI]
Slider.thumbWidth 11 Slider.thumbWidth 11

View File

@@ -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.
* <p>
* 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
{
}

View File

@@ -18,6 +18,7 @@ package com.formdev.flatlaf.testing.jideoss;
import javax.swing.JCheckBox; import javax.swing.JCheckBox;
import javax.swing.JLabel; import javax.swing.JLabel;
import javax.swing.JSlider;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import javax.swing.UIManager; import javax.swing.UIManager;
@@ -50,13 +51,19 @@ public class FlatRangeSliderTest
} }
private void paintLabels() { private void paintLabels() {
horizontalRangeSlider.setPaintLabels( paintLabel.isSelected() ); boolean selected = paintLabel.isSelected();
verticalRangeSlider.setPaintLabels( paintLabel.isSelected() ); horizontalRangeSlider.setPaintLabels( selected );
verticalRangeSlider.setPaintLabels( selected );
horizontalSlider.setPaintLabels( selected );
verticalSlider.setPaintLabels( selected );
} }
private void paintTicks() { private void paintTicks() {
horizontalRangeSlider.setPaintTicks( paintTick.isSelected() ); boolean selected = paintTick.isSelected();
verticalRangeSlider.setPaintTicks( paintTick.isSelected() ); horizontalRangeSlider.setPaintTicks( selected );
verticalRangeSlider.setPaintTicks( selected );
horizontalSlider.setPaintTicks( selected );
verticalSlider.setPaintTicks( selected );
} }
private void initComponents() { private void initComponents() {
@@ -64,8 +71,14 @@ public class FlatRangeSliderTest
JLabel tabbedPaneLabel = new JLabel(); JLabel tabbedPaneLabel = new JLabel();
JLabel horizontalLabel = new JLabel(); JLabel horizontalLabel = new JLabel();
horizontalRangeSlider = new RangeSlider(); horizontalRangeSlider = new RangeSlider();
horizontalSlider = new JSlider();
horizontalRangeSlider2 = new RangeSlider();
horizontalSlider2 = new JSlider();
JLabel verticalLabel = new JLabel(); JLabel verticalLabel = new JLabel();
verticalRangeSlider = new RangeSlider(); verticalRangeSlider = new RangeSlider();
verticalSlider = new JSlider();
verticalRangeSlider2 = new RangeSlider();
verticalSlider2 = new JSlider();
paintTick = new JCheckBox(); paintTick = new JCheckBox();
paintLabel = new JCheckBox(); paintLabel = new JCheckBox();
@@ -74,10 +87,13 @@ public class FlatRangeSliderTest
"insets dialog,hidemode 3", "insets dialog,hidemode 3",
// columns // columns
"[left]" + "[left]" +
"[fill]", "[240,left]",
// rows // rows
"[fill]" + "[fill]" +
"[center]" + "[center]" +
"[]" +
"[]" +
"[]" +
"[grow,fill]" + "[grow,fill]" +
"[]")); "[]"));
@@ -88,57 +104,92 @@ public class FlatRangeSliderTest
//---- horizontalLabel ---- //---- horizontalLabel ----
horizontalLabel.setText("Horizontal"); horizontalLabel.setText("Horizontal");
add(horizontalLabel, "cell 0 1"); 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 ----
verticalLabel.setText("Vertical"); verticalLabel.setText("Vertical");
add(verticalLabel, "cell 0 2,aligny top,growy 0"); add(verticalLabel, "cell 0 5,aligny top,growy 0");
//---- verticalRangeSlider ---- //---- verticalRangeSlider ----
verticalRangeSlider.setOrientation(SwingConstants.VERTICAL); 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 ----
paintTick.setText("PaintTicks"); paintTick.setText("PaintTicks");
paintTick.setMnemonic('T'); paintTick.setMnemonic('T');
paintTick.setSelected(true); paintTick.setSelected(true);
paintTick.addActionListener(e -> paintTicks()); paintTick.addActionListener(e -> paintTicks());
add(paintTick, "cell 0 3 2 1"); add(paintTick, "cell 0 6 2 1");
//---- paintLabel ---- //---- paintLabel ----
paintLabel.setText("PaintLabels"); paintLabel.setText("PaintLabels");
paintLabel.setMnemonic('L'); paintLabel.setMnemonic('L');
paintLabel.setSelected(true); paintLabel.setSelected(true);
paintLabel.addActionListener(e -> paintLabels()); 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 // 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 // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
private RangeSlider horizontalRangeSlider; private RangeSlider horizontalRangeSlider;
private JSlider horizontalSlider;
private RangeSlider horizontalRangeSlider2;
private JSlider horizontalSlider2;
private RangeSlider verticalRangeSlider; private RangeSlider verticalRangeSlider;
private JSlider verticalSlider;
private RangeSlider verticalRangeSlider2;
private JSlider verticalSlider2;
private JCheckBox paintTick; private JCheckBox paintTick;
private JCheckBox paintLabel; private JCheckBox paintLabel;
// JFormDesigner - End of variables declaration //GEN-END:variables // JFormDesigner - End of variables declaration //GEN-END:variables

View File

@@ -8,8 +8,8 @@ new FormModel {
} }
add( new FormContainer( "com.formdev.flatlaf.testing.FlatTestPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) { add( new FormContainer( "com.formdev.flatlaf.testing.FlatTestPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
"$layoutConstraints": "insets dialog,hidemode 3" "$layoutConstraints": "insets dialog,hidemode 3"
"$columnConstraints": "[left][fill]" "$columnConstraints": "[left][240,left]"
"$rowConstraints": "[fill][center][grow,fill][]" "$rowConstraints": "[fill][center][][][][grow,fill][]"
} ) { } ) {
name: "this" name: "this"
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
@@ -26,26 +26,105 @@ new FormModel {
} ) } )
add( new FormComponent( "com.jidesoft.swing.RangeSlider" ) { add( new FormComponent( "com.jidesoft.swing.RangeSlider" ) {
name: "horizontalRangeSlider" name: "horizontalRangeSlider"
"lowValue": 30
"highValue": 80
"majorTickSpacing": 10
"minorTickSpacing": 5
"paintTicks": true
"paintLabels": true
auxiliary() { auxiliary() {
"JavaCodeGenerator.variableLocal": false "JavaCodeGenerator.variableLocal": false
} }
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, 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" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "verticalLabel" name: "verticalLabel"
"text": "Vertical" "text": "Vertical"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, 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" ) { add( new FormComponent( "com.jidesoft.swing.RangeSlider" ) {
name: "verticalRangeSlider" name: "verticalRangeSlider"
"orientation": 1 "orientation": 1
"lowValue": 30
"highValue": 80
"majorTickSpacing": 10
"minorTickSpacing": 5
"paintTicks": true
"paintLabels": true
auxiliary() { auxiliary() {
"JavaCodeGenerator.variableLocal": false "JavaCodeGenerator.variableLocal": false
} }
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, 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" ) { add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "paintTick" name: "paintTick"
@@ -57,7 +136,7 @@ new FormModel {
} }
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "paintTicks", false ) ) addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "paintTicks", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, 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" ) { add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "paintLabel" name: "paintLabel"
@@ -69,7 +148,7 @@ new FormModel {
} }
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "paintLabels", false ) ) addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "paintLabels", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 3 2 1" "value": "cell 0 6 2 1"
} ) } )
}, new FormLayoutConstraints( null ) { }, new FormLayoutConstraints( null ) {
"location": new java.awt.Point( 0, 0 ) "location": new java.awt.Point( 0, 0 )

View File

@@ -1 +1,2 @@
com.formdev.flatlaf.testing.jideoss.FlatJideOssDefaultsTestAddon
com.formdev.flatlaf.testing.swingx.FlatSwingXDefaultsTestAddon com.formdev.flatlaf.testing.swingx.FlatSwingXDefaultsTestAddon

View File

@@ -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