List of usage examples for java.lang Runnable Runnable
Runnable
From source file:br.com.lnprojetos.springbootswing.ui.MDIApplication.java
/** * @param args the command line arguments *///from w ww . jav a2 s . c o m public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(MDIApplication.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(MDIApplication.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(MDIApplication.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(MDIApplication.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new MDIApplication().setVisible(true); } }); }
From source file:brainflow.app.toplevel.BrainFlow.java
public static void main(String[] args) { final BrainFlow bflow = get(); //Class myClass = BrainFlow.class; //URL url = myClass.getResource("BrainFlow.class"); //System.out.println("class located: " + url); SwingUtilities.invokeLater(new Runnable() { public void run() { try { log.info("Launching BrainFlow ..."); bflow.launch();//from www . ja v a 2 s . c o m } catch (Throwable e) { Logger.getAnonymousLogger().severe("Error Launching BrainFlow, exiting"); e.printStackTrace(); System.exit(-1); } } }); }
From source file:ModalMessage.java
public static void main(String args[]) { final ModalMessage mm = new ModalMessage("duh\nduh\nduh", false); SwingUtilities.invokeLater(new Runnable() { public void run() { mm.setVisible(true);/*from w w w .j a v a 2 s .c o m*/ } }); SwingUtilities.invokeLater(new Runnable() { public void run() { mm.appendText("another line"); mm.setEnabled(true); } }); }
From source file:com.lcdfx.pipoint.PiPoint.java
public static void main(final String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException { SwingUtilities.invokeLater(new Runnable() { public void run() { JFrame frame = new PiPoint(args); frame.setTitle(APPLICATION_NAME); frame.setIconImage(/*from ww w. ja v a 2 s. com*/ new ImageIcon(PiPoint.class.getResource("/resources/pipoint_icon.png")).getImage()); frame.pack(); frame.setVisible(true); } }); }
From source file:com.cloudera.beeswax.Server.java
public static void main(String[] args) throws TTransportException, MetaException, ParseException { parseArgs(args);// w ww . j av a2 s.c o m createDirectoriesAsNecessary(); // Start metastore if specified if (mport != -1) { LOG.info("Starting metastore at port " + mport); Thread t = new Thread(new Runnable() { @Override public void run() { try { serveMeta(mport); } catch (TTransportException e) { e.printStackTrace(); } catch (MetaException e) { e.printStackTrace(); } } }, "MetaServerThread"); t.setDaemon(true); t.start(); } // Serve beeswax out of the main thread. LOG.info("Starting beeswaxd at port " + bport); serveBeeswax(bport); }
From source file:ch.ethz.dcg.jukefox.cli.CliJukefoxApplication.java
public static void main(String[] args) { CommandLineParser parser = new PosixParser(); LogLevel logLevel = LogLevel.ERROR;/*from w w w. j a v a 2 s .co m*/ try { CommandLine line = parser.parse(getCliOptions(), args); if (line.hasOption(VERBOSE_OPTION)) { logLevel = LogLevel.VERBOSE; } } catch (ParseException e1) { Log.e(TAG, "Unexpected exception: " + e1.getMessage()); } printWelcome(); Log.setLogLevel(logLevel); // Send logs async new Thread(new Runnable() { @Override public void run() { playerModel.getLogManager().sendLogs(); } }).start(); CliJukefoxApplication application = new CliJukefoxApplication(); try { scanner = new Scanner(System.in); application.start(); ImportState importState = libraryImportManager.getImportState(); importState.addListener(application); //System.out.println(importState.getProgress().getStatusMessage()); while (running) { String next = scanner.nextLine(); if (next.isEmpty()) { continue; } try { application.getCommandLineInterface().execute(next); } catch (ExecutionException e) { System.out.println("Invalid input, please use following commands: "); application.getCommandLineInterface().execute("help"); } } } catch (ExecutionException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
From source file:ObjectFIFOTest.java
public static void main(String[] args) { final ObjectFIFO fifo = new ObjectFIFO(5); Runnable fullCheckRunnable = new Runnable() { public void run() { fullCheck(fifo);/*from w w w.j a v a 2 s .c o m*/ } }; Thread fullCheckThread = new Thread(fullCheckRunnable, "fchk"); fullCheckThread.setPriority(9); fullCheckThread.setDaemon(true); // die automatically fullCheckThread.start(); Runnable emptyCheckRunnable = new Runnable() { public void run() { emptyCheck(fifo); } }; Thread emptyCheckThread = new Thread(emptyCheckRunnable, "echk"); emptyCheckThread.setPriority(8); emptyCheckThread.setDaemon(true); // die automatically emptyCheckThread.start(); Runnable consumerRunnable = new Runnable() { public void run() { consumer(fifo); } }; Thread consumerThread = new Thread(consumerRunnable, "cons"); consumerThread.setPriority(7); consumerThread.start(); Runnable producerRunnable = new Runnable() { public void run() { producer(fifo); } }; Thread producerThread = new Thread(producerRunnable, "prod"); producerThread.setPriority(6); producerThread.start(); }
From source file:OilDrop.GraphTest.java
/** * @param args the command line arguments *//*from w ww.j a v a2 s . co m*/ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(GraphTest.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(GraphTest.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(GraphTest.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(GraphTest.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new GraphTest().setVisible(true); } }); }
From source file:BrokerFrame.java
/** * @param args the command line arguments *//*ww w . jav a 2s . c o m*/ public static void main(String args[]) throws Exception { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(BrokerFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(BrokerFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(BrokerFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(BrokerFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> String ola = new String(); ola = "olajjhgjhhjkhjkhjhkjhjhgg"; RSA rs = new RSA(); rs.generateKeys(); System.out.println((RSA.privKey).toString()); byte[] signature = rs.encrypt(ola, RSA.privKey); String sig = new Base64().encodeAsString(signature); byte[] byt = new Base64().decode(sig); System.out.println(sig); try { rs.verifySignature(ola.getBytes(), signature); } catch (Exception e) { throw new Exception(e); } /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new BrokerFrame().setVisible(true); } }); }
From source file:AmazonKinesisAuditVerify.java
public static void main(String[] args) throws IOException { EventQueue.invokeLater(new Runnable() { public void run() { try { AmazonKinesisAuditVerify window = new AmazonKinesisAuditVerify(); //window.frame.setVisible(true); } catch (Exception e) { e.printStackTrace();//w w w . j a va2s. c o m } } }); init(); /* if (args.length == 1 && "delete-resources".equals(args[0])) { deleteResources(); return; } String workerId = InetAddress.getLocalHost().getCanonicalHostName() + ":" + UUID.randomUUID(); KinesisClientLibConfiguration kinesisClientLibConfiguration = new KinesisClientLibConfiguration(SAMPLE_APPLICATION_NAME, SAMPLE_APPLICATION_STREAM_NAME, credentialsProvider, workerId); kinesisClientLibConfiguration.withInitialPositionInStream(SAMPLE_APPLICATION_INITIAL_POSITION_IN_STREAM); IRecordProcessorFactory recordProcessorFactory = new AmazonKinesisApplicationRecordProcessorFactory(); Worker worker = new Worker(recordProcessorFactory, kinesisClientLibConfiguration); System.out.printf("Running %s to process stream %s as worker %s...\n", SAMPLE_APPLICATION_NAME, SAMPLE_APPLICATION_STREAM_NAME, workerId); int exitCode = 0; try { worker.run(); } catch (Throwable t) { System.err.println("Caught throwable while processing data."); t.printStackTrace(); exitCode = 1; } System.exit(exitCode); */ String propertiesFile = null; if (args.length > 1) { System.err.println("Usage: java " + AmazonKinesisAuditVerify.class.getName() + " <propertiesFile>"); System.exit(1); } else if (args.length == 1) { propertiesFile = args[0]; } configure(propertiesFile); System.out.println("Starting " + applicationName); LOG.info("Running " + applicationName + " to process stream " + streamName); IRecordProcessorFactory recordProcessorFactory = new AmazonKinesisAuditRecordProcessorFactory(); Worker worker = new Worker(recordProcessorFactory, kinesisClientLibConfiguration); int exitCode = 0; try { worker.run(); } catch (Throwable t) { LOG.error("Caught throwable while processing data.", t); exitCode = 1; } System.exit(exitCode); }