mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-07 14:30:56 +03:00
FlatTestFrame: support testing 3rd party lafs
This commit is contained in:
@@ -33,6 +33,10 @@ dependencies {
|
||||
implementation( "org.swinglabs.swingx:swingx-beaninfo:1.6.5-1" )
|
||||
implementation( "com.jidesoft:jide-oss:3.6.18" )
|
||||
implementation( "org.netbeans.api:org-openide-awt:RELEASE112" )
|
||||
|
||||
// implementation( "org.pushing-pixels:radiance-substance:2.5.1" )
|
||||
// implementation( "com.weblookandfeel:weblaf-ui:1.2.12" )
|
||||
// implementation( "com.jgoodies:jgoodies-looks:2.7.0" )
|
||||
}
|
||||
|
||||
java {
|
||||
|
||||
@@ -111,6 +111,30 @@ public class FlatTestFrame
|
||||
lafModel.addElement( new LookAndFeelInfo( name, className ) );
|
||||
}
|
||||
|
||||
String substanceClassName = "org.pushingpixels.substance.api.skin.SubstanceGraphiteAquaLookAndFeel";
|
||||
if( SystemInfo.IS_JAVA_9_OR_LATER && isClassAvailable( substanceClassName ) ) {
|
||||
lafModel.addElement( new LookAndFeelInfo( "Substance (F5)", substanceClassName ) );
|
||||
registerSwitchToLookAndFeel( KeyEvent.VK_F5, substanceClassName );
|
||||
}
|
||||
|
||||
String webLafClassName = "com.alee.laf.WebLookAndFeel";
|
||||
if( isClassAvailable( webLafClassName ) ) {
|
||||
lafModel.addElement( new LookAndFeelInfo( "WebLaf (F12)", webLafClassName ) );
|
||||
registerSwitchToLookAndFeel( KeyEvent.VK_F12, webLafClassName );
|
||||
}
|
||||
|
||||
String looksPlasticClassName = "com.jgoodies.looks.plastic.PlasticLookAndFeel";
|
||||
if( isClassAvailable( looksPlasticClassName ) ) {
|
||||
lafModel.addElement( new LookAndFeelInfo( "JGoodies Looks Plastic (F6)", looksPlasticClassName ) );
|
||||
registerSwitchToLookAndFeel( KeyEvent.VK_F6, looksPlasticClassName );
|
||||
}
|
||||
|
||||
String looksWindowsClassName = "com.jgoodies.looks.windows.WindowsLookAndFeel";
|
||||
if( isClassAvailable( looksWindowsClassName ) ) {
|
||||
lafModel.addElement( new LookAndFeelInfo( "JGoodies Looks Windows (F7)", looksWindowsClassName ) );
|
||||
registerSwitchToLookAndFeel( KeyEvent.VK_F7, looksWindowsClassName );
|
||||
}
|
||||
|
||||
lookAndFeelComboBox.setModel( lafModel );
|
||||
|
||||
updateScaleFactorComboBox();
|
||||
@@ -203,6 +227,15 @@ public class FlatTestFrame
|
||||
JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT );
|
||||
}
|
||||
|
||||
private boolean isClassAvailable( String className ) {
|
||||
try {
|
||||
Class.forName( className );
|
||||
return true;
|
||||
} catch( ClassNotFoundException ex ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void showFrame( Supplier<JComponent> contentFactory ) {
|
||||
this.contentFactory = contentFactory;
|
||||
this.content = contentFactory.get();
|
||||
@@ -481,6 +514,7 @@ public class FlatTestFrame
|
||||
null));
|
||||
|
||||
//---- lookAndFeelComboBox ----
|
||||
lookAndFeelComboBox.setMaximumRowCount(20);
|
||||
lookAndFeelComboBox.addActionListener(e -> lookAndFeelChanged());
|
||||
buttonBar.add(lookAndFeelComboBox, "cell 0 0");
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
JFDML JFormDesigner: "7.0.0.0.194" Java: "11.0.2" encoding: "UTF-8"
|
||||
JFDML JFormDesigner: "7.0.0.0.194" Java: "13.0.1" encoding: "UTF-8"
|
||||
|
||||
new FormModel {
|
||||
contentType: "form/swing"
|
||||
@@ -27,6 +27,7 @@ new FormModel {
|
||||
name: "buttonBar"
|
||||
add( new FormComponent( "com.formdev.flatlaf.demo.LookAndFeelsComboBox" ) {
|
||||
name: "lookAndFeelComboBox"
|
||||
"maximumRowCount": 20
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "lookAndFeelChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 0"
|
||||
|
||||
Reference in New Issue
Block a user