Example usage for java.awt EventQueue isDispatchThread

List of usage examples for java.awt EventQueue isDispatchThread

Introduction

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

Prototype

public static boolean isDispatchThread() 

Source Link

Document

Returns true if the calling thread is Toolkit#getSystemEventQueue the current AWT EventQueue 's dispatch thread.

Usage

From source file:erigo.filepump.FilePump.java

public void updateNumFiles_EDT() {
    if (EventQueue.isDispatchThread()) {
        fileCountLabel.setText(Integer.toString(fileCount));
    }
}

From source file:erigo.filepump.FilePump.java

private void resetGUI_EDT() {
    if (EventQueue.isDispatchThread()) {
        // Signal FilePumpWorker to turn off
        bPumpRunning = false;// www .jav a 2 s.  co m
        fileCount = 0;
        // Leave the final file count displayed
        // updateNumFiles_EDT();
        // Change label back to "Start pump"
        actionButton.setText("Start pump");
        actionButton.setBackground(Color.GREEN);
    }
}

From source file:org.argouml.application.Main.java

/**
 * Create and display a splash screen.//from   w  ww .  j  a va 2  s  .c o m
 * @return the splash screen
 */
private static SplashScreen initializeSplash() {
    SplashScreen splash = new SplashScreen();
    splash.setVisible(true);
    // On uniprocessors wait until we're sure the splash screen
    // has been painted so that we aren't competing for resources
    if (!EventQueue.isDispatchThread() && Runtime.getRuntime().availableProcessors() == 1) {
        synchronized (splash) {
            while (!splash.isPaintCalled()) {
                try {
                    splash.wait();
                } catch (InterruptedException e) {
                }
            }
        }
    }
    return splash;
}

From source file:net.sf.nmedit.jsynth.clavia.nordmodular.NordModular.java

public void comUpdateStatus() {
    if (EventQueue.isDispatchThread()) {
        __comUpdateStatusImpl();//  ww w.jav  a2 s .c  o  m
    } else {
        EventQueue.invokeLater(new Runnable() {
            public void run() {
                __comUpdateStatusImpl();
            }
        });
    }
}

From source file:org.fhcrc.cpl.viewer.quant.gui.QuantitationReviewer.java

/**
 * Set status message.  Separate thread necessary or UI hangs
 * @param message//  w  w  w . ja  v a  2 s.c  o m
 */
public void setMessage(String message) {
    if (EventQueue.isDispatchThread()) {
        if (null == message || 0 == message.length())
            message = " ";
        messageLabel.setText(message);
    } else {
        final String msg = message;
        EventQueue.invokeLater(new Runnable() {
            public void run() {
                setMessage(msg);
            }
        });
    }
}

From source file:org.fhcrc.cpl.viewer.quant.gui.ProteinQuantSummaryFrame.java

License:asdf

/**
 * Set status message.  Separate thread necessary or UI hangs
 * @param message//  www . jav a2 s.c  om
 */
public void setMessage(String message) {
    if (EventQueue.isDispatchThread()) {
        if (null == message || 0 == message.length())
            message = " ";
        if (message.length() > 500)
            message = message.substring(0, 500);
        messageLabel.setText(message);
    } else {
        final String msg = message;
        EventQueue.invokeLater(new Runnable() {
            public void run() {
                setMessage(msg);
            }
        });
    }
    statusPanel.updateUI();
}

From source file:org.bitbucket.mlopatkin.android.logviewer.ConfigurationDialog.java

public static void showConfigurationDialog(Frame owner) {
    assert EventQueue.isDispatchThread();
    ConfigurationDialog dialog = new ConfigurationDialog(owner);
    dialog.setVisible(true);/*  w ww . j  a v a 2  s.  c o m*/
}

From source file:org.eclipse.jubula.rc.swing.components.AUTSwingHierarchy.java

/**
 * Checks whether the current thread is the dispatch thread, and logs an
 * error if it is not./*w  w w .  ja  v a  2s. c o  m*/
 */
private void checkDispatchThread() {
    if (!EventQueue.isDispatchThread()) {
        // throw and catch an exception so we can get a stack trace
        try {
            throw new Exception();
        } catch (Exception e) {
            log.error(
                    "Method called outside of the dispatch thread. This may indicate a potential error in the AUT.", //$NON-NLS-1$
                    e);
        }
    }
}

From source file:org.genedb.jogra.plugins.TermRationaliser.java

public JFrame makeWindow() {
    System.err.println("Am I on EDT '" + EventQueue.isDispatchThread() + "'  x");
    JFrame lookup = Jogra.findNamedWindow(WINDOW_TITLE);
    if (lookup == null) {
        lookup = getMainPanel();/* ww w  .  j a va2  s.c o m*/
    } else {
        initModels();
        lookup.pack();
        lookup.repaint();
    }
    //lookup = getMainPanel(); //Always getting a new frame since it has to pick up variable organism (improve efficiency later: NDS)
    return lookup;
}