Package java.lang

Examples of java.lang.Runnable


    /**
     * This test main demonstrates creating figures using this class.
     * @param args not used
     */
    public static void main(String[] args) {
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                final ImageDisplayControlFrame frame = new ImageDisplayControlFrame(null);
                frame.setVisible(true);
                ImageDisplayControl control = frame.getImageDisplayControl();
                DivaMainImageDisplay imageDisplay = control.getImageDisplay();
View Full Code Here


     *
     * @param parent if not null, this frame (JFrame) is ignored (not enabled/disabled)
     */
    public static void showBusy(final Component parent) {
        setBusy(true, parent);
        SwingUtilities.invokeLater(new Runnable() {

            public void run() {
                setBusy(false, parent);
            }
        });
View Full Code Here

    assertEquals("foo", p.deref());
  }

  @Test
  public void threadTest() throws IOException {
    new Thread(new Runnable() {
      public void run() {
        try {
          Thread.sleep(100);
        } catch (InterruptedException e) {
          System.out.println("interrupted");
View Full Code Here

  @Test
  public void timeoutTest() throws IOException {
    assertEquals(null, p.deref(1, TimeUnit.MILLISECONDS));
    assertEquals("failed", p.deref(1, TimeUnit.MILLISECONDS, "failed"));
   
    new Thread(new Runnable() {
      public void run() {
        try {
          Thread.sleep(100);
        } catch (InterruptedException e) {
          System.out.println("interrupted");
View Full Code Here

      }catch(Exception e){}
    }
  }
 
  private void constructGUI(){
    SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                JPanel plosca = new PloscaMain(WIDTH, HEIGHT);
                frame = ustvariOkno("5vVrsto", plosca);
            }
        });
View Full Code Here

  /**
   * Waits until the swing thread has been finished
   */
  public static void waitForSwingThread() {
    invokeAndWait( new Runnable() {
      @Override
      public void run() {
      }
    } );
  }
View Full Code Here

    frame.setLocationRelativeTo( null );
    frame.setDefaultCloseOperation( WindowConstants.DISPOSE_ON_CLOSE );

    frame.setContentPane( contentPane );

    Runnable startFrame = new Runnable() {
      @Override
      public void run() {
        frame.pack();
        frame.setSize( 800, 600 );
        frame.setVisible( true );
      }
    };
    if ( SwingUtilities.isEventDispatchThread() ) {
      startFrame.run();
    } else {
      SwingUtilities.invokeAndWait( startFrame );
    }
    return frame;
  }
View Full Code Here

TOP

Related Classes of java.lang.Runnable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.