ex3

不知道对错

import java.util.concurrent.TimeUnit;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.SwingUtilities;

public class ex3 {

    public static void main(String[] args) throws Exception {

        JLabel label =new JLabel("a label");
        JFrame frame=new JFrame();
        frame.add(label);
        SwingConsole sc ;
        sc = new SwingConsole();
        SwingUtilities.invokeLater(new Runnable() {
            public void run(){
                sc.run(frame, 300, 100);
            }
        });

        TimeUnit.SECONDS.sleep(1);

        SwingUtilities.invokeLater(new Runnable(){
            public void run(){
                label.setText("hahaha");
            }
        });


    }
}

你可能感兴趣的:(ex3)