Example usage for java.awt EventQueue invokeLater

List of usage examples for java.awt EventQueue invokeLater

Introduction

In this page you can find the example usage for java.awt EventQueue invokeLater.

Prototype

public static void invokeLater(Runnable runnable) 

Source Link

Document

Causes runnable to have its run method called in the #isDispatchThread dispatch thread of Toolkit#getSystemEventQueue the system EventQueue .

Usage

From source file:ProgressMonitorTest.java

public static void main(String[] args) {
    EventQueue.invokeLater(new Runnable() {
        public void run() {
            JFrame frame = new ProgressMonitorFrame();
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setVisible(true);//from ww  w .  j  a va 2 s.  co  m
        }
    });
}

From source file:LongListTest.java

public static void main(String[] args) {
    EventQueue.invokeLater(new Runnable() {
        public void run() {
            JFrame frame = new LongListFrame();
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setVisible(true);/*from ww w.ja v  a2 s .co  m*/
        }
    });
}

From source file:SliderTest.java

public static void main(String[] args) {
    EventQueue.invokeLater(new Runnable() {
        public void run() {
            SliderTestFrame frame = new SliderTestFrame();
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setVisible(true);//from ww w  .  j a  va  2  s .co m
        }
    });
}

From source file:ListTest.java

public static void main(String[] args) {
    EventQueue.invokeLater(new Runnable() {
        public void run() {
            JFrame frame = new ListFrame();
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setVisible(true);//  ww  w .j a va2 s.co  m
        }
    });
}

From source file:id.aas.apps.mvc.view.pieChart.java

public static void main(String[] args) throws SQLException {
    //        pieChart p = new pieChart();
    //        p.setVisible(true);
    //        p.run();
    EventQueue.invokeLater(new Runnable() {
        @Override/*www . ja  va2s  .com*/
        public void run() {
            try {
                int nilaiKiloan = 0;
                int nilaiSatuan = 0;

                pieChart frame = new pieChart();
                frame.setVisible(true);
                String queryKiloan = "SELECT COUNT(*) FROM laundry WHERE jenis_layanan='Laundry Kiloan'";
                String querySatuan = "SELECT COUNT(*) FROM laundry WHERE jenis_layanan='Laundry Satuan'";
                ConnectionDB.InstanceDB.openConnection();
                ResultSet rs = ConnectionDB.InstanceDB.RunSelectQuery(queryKiloan);
                while (rs.next()) {
                    nilaiKiloan = rs.getInt(1);
                }
                System.out.println(nilaiKiloan);

                ResultSet rs1 = ConnectionDB.InstanceDB.RunSelectQuery(querySatuan);
                while (rs1.next()) {
                    nilaiSatuan = rs1.getInt(1);
                }
                System.out.println(nilaiSatuan);
                DefaultPieDataset pieDataset = new DefaultPieDataset();
                pieDataset.setValue("Laundry Kiloan", nilaiKiloan);
                pieDataset.setValue("Laundry Satuan", nilaiSatuan);

                JFreeChart chart = ChartFactory.createPieChart3D("Perbandingan Pengguna Layanan Laundry",
                        pieDataset, true, true, false);
                ChartPanel cPanel = new ChartPanel(chart);
                frame.setContentPane(cPanel);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });
}

From source file:org.jfree.chart.demo.Display.java

/**
 * Launch the application./*from ww w  .  j  av a  2 s  .c  o  m*/
 */
public static void main(String[] args) throws IOException {

    EventQueue.invokeLater(new Runnable() {
        public void run() {
            try {
                Display window = new Display();
                window.frame.setVisible(true);
            } catch (Exception e) {
                e.printStackTrace();
            }
            ////////////
        }
    });

    try {

        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        String s;
        File dataFile = new File("data.txt");
        FileWriter fw = new FileWriter(dataFile);
        BufferedWriter bw = new BufferedWriter(fw);
        DataParser datIn = new DataParser(effectiveX, effectiveY);

        //while(!enabled){}//spin until enabled

        while ((s = in.readLine()) != null && s.length() != 0 && enabled) {
            // System.out.println(s);
            if (datIn.parseString(s)) {
                bw.write(s);
                bw.write('\n');
                bw.flush();
                panel_1.plotCoords(datIn.getX(), datIn.getFlippedY());
                TimeElapsed.setText(Double.toString(datIn.getTime()));
            }
        }

        bw.close();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

}

From source file:Main.java

public static void main(String[] args) {
    EventQueue.invokeLater(new Runnable() {
        public void run() {
            JFrame frame = new ProgressBarFrame();
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setVisible(true);/*from   w w w .  j a  v  a  2 s  .  c  o m*/
        }
    });
}

From source file:ViewDB.java

 public static void main(String[] args)
{
   EventQueue.invokeLater(new Runnable()
      {//from w  ww .  j  ava  2 s . c  om
         public void run()
         {
            JFrame frame = new ViewDBFrame();
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setVisible(true);
         }
      });
}

From source file:GridBagLayoutTest.java

public static void main(String[] args) {
    EventQueue.invokeLater(new Runnable() {
        public void run() {
            FontFrame frame = new FontFrame();
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setVisible(true);/*from   www  .  j  a v  a2 s.  c om*/
        }
    });
}

From source file:Bounce.java

public static void main(String[] args) {
    EventQueue.invokeLater(new Runnable() {
        public void run() {
            JFrame frame = new BounceFrame();
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setVisible(true);/*from  w  w  w . j a v a  2  s .com*/
        }
    });
}