List of usage examples for java.lang Runnable Runnable
Runnable
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);/* w w w.j ava2s .c o 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);//from w w w. java 2s .co m } }); }
From source file:gtu.xml.xstream.iisi.MQDecodeUI.java
/** * Auto-generated main method to display this JFrame *//* ww w . j a va 2s. co m*/ public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { MQDecodeUI inst = new MQDecodeUI(); inst.setLocationRelativeTo(null); gtu.swing.util.JFrameUtil.setVisible(true, inst); } }); }
From source file:PipedCharacters.java
public static void main(String[] args) { try {//from ww w . j a v a 2s. co m final PipedWriter out = new PipedWriter(); final PipedReader in = new PipedReader(out); Runnable runA = new Runnable() { public void run() { writeStuff(out); } }; Thread threadA = new Thread(runA, "threadA"); threadA.start(); Runnable runB = new Runnable() { public void run() { readStuff(in); } }; Thread threadB = new Thread(runB, "threadB"); threadB.start(); } catch (IOException x) { x.printStackTrace(); } }
From source file:mini_mirc_client.Mini_mirc_client.java
public static void main(String[] args) { try {// w ww. j a v a 2 s. c o m TTransport transport; transport = new TSocket("localhost", 2121); TProtocol protocol = new TBinaryProtocol(transport); miniIRC.Client client = new miniIRC.Client(protocol); Runnable updateThread; updateThread = new Runnable() { public void run() { try { while (update) { Thread.sleep(3000); synchronized (transport) { transport.open(); updateMsg(client); transport.close(); } } } catch (Exception E) { E.printStackTrace(); } } }; new Thread(updateThread).start(); perform(transport, client); } catch (Exception E) { E.printStackTrace(); } }
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/* ww w.j a v a 2s .c o m*/ 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 w w w . j a va 2 s . c om*/ */ 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 ww w.j av a 2 s. c om } }); }
From source file:ViewDB.java
public static void main(String[] args) { EventQueue.invokeLater(new Runnable() {/* ww w.jav a 2 s . co m*/ 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 ww w . j av a 2 s . co m*/ } }); }