mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-11 22:47:13 -06:00
FlatSVGIcon: some additions to PR #817:
- create new `LinearGradientPaint` only if color has changed - preserve old `LinearGradientPaint.colorSpace` and `transform`
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.formdev.flatlaf.testing.extras;
|
||||
|
||||
import java.awt.*;
|
||||
import javax.swing.*;
|
||||
import com.formdev.flatlaf.extras.*;
|
||||
import com.formdev.flatlaf.extras.components.*;
|
||||
@@ -75,6 +76,12 @@ public class FlatExtrasTest
|
||||
disabledTabbedPane2.setIconAt( 0, icon );
|
||||
disabledTabbedPane2.setDisabledIconAt( 0, disabledIcon );
|
||||
|
||||
addJSVGIcon( "linearGradient.svg", 64, 128 );
|
||||
addJSVGIcon( "stripes.svg", 128, 128 );
|
||||
addJSVGIcon( "gradientText0.svg", 128, 128 );
|
||||
addJSVGIcon( "gradientText1.svg", 128, 128 );
|
||||
addJSVGIcon( "gradientText2.svg", 128, 128 );
|
||||
|
||||
disabledChanged();
|
||||
}
|
||||
|
||||
@@ -82,6 +89,10 @@ public class FlatExtrasTest
|
||||
svgIconsPanel.add( new JLabel( new FlatSVGIcon( "com/formdev/flatlaf/demo/extras/svg/" + name ) ) );
|
||||
}
|
||||
|
||||
private void addJSVGIcon( String name, int width, int height ) {
|
||||
gradientIconsPanel.add( new JLabel( new FlatSVGIcon( "com/formdev/flatlaf/testing/extras/jsvg/" + name, width, height ) ) );
|
||||
}
|
||||
|
||||
private void triStateCheckBox1Changed() {
|
||||
triStateLabel1.setText( triStateCheckBox1.getState().toString() );
|
||||
}
|
||||
@@ -104,6 +115,9 @@ public class FlatExtrasTest
|
||||
disabledLabel2.setEnabled( enabled );
|
||||
disabledButton2.setEnabled( enabled );
|
||||
disabledTabbedPane2.setEnabledAt( 0, enabled );
|
||||
|
||||
for( Component c : gradientIconsPanel.getComponents() )
|
||||
c.setEnabled( enabled );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -141,6 +155,7 @@ public class FlatExtrasTest
|
||||
disabledButton2 = new JButton();
|
||||
disabledTabbedPane2 = new JTabbedPane();
|
||||
label6 = new JLabel();
|
||||
gradientIconsPanel = new JPanel();
|
||||
|
||||
//======== this ========
|
||||
setLayout(new MigLayout(
|
||||
@@ -156,6 +171,7 @@ public class FlatExtrasTest
|
||||
"[]" +
|
||||
"[]" +
|
||||
"[]" +
|
||||
"[]" +
|
||||
"[]"));
|
||||
|
||||
//---- label1 ----
|
||||
@@ -251,6 +267,12 @@ public class FlatExtrasTest
|
||||
label6.setText("setIcon() and setDisabledIcon()");
|
||||
label6.setEnabled(false);
|
||||
add(label6, "cell 1 6 2 1,gapx 20");
|
||||
|
||||
//======== gradientIconsPanel ========
|
||||
{
|
||||
gradientIconsPanel.setLayout(new FlowLayout());
|
||||
}
|
||||
add(gradientIconsPanel, "cell 1 7 2 1");
|
||||
// JFormDesigner - End of component initialization //GEN-END:initComponents
|
||||
}
|
||||
|
||||
@@ -275,5 +297,6 @@ public class FlatExtrasTest
|
||||
private JButton disabledButton2;
|
||||
private JTabbedPane disabledTabbedPane2;
|
||||
private JLabel label6;
|
||||
private JPanel gradientIconsPanel;
|
||||
// JFormDesigner - End of variables declaration //GEN-END:variables
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
JFDML JFormDesigner: "7.0.3.1.342" Java: "15" encoding: "UTF-8"
|
||||
JFDML JFormDesigner: "8.2.0.0.331" Java: "21" encoding: "UTF-8"
|
||||
|
||||
new FormModel {
|
||||
contentType: "form/swing"
|
||||
@@ -6,7 +6,7 @@ new FormModel {
|
||||
add( new FormContainer( "com.formdev.flatlaf.testing.FlatTestPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||
"$layoutConstraints": "ltr,insets dialog,hidemode 3"
|
||||
"$columnConstraints": "[][][left]"
|
||||
"$rowConstraints": "[][][][][][][]"
|
||||
"$rowConstraints": "[][][][][][][][]"
|
||||
} ) {
|
||||
name: "this"
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
@@ -143,9 +143,14 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 6 2 1,gapx 20"
|
||||
} )
|
||||
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class java.awt.FlowLayout ) ) {
|
||||
name: "gradientIconsPanel"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 7 2 1"
|
||||
} )
|
||||
}, new FormLayoutConstraints( null ) {
|
||||
"location": new java.awt.Point( 0, 0 )
|
||||
"size": new java.awt.Dimension( 595, 470 )
|
||||
"size": new java.awt.Dimension( 645, 470 )
|
||||
} )
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user