Demo: missing SwingUtilities.invokeLater() added

This commit is contained in:
Karl Tauber
2019-10-23 09:03:08 +02:00
parent 72e8ab70a3
commit 06766cb4db
8 changed files with 52 additions and 35 deletions

View File

@@ -26,8 +26,10 @@ public class FlatChooserTest
extends JPanel extends JPanel
{ {
public static void main( String[] args ) { public static void main( String[] args ) {
SwingUtilities.invokeLater( () -> {
FlatTestFrame frame = FlatTestFrame.create( args, "FlatChooserTest" ); FlatTestFrame frame = FlatTestFrame.create( args, "FlatChooserTest" );
frame.showFrame( new FlatChooserTest() ); frame.showFrame( new FlatChooserTest() );
} );
} }
FlatChooserTest() { FlatChooserTest() {

View File

@@ -27,8 +27,10 @@ public class FlatComponents2Test
extends JPanel extends JPanel
{ {
public static void main( String[] args ) { public static void main( String[] args ) {
SwingUtilities.invokeLater( () -> {
FlatTestFrame frame = FlatTestFrame.create( args, "FlatComponents2Test" ); FlatTestFrame frame = FlatTestFrame.create( args, "FlatComponents2Test" );
frame.showFrame( new FlatComponents2Test() ); frame.showFrame( new FlatComponents2Test() );
} );
} }
FlatComponents2Test() { FlatComponents2Test() {

View File

@@ -28,8 +28,10 @@ public class FlatComponentsTest
extends JPanel extends JPanel
{ {
public static void main( String[] args ) { public static void main( String[] args ) {
SwingUtilities.invokeLater( () -> {
FlatTestFrame frame = FlatTestFrame.create( args, "FlatComponentsTest" ); FlatTestFrame frame = FlatTestFrame.create( args, "FlatComponentsTest" );
frame.showFrame( new FlatComponentsTest() ); frame.showFrame( new FlatComponentsTest() );
} );
} }
FlatComponentsTest() { FlatComponentsTest() {

View File

@@ -17,8 +17,10 @@ public class FlatContainerTest
extends JPanel extends JPanel
{ {
public static void main( String[] args ) { public static void main( String[] args ) {
SwingUtilities.invokeLater( () -> {
FlatTestFrame frame = FlatTestFrame.create( args, "FlatContainerTest" ); FlatTestFrame frame = FlatTestFrame.create( args, "FlatContainerTest" );
frame.showFrame( new FlatContainerTest() ); frame.showFrame( new FlatContainerTest() );
} );
} }
public FlatContainerTest() { public FlatContainerTest() {

View File

@@ -29,8 +29,10 @@ public class FlatMenusTest
extends JPanel extends JPanel
{ {
public static void main( String[] args ) { public static void main( String[] args ) {
SwingUtilities.invokeLater( () -> {
FlatTestFrame frame = FlatTestFrame.create( args, "FlatMenusTest" ); FlatTestFrame frame = FlatTestFrame.create( args, "FlatMenusTest" );
frame.showFrame( new FlatMenusTest() ); frame.showFrame( new FlatMenusTest() );
} );
} }
FlatMenusTest() { FlatMenusTest() {

View File

@@ -30,8 +30,10 @@ public class FlatOptionPaneTest
extends JPanel extends JPanel
{ {
public static void main( String[] args ) { public static void main( String[] args ) {
SwingUtilities.invokeLater( () -> {
FlatTestFrame frame = FlatTestFrame.create( args, "FlatOptionPaneTest" ); FlatTestFrame frame = FlatTestFrame.create( args, "FlatOptionPaneTest" );
frame.showFrame( new FlatOptionPaneTest() ); frame.showFrame( new FlatOptionPaneTest() );
} );
} }
FlatOptionPaneTest() { FlatOptionPaneTest() {

View File

@@ -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,6 +33,7 @@ public class FlatLafDemo
static Preferences prefs; static Preferences prefs;
public static void main( String[] args ) { public static void main( String[] args ) {
SwingUtilities.invokeLater( () -> {
prefs = Preferences.userRoot().node( PREFS_ROOT_PATH ); prefs = Preferences.userRoot().node( PREFS_ROOT_PATH );
// set look and feel // set look and feel
@@ -56,5 +58,6 @@ public class FlatLafDemo
frame.pack(); frame.pack();
frame.setLocationRelativeTo( null ); frame.setLocationRelativeTo( null );
frame.setVisible( true ); frame.setVisible( true );
} );
} }
} }

View File

@@ -31,9 +31,11 @@ public class FlatSwingXTest
extends JPanel extends JPanel
{ {
public static void main( String[] args ) { public static void main( String[] args ) {
SwingUtilities.invokeLater( () -> {
FlatTestFrame frame = FlatTestFrame.create( args, "FlatSwingXTest" ); FlatTestFrame frame = FlatTestFrame.create( args, "FlatSwingXTest" );
frame.useApplyComponentOrientation = true; frame.useApplyComponentOrientation = true;
frame.showFrame( new FlatSwingXTest() ); frame.showFrame( new FlatSwingXTest() );
} );
} }
FlatSwingXTest() { FlatSwingXTest() {