OnJava8-Examples/ui/SubmitSwingProgram.java

25 lines
696 B
Java
Raw Normal View History

2015-09-07 11:44:36 -06:00
// ui/SubmitSwingProgram.java
2015-11-14 16:18:05 -08:00
// <20>2016 MindView LLC: see Copyright.txt
2015-06-15 17:47:35 -07:00
import javax.swing.*;
import java.util.concurrent.*;
public class SubmitSwingProgram extends JFrame {
JLabel label;
public SubmitSwingProgram() {
super("Hello Swing");
label = new JLabel("A Label");
add(label);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(300, 100);
setVisible(true);
}
static SubmitSwingProgram ssp;
public static void main(String[] args) throws Exception {
SwingUtilities.invokeLater(() ->
ssp = new SubmitSwingProgram());
TimeUnit.SECONDS.sleep(1);
SwingUtilities.invokeLater(() ->
ssp.label.setText("Hey! This is Different!"));
}
2015-09-07 11:44:36 -06:00
}