Google+ Followers

Connect

Get Updates Via Email

Enter your email address:

Delivered by FeedBurner

Sunday, 10 November 2013

Java Program: Thread in swing implements Runnable interface and SwingUtilities

Program
import javax.swing.*;
public class SwingThread extends JFrame {
    public static void main(String[] args) {
    SwingUtilities.invokeLater(new Runnable() {
      @Override
      public void run() {
        final JFrame f = new JFrame("Swing using Thread Frame 1");
        f.setSize(600, 400);
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.setVisible(true);
     
        final JFrame fr = new JFrame("Swing using Thread Frame 2");
        fr.setSize(600, 600);
        fr.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        fr.setVisible(true);
      }
    });
    }
 

}

Output:


1 comment :

  1. I have read your blog its very attractive and impressive. I like it your blog.

    Java Online Training Java EE Online Training Java EE Online Training Java 8 online training Core Java 8 online training

    Java Online Training from India Java Online Training from India Core Java Training Online Core Java Training Online Java Training InstitutesJava Training Institutes

    ReplyDelete

Share this to your friends