mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-11 22:47:13 -06:00
Demo: added "Extras" tab
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
package com.formdev.flatlaf.testing.extras;
|
||||
|
||||
import javax.swing.*;
|
||||
import com.formdev.flatlaf.FlatIconColors;
|
||||
import com.formdev.flatlaf.extras.*;
|
||||
import com.formdev.flatlaf.testing.*;
|
||||
import net.miginfocom.swing.*;
|
||||
@@ -30,6 +31,7 @@ public class FlatExtrasTest
|
||||
public static void main( String[] args ) {
|
||||
SwingUtilities.invokeLater( () -> {
|
||||
FlatTestFrame frame = FlatTestFrame.create( args, "FlatExtrasTest" );
|
||||
System.out.println( UIManager.getColor( FlatIconColors.ACTIONS_GREY.key ) );
|
||||
frame.showFrame( FlatExtrasTest::new );
|
||||
} );
|
||||
}
|
||||
@@ -39,6 +41,29 @@ public class FlatExtrasTest
|
||||
|
||||
triStateLabel1.setText( triStateCheckBox1.getState().toString() );
|
||||
triStateLabel2.setText( triStateCheckBox2.getState().toString() );
|
||||
|
||||
addSVGIcon( "actions/copy.svg" );
|
||||
addSVGIcon( "actions/colors.svg" );
|
||||
addSVGIcon( "actions/execute.svg" );
|
||||
addSVGIcon( "actions/suspend.svg" );
|
||||
addSVGIcon( "actions/intentionBulb.svg" );
|
||||
addSVGIcon( "actions/quickfixOffBulb.svg" );
|
||||
|
||||
addSVGIcon( "objects/abstractClass.svg" );
|
||||
addSVGIcon( "objects/abstractMethod.svg" );
|
||||
addSVGIcon( "objects/annotationtype.svg" );
|
||||
addSVGIcon( "objects/annotationtype.svg" );
|
||||
addSVGIcon( "objects/css.svg" );
|
||||
addSVGIcon( "objects/javaScript.svg" );
|
||||
addSVGIcon( "objects/xhtml.svg" );
|
||||
|
||||
addSVGIcon( "errorDialog.svg" );
|
||||
addSVGIcon( "informationDialog.svg" );
|
||||
addSVGIcon( "warningDialog.svg" );
|
||||
}
|
||||
|
||||
private void addSVGIcon( String name ) {
|
||||
svgIconsPanel.add( new JLabel( new FlatSVGIcon( "com/formdev/flatlaf/demo/extras/svg/" + name ) ) );
|
||||
}
|
||||
|
||||
private void triStateCheckBox1Changed() {
|
||||
@@ -56,6 +81,9 @@ public class FlatExtrasTest
|
||||
triStateLabel1 = new JLabel();
|
||||
triStateCheckBox2 = new TriStateCheckBox();
|
||||
triStateLabel2 = new JLabel();
|
||||
label2 = new JLabel();
|
||||
svgIconsPanel = new JPanel();
|
||||
label3 = new JLabel();
|
||||
|
||||
//======== this ========
|
||||
setLayout(new MigLayout(
|
||||
@@ -66,6 +94,8 @@ public class FlatExtrasTest
|
||||
"[left]",
|
||||
// rows
|
||||
"[]" +
|
||||
"[]" +
|
||||
"[]" +
|
||||
"[]"));
|
||||
|
||||
//---- label1 ----
|
||||
@@ -90,6 +120,25 @@ public class FlatExtrasTest
|
||||
//---- triStateLabel2 ----
|
||||
triStateLabel2.setText("text");
|
||||
add(triStateLabel2, "cell 2 1");
|
||||
|
||||
//---- label2 ----
|
||||
label2.setText("SVG Icons:");
|
||||
add(label2, "cell 0 2");
|
||||
|
||||
//======== svgIconsPanel ========
|
||||
{
|
||||
svgIconsPanel.setLayout(new MigLayout(
|
||||
"insets 0,hidemode 3",
|
||||
// columns
|
||||
"[fill]",
|
||||
// rows
|
||||
"[grow,center]"));
|
||||
}
|
||||
add(svgIconsPanel, "cell 1 2 2 1");
|
||||
|
||||
//---- label3 ----
|
||||
label3.setText("The icons may change colors when switching to another theme.");
|
||||
add(label3, "cell 1 3 2 1");
|
||||
// JFormDesigner - End of component initialization //GEN-END:initComponents
|
||||
}
|
||||
|
||||
@@ -99,5 +148,8 @@ public class FlatExtrasTest
|
||||
private JLabel triStateLabel1;
|
||||
private TriStateCheckBox triStateCheckBox2;
|
||||
private JLabel triStateLabel2;
|
||||
private JLabel label2;
|
||||
private JPanel svgIconsPanel;
|
||||
private JLabel label3;
|
||||
// JFormDesigner - End of variables declaration //GEN-END:variables
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
JFDML JFormDesigner: "7.0.0.0.194" Java: "11.0.2" encoding: "UTF-8"
|
||||
JFDML JFormDesigner: "7.0.1.0.272" Java: "13.0.2" 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" ) {
|
||||
@@ -42,9 +42,30 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 2 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "label2"
|
||||
"text": "SVG Icons:"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 2"
|
||||
} )
|
||||
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||
"$layoutConstraints": "insets 0,hidemode 3"
|
||||
"$columnConstraints": "[fill]"
|
||||
"$rowConstraints": "[grow,center]"
|
||||
} ) {
|
||||
name: "svgIconsPanel"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 2 2 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "label3"
|
||||
"text": "The icons may change colors when switching to another theme."
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 3 2 1"
|
||||
} )
|
||||
}, new FormLayoutConstraints( null ) {
|
||||
"location": new java.awt.Point( 0, 0 )
|
||||
"size": new java.awt.Dimension( 400, 300 )
|
||||
"size": new java.awt.Dimension( 500, 300 )
|
||||
} )
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user