import gui.*; import java.awt.*; import javax.swing.*; public class Main { static class MyThread implements Runnable { public void run() { createGUI(); } } static class Thread2 implements Runnable { public void run() { for(int i = 0; i < 10; i++) { System.out.println(i); try { Thread.sleep(1000); } catch (InterruptedException e) { return; } } } } public static void main(String[] args) { Thread thread = new Thread(new MyThread()); Thread thread1 = new Thread(new Thread2()); thread.start(); thread1.start(); //createGUI(); } public static void createGUI() { JFrame frame = new JFrame("Title"); Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); int width = 800; int height = 500; frame.setVisible(true); frame.setResizable(false); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); frame.setBounds(d.width/2 - width/2, d.height/2 - height/2, width, height); frame.add(new MyPanel()); } }