Example usage for java.lang Runnable Runnable

List of usage examples for java.lang Runnable Runnable

Introduction

In this page you can find the example usage for java.lang Runnable Runnable.

Prototype

Runnable

Source Link

Usage

From source file:jboost.visualization.HistogramFrame.java

public static void main(String[] args) {

    boolean carryOver = false;

    if (args.length == 0) {
        System.out.println("Please call this from the python wrapper instead");
        System.exit(-1);// w  w w.jav a  2 s  .c  om
    }

    // check carryOver flag
    if (Integer.parseInt(args[0]) != 0) {
        carryOver = true;
    }
    int offset = 1;

    // get test files
    int numTestFiles = Integer.parseInt(args[offset++]);
    String[] testFiles = new String[numTestFiles];
    if (numTestFiles == 0) {
        System.out.println("Error: Cannot find *.test.boosting.info");
        System.exit(-1);
    }
    for (int i = 0; i < numTestFiles; i++)
        testFiles[i] = args[offset + i];

    // get train files
    offset = offset + numTestFiles;
    int numTrainFiles = Integer.parseInt(args[offset++]);
    String[] trainFiles = new String[numTrainFiles];
    for (int i = 0; i < numTrainFiles; i++)
        trainFiles[i] = args[offset + i];

    // get info files
    offset = offset + numTrainFiles;
    int numInfoFiles = Integer.parseInt(args[offset++]);
    String[] infoFiles = new String[numInfoFiles];

    for (int i = 0; i < numInfoFiles; i++)
        infoFiles[i] = args[offset + i];

    // create the info parser
    infoParser = new InfoParser(testFiles, trainFiles, infoFiles, carryOver);

    SwingUtilities.invokeLater(new Runnable() {

        public void run() {
            try {
                HistogramFrame inst = new HistogramFrame();
                inst.setLocationRelativeTo(null);
                inst.setVisible(true);
            } catch (IOException e) {
                e.printStackTrace();
            } catch (RuntimeException e) {
                e.printStackTrace();
                System.exit(-1);
            }
        }
    });
}

From source file:di.uniba.it.tee2.wiki.Wikidump2IndexMT.java

/**
 * language xml_dump output_dir n_thread encoding
 *
 * @param args the command line arguments
 *//* w  w  w .j  av  a 2  s . c  o m*/
public static void main(String[] args) {
    try {
        CommandLine cmd = cmdParser.parse(options, args);
        if (cmd.hasOption("l") && cmd.hasOption("d") && cmd.hasOption("o")) {
            encoding = cmd.getOptionValue("e", "UTF-8");
            minTextLegth = Integer.parseInt(cmd.getOptionValue("m", "4000"));
            /*if (cmd.hasOption("p")) {
             pageLimit = Integer.parseInt(cmd.getOptionValue("p"));
             }*/
            int nt = Integer.parseInt(cmd.getOptionValue("n", "2"));
            Wikidump2IndexMT builder = new Wikidump2IndexMT();
            builder.init(cmd.getOptionValue("l"), cmd.getOptionValue("o"), nt);
            //attach a shutdown hook
            Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {

                @Override
                public void run() {
                    try {
                        Wikidump2IndexMT.tee.close();
                    } catch (Exception ex) {
                        Logger.getLogger(Wikidump2IndexMT.class.getName()).log(Level.SEVERE, null, ex);
                    }
                }
            }));
            builder.build(cmd.getOptionValue("d"), cmd.getOptionValue("l"));
        } else {
            HelpFormatter helpFormatter = new HelpFormatter();
            helpFormatter.printHelp("Index Wikipedia dump (multi threads)", options, true);
        }
    } catch (Exception ex) {
        Logger.getLogger(Wikidump2IndexMT.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:TrackFocusDemo.java

public static void main(String[] args) {
    //Schedule a job for the event-dispatching thread:
    //creating and showing this application's GUI.
    javax.swing.SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            createAndShowGUI();/*from w  w  w  .  j a va  2  s  .  c o m*/
        }
    });
}

From source file:FocusTraversalDemo.java

public static void main(String[] args) {
    /* Use an appropriate Look and Feel */
    try {//from ww w  . j  av a  2 s  .c  om
        // UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
        // UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
        UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
    } catch (UnsupportedLookAndFeelException ex) {
        ex.printStackTrace();
    } catch (IllegalAccessException ex) {
        ex.printStackTrace();
    } catch (InstantiationException ex) {
        ex.printStackTrace();
    } catch (ClassNotFoundException ex) {
        ex.printStackTrace();
    }
    /* Turn off metal's use of bold fonts */
    UIManager.put("swing.boldMetal", Boolean.FALSE);

    // Schedule a job for the event-dispatching thread:
    // creating and showing this application's GUI.
    javax.swing.SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            createAndShowGUI();
        }
    });
}

From source file:teambootje.A6.java

/**
 * @param args the command line arguments
 *//*from ww w  .  j  a v 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(A6.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
    } catch (InstantiationException ex) {
        java.util.logging.Logger.getLogger(A6.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
    } catch (IllegalAccessException ex) {
        java.util.logging.Logger.getLogger(A6.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
    } catch (javax.swing.UnsupportedLookAndFeelException ex) {
        java.util.logging.Logger.getLogger(A6.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 A6().setVisible(true);
        }
    });
}

From source file:teambootje.A3.java

/**
 * @param args the command line arguments
 *//* www  .jav a 2  s  . com*/
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(A3.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
    } catch (InstantiationException ex) {
        java.util.logging.Logger.getLogger(A3.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
    } catch (IllegalAccessException ex) {
        java.util.logging.Logger.getLogger(A3.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
    } catch (javax.swing.UnsupportedLookAndFeelException ex) {
        java.util.logging.Logger.getLogger(A3.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 A3().setVisible(true);
        }
    });
}

From source file:com.yosanai.java.aws.console.AWSConsole.java

/**
 * @param args/*from  ww  w  . ja  va 2 s . c om*/
 *            the command line arguments
 */
public static void main(String args[]) {
    java.awt.EventQueue.invokeLater(new Runnable() {
        public void run() {
            AWSConsole console = new AWSConsole();
            console.setExtendedState(JFrame.MAXIMIZED_BOTH);
            console.pack();
            console.setVisible(true);
        }
    });
}

From source file:it.isislab.dmason.tools.batch.BatchWizard.java

/**
 * Launch the application.//w w w .j a v  a  2s. c om
 */
public static void main(String[] args) {
    EventQueue.invokeLater(new Runnable() {
        @Override
        public void run() {
            try {
                BatchWizard frame = new BatchWizard();
                frame.setVisible(true);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });
}

From source file:events.FocusEventDemo.java

public static void main(String[] args) {
    /* Use an appropriate Look and Feel */
    try {//w  w w  . j  a  v a2s  .  c om
        //UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
        UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
    } catch (UnsupportedLookAndFeelException ex) {
        ex.printStackTrace();
    } catch (IllegalAccessException ex) {
        ex.printStackTrace();
    } catch (InstantiationException ex) {
        ex.printStackTrace();
    } catch (ClassNotFoundException ex) {
        ex.printStackTrace();
    }

    /* Turn off metal's use of bold fonts */
    UIManager.put("swing.boldMetal", Boolean.FALSE);
    //Schedule a job for the event dispatch thread:
    //creating and showing this application's GUI.
    javax.swing.SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            createAndShowGUI();
        }
    });
}