Example usage for java.awt Cursor WAIT_CURSOR

List of usage examples for java.awt Cursor WAIT_CURSOR

Introduction

In this page you can find the example usage for java.awt Cursor WAIT_CURSOR.

Prototype

int WAIT_CURSOR

To view the source code for java.awt Cursor WAIT_CURSOR.

Click Source Link

Document

The wait cursor type.

Usage

From source file:org.omegat.gui.main.ProjectUICommands.java

public static void projectSave() {
    UIThreadsUtil.mustBeSwingThread();/*from   w ww  .  j  a  va2  s.c  om*/

    if (!Core.getProject().isProjectLoaded()) {
        return;
    }

    // commit the current entry first
    Core.getEditor().commitAndLeave();

    new SwingWorker<Object, Void>() {
        protected Object doInBackground() throws Exception {
            IMainWindow mainWindow = Core.getMainWindow();
            Cursor hourglassCursor = Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR);
            Cursor oldCursor = mainWindow.getCursor();
            mainWindow.setCursor(hourglassCursor);

            mainWindow.showStatusMessageRB("MW_STATUS_SAVING");

            Core.executeExclusively(true, () -> Core.getProject().saveProject(true));

            mainWindow.showStatusMessageRB("MW_STATUS_SAVED");
            mainWindow.setCursor(oldCursor);
            return null;
        }

        protected void done() {
            try {
                get();
            } catch (Exception ex) {
                processSwingWorkerException(ex, "PP_ERROR_UNABLE_TO_READ_PROJECT_FILE");
            }
        }
    }.execute();
}

From source file:org.pegadi.client.ApplicationLauncher.java

void publicationButton_actionPerformed(ActionEvent e) {
    if (pub == null) {

        this.setCursor(new Cursor(Cursor.WAIT_CURSOR));

        pub = new PublicationControl();

        pub.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
                pub = null;//from   w w w. j  a v a  2 s  .co  m
            }

            public void windowClosed(WindowEvent e) {
                pub = null;
            }
        });

        pub.pack();

        this.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));

        pub.setLocationRelativeTo(this);
    }
    pub.setVisible(true);
}

From source file:de.juwimm.cms.content.panel.PanDocuments.java

private void upload(String prosa, Integer unit, Integer viewComponentId, Integer documentId) {
    this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    JFileChooser fc = new JFileChooser();
    int ff = fc.getChoosableFileFilters().length;
    FileFilter[] fft = fc.getChoosableFileFilters();
    for (int i = 0; i < ff; i++) {
        fc.removeChoosableFileFilter(fft[i]);
    }/*from   w w w . j  av  a  2s.c  om*/
    fc.addChoosableFileFilter(new DocumentFilter());
    fc.setAccessory(new ImagePreview(fc));
    fc.setDialogTitle(prosa);
    fc.setMultiSelectionEnabled(true);
    fc.setCurrentDirectory(Constants.LAST_LOCAL_UPLOAD_DIR);
    int returnVal = fc.showDialog(this, Messages.getString("panel.content.documents.addDocument"));

    if (returnVal == JFileChooser.APPROVE_OPTION) {
        File[] files = fc.getSelectedFiles();
        uploadFiles(files, unit, viewComponentId, documentId);
        Constants.LAST_LOCAL_UPLOAD_DIR = fc.getCurrentDirectory();
    }
    this.setCursor(Cursor.getDefaultCursor());
}

From source file:ome.formats.importer.gui.GuiImporter.java

/**
 * Toggles wait cursor./*w ww .j  a v a  2  s.  c o  m*/
 * 
 * @param wait
 */
public void waitCursor(boolean wait) {
    setCursor(wait ? Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR) : null);
}

From source file:edu.ucla.stat.SOCR.analyses.util.moduls.frm.Panels.Jpan_btn.java

public void doLoad(String action) {

    action1 = "Calculate";

    FitxerDades fitxTmp;/*from ww w .  java2  s.  c  o m*/
    boolean ambDades = false;
    InternalFrameData ifd;
    double minBase;
    MDComputation mdComputation;
    // LOAD
    if (action == "Calculate") {
        if (currentInternalFrame != null)
            currentInternalFrame = null;

        buttonClicked = true;
        // Load data from file
        if (fitx == null) {
            fitxTmp = getFitxerDades1("");
        } else {
            // Last directory
            fitxTmp = getFitxerDades1(fitx.getPath());
        }
        if (fitxTmp == null) {
            // Cancel pressed
            ambDades = false;
        } else {
            fitx = fitxTmp;
            ambDades = true;
        }
    } else if (action == "CalUpdate") {
        // UPDATE        
        buttonClicked = true;

        ifd = currentInternalFrame.getInternalFrameData();
        if ((Jpan_Menu.getTypeData() == ifd.getTypeData()) && (Jpan_Menu.getMethod() == ifd.getMethod())
                && (Jpan_Menu.getPrecision() == ifd.getPrecision())) {
            action = "CalRedraw";
        } else {
            action = "CalReload";
        }
        ambDades = true;
    }
    if (ambDades && (action.equals("Calculate") || action.equals("CalReload"))) {
        try {
            de = new DadesExternes(fitx, "");
            if (action.equals("Calculate")) {
                Jpan_Menu.setPrecision(de.getPrecisio());
            }
            multiDendro = null;
            try {
                multiDendro = de.getMatriuDistancies();
                minBase = Double.MAX_VALUE;
                progressBar.setBorderPainted(true);
                progressBar.setString(null);
                fr.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                // Instances of javax.swing.SwingWorker are not reusable,
                // so we create new instances as needed.
                mdComputation = new MDComputation(action, Jpan_Menu.getTypeData(), Jpan_Menu.getMethod(),
                        Jpan_Menu.getPrecision(), multiDendro.getCardinalitat(), minBase);
                mdComputation.addPropertyChangeListener(this);
                mdComputation.execute();
            } catch (Exception e2) {
                buttonClicked = false;
                showError(e2.getMessage());
            }
        } catch (Exception e1) {
            buttonClicked = false;
            showError(e1.getMessage());
        }
    } else if (ambDades && action.equals("CalRedraw")) {
        showCalls(action);
    } else {
        buttonClicked = false;
    }
}

From source file:org.pegadi.client.ApplicationLauncher.java

void tetrisButton_actionPerformed(ActionEvent e) {
    if (tet == null) {

        this.setCursor(new Cursor(Cursor.WAIT_CURSOR));

        tet = new Tetris();

        tet.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
                tet = null;//from w  w  w. j a  va2 s .  c o m
            }

            public void windowClosed(WindowEvent e) {
                tet = null;
            }
        });

        tet.setSize(750, 550);
        tet.setLocationRelativeTo(this);

        this.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
    }
    tet.setVisible(true);
}

From source file:org.omegat.gui.main.ProjectUICommands.java

public static void projectClose() {
    UIThreadsUtil.mustBeSwingThread();/*from   www .  j a v  a  2 s  .  com*/

    if (!Core.getProject().isProjectLoaded()) {
        return;
    }

    // commit the current entry first
    Core.getEditor().commitAndLeave();

    new SwingWorker<Object, Void>() {
        protected Object doInBackground() throws Exception {
            Core.getMainWindow().showStatusMessageRB("MW_STATUS_SAVING");

            IMainWindow mainWindow = Core.getMainWindow();
            Cursor hourglassCursor = Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR);
            Cursor oldCursor = mainWindow.getCursor();
            mainWindow.setCursor(hourglassCursor);

            Preferences.save();

            Core.executeExclusively(true, () -> {
                Core.getProject().saveProject(true);
                ProjectFactory.closeProject();
            });

            Core.getMainWindow().showStatusMessageRB("MW_STATUS_SAVED");
            mainWindow.setCursor(oldCursor);

            // fix - reset progress bar to defaults
            Core.getMainWindow().showLengthMessage(OStrings.getString("MW_SEGMENT_LENGTH_DEFAULT"));
            Core.getMainWindow()
                    .showProgressMessage(Preferences.getPreferenceEnumDefault(Preferences.SB_PROGRESS_MODE,
                            MainWindowUI.STATUS_BAR_MODE.DEFAULT) == MainWindowUI.STATUS_BAR_MODE.DEFAULT
                                    ? OStrings.getString("MW_PROGRESS_DEFAULT")
                                    : OStrings.getProgressBarDefaultPrecentageText());

            return null;
        }

        protected void done() {
            try {
                get();
            } catch (Exception ex) {
                processSwingWorkerException(ex, "PP_ERROR_UNABLE_TO_READ_PROJECT_FILE");
            }
            // Restore global prefs in case project had project-specific ones
            Core.setFilterMaster(new FilterMaster(Preferences.getFilters()));
            Core.setSegmenter(new Segmenter(Preferences.getSRX()));
        }
    }.execute();
}

From source file:org.graphwalker.GUI.App.java

private void setWaitCursor() {
    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
}

From source file:uk.ac.ox.cbrg.cpfp.uploadapp.UploadApplet.java

private void btnUploadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnUploadActionPerformed

    // Set busy cursor during upload
    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    // Disable all buttons
    btnUpload.setEnabled(false);/*from ww w  . ja v  a2  s .  com*/
    btnAdd.setEnabled(false);
    btnDel.setEnabled(false);

    // Upload in SwingWorker background thread
    task = new UploadTask(uploadFiles);
    task.addPropertyChangeListener(this);
    task.execute();

    return;
}

From source file:uk.chromis.pos.forms.JRootApp.java

/**
 *
 */
@Override
public void waitCursorBegin() {
    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
}