OnJava8-Examples/net/mindview/util/SwingConsole.java

19 lines
539 B
Java
Raw Normal View History

2015-04-20 15:36:01 -07:00
//: net/mindview/util/SwingConsole.java
2015-05-29 14:18:51 -07:00
// <20>2015 MindView LLC: see Copyright.txt
2015-04-20 15:36:01 -07:00
// Tool for running Swing demos from the
// console, both applets and JFrames.
package net.mindview.util;
import javax.swing.*;
public class SwingConsole {
public static void
run(final JFrame f, final int width, final int height) {
2015-05-05 14:05:39 -07:00
SwingUtilities.invokeLater(() -> {
f.setTitle(f.getClass().getSimpleName());
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setSize(width, height);
f.setVisible(true);
2015-04-20 15:36:01 -07:00
});
}
} ///:~