mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-13 15:27:16 -06:00
Demo: missing SwingUtilities.invokeLater() added
This commit is contained in:
@@ -26,8 +26,10 @@ public class FlatChooserTest
|
|||||||
extends JPanel
|
extends JPanel
|
||||||
{
|
{
|
||||||
public static void main( String[] args ) {
|
public static void main( String[] args ) {
|
||||||
FlatTestFrame frame = FlatTestFrame.create( args, "FlatChooserTest" );
|
SwingUtilities.invokeLater( () -> {
|
||||||
frame.showFrame( new FlatChooserTest() );
|
FlatTestFrame frame = FlatTestFrame.create( args, "FlatChooserTest" );
|
||||||
|
frame.showFrame( new FlatChooserTest() );
|
||||||
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
FlatChooserTest() {
|
FlatChooserTest() {
|
||||||
|
|||||||
@@ -27,8 +27,10 @@ public class FlatComponents2Test
|
|||||||
extends JPanel
|
extends JPanel
|
||||||
{
|
{
|
||||||
public static void main( String[] args ) {
|
public static void main( String[] args ) {
|
||||||
FlatTestFrame frame = FlatTestFrame.create( args, "FlatComponents2Test" );
|
SwingUtilities.invokeLater( () -> {
|
||||||
frame.showFrame( new FlatComponents2Test() );
|
FlatTestFrame frame = FlatTestFrame.create( args, "FlatComponents2Test" );
|
||||||
|
frame.showFrame( new FlatComponents2Test() );
|
||||||
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
FlatComponents2Test() {
|
FlatComponents2Test() {
|
||||||
|
|||||||
@@ -28,8 +28,10 @@ public class FlatComponentsTest
|
|||||||
extends JPanel
|
extends JPanel
|
||||||
{
|
{
|
||||||
public static void main( String[] args ) {
|
public static void main( String[] args ) {
|
||||||
FlatTestFrame frame = FlatTestFrame.create( args, "FlatComponentsTest" );
|
SwingUtilities.invokeLater( () -> {
|
||||||
frame.showFrame( new FlatComponentsTest() );
|
FlatTestFrame frame = FlatTestFrame.create( args, "FlatComponentsTest" );
|
||||||
|
frame.showFrame( new FlatComponentsTest() );
|
||||||
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
FlatComponentsTest() {
|
FlatComponentsTest() {
|
||||||
|
|||||||
@@ -17,8 +17,10 @@ public class FlatContainerTest
|
|||||||
extends JPanel
|
extends JPanel
|
||||||
{
|
{
|
||||||
public static void main( String[] args ) {
|
public static void main( String[] args ) {
|
||||||
FlatTestFrame frame = FlatTestFrame.create( args, "FlatContainerTest" );
|
SwingUtilities.invokeLater( () -> {
|
||||||
frame.showFrame( new FlatContainerTest() );
|
FlatTestFrame frame = FlatTestFrame.create( args, "FlatContainerTest" );
|
||||||
|
frame.showFrame( new FlatContainerTest() );
|
||||||
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
public FlatContainerTest() {
|
public FlatContainerTest() {
|
||||||
|
|||||||
@@ -29,8 +29,10 @@ public class FlatMenusTest
|
|||||||
extends JPanel
|
extends JPanel
|
||||||
{
|
{
|
||||||
public static void main( String[] args ) {
|
public static void main( String[] args ) {
|
||||||
FlatTestFrame frame = FlatTestFrame.create( args, "FlatMenusTest" );
|
SwingUtilities.invokeLater( () -> {
|
||||||
frame.showFrame( new FlatMenusTest() );
|
FlatTestFrame frame = FlatTestFrame.create( args, "FlatMenusTest" );
|
||||||
|
frame.showFrame( new FlatMenusTest() );
|
||||||
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
FlatMenusTest() {
|
FlatMenusTest() {
|
||||||
|
|||||||
@@ -30,8 +30,10 @@ public class FlatOptionPaneTest
|
|||||||
extends JPanel
|
extends JPanel
|
||||||
{
|
{
|
||||||
public static void main( String[] args ) {
|
public static void main( String[] args ) {
|
||||||
FlatTestFrame frame = FlatTestFrame.create( args, "FlatOptionPaneTest" );
|
SwingUtilities.invokeLater( () -> {
|
||||||
frame.showFrame( new FlatOptionPaneTest() );
|
FlatTestFrame frame = FlatTestFrame.create( args, "FlatOptionPaneTest" );
|
||||||
|
frame.showFrame( new FlatOptionPaneTest() );
|
||||||
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
FlatOptionPaneTest() {
|
FlatOptionPaneTest() {
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
package com.formdev.flatlaf.demo;
|
package com.formdev.flatlaf.demo;
|
||||||
|
|
||||||
import java.util.prefs.Preferences;
|
import java.util.prefs.Preferences;
|
||||||
|
import javax.swing.SwingUtilities;
|
||||||
import javax.swing.UIManager;
|
import javax.swing.UIManager;
|
||||||
import com.formdev.flatlaf.FlatLightLaf;
|
import com.formdev.flatlaf.FlatLightLaf;
|
||||||
|
|
||||||
@@ -32,29 +33,31 @@ public class FlatLafDemo
|
|||||||
static Preferences prefs;
|
static Preferences prefs;
|
||||||
|
|
||||||
public static void main( String[] args ) {
|
public static void main( String[] args ) {
|
||||||
prefs = Preferences.userRoot().node( PREFS_ROOT_PATH );
|
SwingUtilities.invokeLater( () -> {
|
||||||
|
prefs = Preferences.userRoot().node( PREFS_ROOT_PATH );
|
||||||
|
|
||||||
// set look and feel
|
// set look and feel
|
||||||
try {
|
try {
|
||||||
if( args.length > 0 )
|
if( args.length > 0 )
|
||||||
UIManager.setLookAndFeel( args[0] );
|
UIManager.setLookAndFeel( args[0] );
|
||||||
else {
|
else {
|
||||||
String lafClassName = prefs.get( KEY_LAF, FlatLightLaf.class.getName() );
|
String lafClassName = prefs.get( KEY_LAF, FlatLightLaf.class.getName() );
|
||||||
UIManager.setLookAndFeel( lafClassName );
|
UIManager.setLookAndFeel( lafClassName );
|
||||||
|
}
|
||||||
|
} catch( Exception ex ) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
|
||||||
|
// fallback
|
||||||
|
FlatLightLaf.install();
|
||||||
}
|
}
|
||||||
} catch( Exception ex ) {
|
|
||||||
ex.printStackTrace();
|
|
||||||
|
|
||||||
// fallback
|
// create frame
|
||||||
FlatLightLaf.install();
|
DemoFrame frame = new DemoFrame();
|
||||||
}
|
|
||||||
|
|
||||||
// create frame
|
// show frame
|
||||||
DemoFrame frame = new DemoFrame();
|
frame.pack();
|
||||||
|
frame.setLocationRelativeTo( null );
|
||||||
// show frame
|
frame.setVisible( true );
|
||||||
frame.pack();
|
} );
|
||||||
frame.setLocationRelativeTo( null );
|
|
||||||
frame.setVisible( true );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,9 +31,11 @@ public class FlatSwingXTest
|
|||||||
extends JPanel
|
extends JPanel
|
||||||
{
|
{
|
||||||
public static void main( String[] args ) {
|
public static void main( String[] args ) {
|
||||||
FlatTestFrame frame = FlatTestFrame.create( args, "FlatSwingXTest" );
|
SwingUtilities.invokeLater( () -> {
|
||||||
frame.useApplyComponentOrientation = true;
|
FlatTestFrame frame = FlatTestFrame.create( args, "FlatSwingXTest" );
|
||||||
frame.showFrame( new FlatSwingXTest() );
|
frame.useApplyComponentOrientation = true;
|
||||||
|
frame.showFrame( new FlatSwingXTest() );
|
||||||
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
FlatSwingXTest() {
|
FlatSwingXTest() {
|
||||||
|
|||||||
Reference in New Issue
Block a user