OnJava8-Examples/onjava/SwingConsole.java
Bruce Eckel bc0026c3e1 Radically reorganized
Plus many new examples in "streams" chapter.
2015-11-11 20:20:04 -08:00

18 lines
469 B
Java

// onjava/SwingConsole.java
// Tool for running Swing demos from the
// console, both applets and JFrames.
package onjava;
import javax.swing.*;
public class SwingConsole {
public static void
run(final JFrame f, final int width, final int height) {
SwingUtilities.invokeLater(() -> {
f.setTitle(f.getClass().getSimpleName());
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setSize(width, height);
f.setVisible(true);
});
}
}