List of usage examples for java.awt Cursor WAIT_CURSOR
int WAIT_CURSOR
To view the source code for java.awt Cursor WAIT_CURSOR.
Click Source Link
From source file:com.projity.reports.view.ReportView.java
private void showReport() { documentFrame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); try {//w ww .j a v a 2s. com makeViewer(); } catch (JRException e) { System.out.println(e.getMessage()); e.printStackTrace(); } documentFrame.setCursor(Cursor.getDefaultCursor()); }
From source file:com.wet.wired.jsr.recorder.JRecorder.java
public void beginWaitForBackgroundProcesses() { control.setEnabled(false);/*from w w w . j a va 2 s.co m*/ player.setEnabled(false); this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); }
From source file:org.omegat.gui.main.ProjectUICommands.java
public static void projectCreateMED() { UIThreadsUtil.mustBeSwingThread();//www .j a va 2s . c o m if (!Core.getProject().isProjectLoaded()) { return; } // commit the current entry first Core.getEditor().commitAndLeave(); // ask for new MED file ChooseMedProject ndm = new ChooseMedProject(); // default name String zipName = null; try { File origin = ProjectMedProcessing.getOriginMedFile(Core.getProject().getProjectProperties()); if (origin != null) { zipName = origin.getName(); } } catch (Exception ex) { } if (zipName == null) { zipName = Core.getProject().getProjectProperties().getProjectName() + "-MED.zip"; } ndm.setSelectedFile( new File(Core.getProject().getProjectProperties().getProjectRootDir().getParentFile(), zipName)); int ndmResult = ndm.showSaveDialog(Core.getMainWindow().getApplicationFrame()); if (ndmResult != OmegaTFileChooser.APPROVE_OPTION) { // user press 'Cancel' in project creation dialog return; } // add .zip extension if there is no final File med = ndm.getSelectedFile().getName().toLowerCase().endsWith(".zip") ? ndm.getSelectedFile() : new File(ndm.getSelectedFile().getAbsolutePath() + ".zip"); 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); try { Core.getProject().compileProject(".*"); } catch (Exception ex) { throw new RuntimeException(ex); } }); ProjectMedProcessing.createMed(med, Core.getProject().getProjectProperties()); mainWindow.showStatusMessageRB("MW_STATUS_SAVED"); mainWindow.setCursor(oldCursor); return null; } protected void done() { try { get(); SwingUtilities.invokeLater(Core.getEditor()::requestFocus); } catch (Exception ex) { Log.logErrorRB(ex, "PP_ERROR_UNABLE_TO_READ_PROJECT_FILE"); Core.getMainWindow().displayErrorRB(ex, "PP_ERROR_UNABLE_TO_READ_PROJECT_FILE"); } } }.execute(); }
From source file:com.floreantpos.config.ui.DatabaseConfigurationDialog.java
public void actionPerformed(ActionEvent e) { try {// ww w .j a v a 2 s . c o m String command = e.getActionCommand(); Database selectedDb = (Database) databaseCombo.getSelectedItem(); final String providerName = selectedDb.getProviderName(); final String databaseURL = tfServerAddress.getText(); final String databasePort = tfServerPort.getText(); final String databaseName = tfDatabaseName.getText(); final String user = tfUserName.getText(); final String pass = new String(tfPassword.getPassword()); final String connectionString = selectedDb.getConnectString(databaseURL, databasePort, databaseName); final String hibernateDialect = selectedDb.getHibernateDialect(); final String driverClass = selectedDb.getHibernateConnectionDriverClass(); if (CANCEL.equalsIgnoreCase(command)) { dispose(); return; } setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); Application.getInstance().setSystemInitialized(false); saveConfig(selectedDb, providerName, databaseURL, databasePort, databaseName, user, pass, connectionString, hibernateDialect); if (TEST.equalsIgnoreCase(command)) { try { DatabaseUtil.checkConnection(connectionString, hibernateDialect, driverClass, user, pass); } catch (DatabaseConnectionException e1) { JOptionPane.showMessageDialog(this, Messages.getString("DatabaseConfigurationDialog.32")); //$NON-NLS-1$ return; } connectionSuccess = true; JOptionPane.showMessageDialog(this, Messages.getString("DatabaseConfigurationDialog.31")); //$NON-NLS-1$ } else if (UPDATE_DATABASE.equals(command)) { int i = JOptionPane.showConfirmDialog(this, Messages.getString("DatabaseConfigurationDialog.0"), //$NON-NLS-1$ Messages.getString("DatabaseConfigurationDialog.1"), JOptionPane.YES_NO_OPTION); //$NON-NLS-1$ if (i != JOptionPane.YES_OPTION) { return; } //isAuthorizedToPerformDbChange(); setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); boolean databaseUpdated = DatabaseUtil.updateDatabase(connectionString, hibernateDialect, driverClass, user, pass); if (databaseUpdated) { connectionSuccess = true; JOptionPane.showMessageDialog(DatabaseConfigurationDialog.this, Messages.getString("DatabaseConfigurationDialog.2")); //$NON-NLS-1$ } else { JOptionPane.showMessageDialog(DatabaseConfigurationDialog.this, Messages.getString("DatabaseConfigurationDialog.3")); //$NON-NLS-1$ } } else if (CREATE_DATABASE.equals(command)) { int i = JOptionPane.showConfirmDialog(this, Messages.getString("DatabaseConfigurationDialog.33"), //$NON-NLS-1$ Messages.getString("DatabaseConfigurationDialog.34"), JOptionPane.YES_NO_OPTION); //$NON-NLS-1$ if (i != JOptionPane.YES_OPTION) { return; } i = JOptionPane.showConfirmDialog(this, Messages.getString("DatabaseConfigurationDialog.4"), //$NON-NLS-1$ Messages.getString("DatabaseConfigurationDialog.5"), JOptionPane.YES_NO_OPTION); //$NON-NLS-1$ boolean generateSampleData = false; if (i == JOptionPane.YES_OPTION) generateSampleData = true; setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); String createDbConnectString = selectedDb.getCreateDbConnectString(databaseURL, databasePort, databaseName); boolean databaseCreated = DatabaseUtil.createDatabase(createDbConnectString, hibernateDialect, driverClass, user, pass, generateSampleData); if (databaseCreated) { JOptionPane.showMessageDialog(DatabaseConfigurationDialog.this, Messages.getString("DatabaseConfigurationDialog.6") + //$NON-NLS-1$ Messages.getString("DatabaseConfigurationDialog.7")); //$NON-NLS-1$ Main.restart(); connectionSuccess = true; } else { JOptionPane.showMessageDialog(DatabaseConfigurationDialog.this, Messages.getString("DatabaseConfigurationDialog.36")); //$NON-NLS-1$ } } else if (SAVE.equalsIgnoreCase(command)) { if (connectionSuccess) { Application.getInstance().initializeSystem(); } dispose(); } } catch (Exception e2) { PosLog.error(getClass(), e2); POSMessageDialog.showMessage(this, e2.getMessage()); } finally { setCursor(Cursor.getDefaultCursor()); } }
From source file:edu.scripps.fl.pubchem.xmltool.gui.PubChemXMLCreatorGUI.java
public void mouseClicked(MouseEvent e) { try {/*from ww w. ja va 2 s.c o m*/ if (e.getClickCount() > 0) { setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); if (e.getSource() == jtpExample) { URL url = getClass().getClassLoader().getResource("ExampleExcel.xlsx"); File tmpFile = File.createTempFile("example", ".xlsx"); FileUtils.copyURLToFile(url, tmpFile); tmpFile.deleteOnExit(); Desktop.getDesktop().open(tmpFile); } else if (e.getSource() == jtpExcelTemplate) { File saveFile = gc.fileChooser(jtfFileExcel, ".xlsx", "save"); if (saveFile != null) { URL url = getClass().getClassLoader().getResource("ExcelTemplate_withBAO.xlsx"); OutputStream out = new FileOutputStream(saveFile, true); IOUtils.copy(url.openStream(), out); String output = FilenameUtils.concat(FilenameUtils.getFullPath(saveFile.toString()), FilenameUtils.getBaseName(saveFile.toString())); Desktop.getDesktop().open(new File(saveFile.toString())); } } else if (e.getSource() == jtfFileTemplate && jtfFileTemplate.getText().equals(template)) { jtfFileTemplate.setText(""); } else if (e.getSource() == this) { if (jtfFileTemplate.getText().equals("")) { jtfFileTemplate.setText(template); } } } setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } catch (Throwable throwable) { SwingGUI.handleError(this, throwable); } }
From source file:com.evanbelcher.DrillBook.display.DBMenuBar.java
/** * On any menu item click.//from w ww.jav a 2s. c om */ @Override public void actionPerformed(ActionEvent arg0) { State.print(arg0.getActionCommand()); switch (arg0.getActionCommand()) { case "new": //Try to save work, open new show try { newShow(); } catch (InterruptedException e) { e.printStackTrace(); } break; case "open": //Try to save work, get new show openShow(); break; case "save": Main.save(); break; case "saveas": try { saveAs(); } catch (InterruptedException e) { e.printStackTrace(); } break; case "printpage": try { desktop.setCursor(new Cursor(Cursor.WAIT_CURSOR)); desktop.printCurrentPageToPdf(); desktop.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } catch (IOException e) { e.printStackTrace(); } break; case "printshow": try { desktop.setCursor(new Cursor(Cursor.WAIT_CURSOR)); desktop.printAllPagesToPdf(); desktop.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } catch (IOException e) { e.printStackTrace(); } break; case "printdotsheets": try { desktop.setCursor(new Cursor(Cursor.WAIT_CURSOR)); new DotSheetMaker().printDotSheets(); desktop.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } catch (InterruptedException e) { e.printStackTrace(); } break; case "togglegrid": Main.getState().getSettings().setShowGrid(!Main.getState().getSettings().shouldShowGrid()); ((JMenu) getComponent(2)).getMenuComponent(0) .setForeground(Main.getState().getSettings().shouldShowGrid() ? Color.BLACK : Color.RED); break; case "togglenames": Main.getState().getSettings().setShowNames(!Main.getState().getSettings().shouldShowNames()); ((JMenu) getComponent(2)).getMenuComponent(1) .setForeground(Main.getState().getSettings().shouldShowNames() ? Color.BLACK : Color.RED); break; case "toggletext": Main.getState().getSettings().setShowText(!Main.getState().getSettings().shouldShowText()); ((JMenu) getComponent(2)).getMenuComponent(2) .setForeground(Main.getState().getSettings().shouldShowText() ? Color.BLACK : Color.RED); break; case "colordots": Main.getState().getSettings().setColorDots(!Main.getState().getSettings().shouldColorDots()); ((JMenu) getComponent(2)).getMenuComponent(3) .setForeground(Main.getState().getSettings().shouldColorDots() ? Color.BLACK : Color.RED); break; case "changehash": Main.getState().getSettings().setCollegeHashes(!Main.getState().getSettings().useCollegeHashes()); ((JMenuItem) (((JMenu) getComponent(2)).getMenuComponent(4))) .setText(Main.getState().getSettings().useCollegeHashes() ? "Change to High School Hashes" : "Change to College Hashes"); try { desktop.getImage(); } catch (IOException e) { e.printStackTrace(); } desktop.getDotDataFrame().updatePosition(); break; case "fontsize": changeFontSize(); break; case "play": play(); break; case "undo": Main.getState().undo(); desktop.getIO().clearActivePoints(); desktop.getDotDataFrame().updateAll(desktop.getActivePoints()); break; case "redo": Main.getState().redo(); desktop.getIO().clearActivePoints(); desktop.getDotDataFrame().updateAll(desktop.getActivePoints()); break; case "help": help(); break; case "about": about(); break; case "quit": default: gr.dispatchEvent(new WindowEvent(gr, WindowEvent.WINDOW_CLOSING)); } desktop.getIO().fixControl(); }
From source file:com.floreantpos.config.ui.DatabaseConfigurationView.java
public void actionPerformed(ActionEvent e) { try {/*from w w w.ja v a 2 s. c om*/ String command = e.getActionCommand(); Database selectedDb = (Database) databaseCombo.getSelectedItem(); String providerName = selectedDb.getProviderName(); String databaseURL = tfServerAddress.getText(); String databasePort = tfServerPort.getText(); String databaseName = tfDatabaseName.getText(); String user = tfUserName.getText(); String pass = new String(tfPassword.getPassword()); String connectionString = selectedDb.getConnectString(databaseURL, databasePort, databaseName); String hibernateDialect = selectedDb.getHibernateDialect(); String driverClass = selectedDb.getHibernateConnectionDriverClass(); if (TEST.equalsIgnoreCase(command)) { Application.getInstance().setSystemInitialized(false); saveConfig(selectedDb, providerName, databaseURL, databasePort, databaseName, user, pass, connectionString, hibernateDialect); try { DatabaseUtil.checkConnection(connectionString, hibernateDialect, driverClass, user, pass); } catch (DatabaseConnectionException e1) { JOptionPane.showMessageDialog(this, Messages.getString("DatabaseConfigurationDialog.32")); //$NON-NLS-1$ return; } JOptionPane.showMessageDialog(POSUtil.getBackOfficeWindow(), Messages.getString("DatabaseConfigurationDialog.31")); //$NON-NLS-1$ } else if (CONFIGURE_DB.equals(command)) { Application.getInstance().setSystemInitialized(false); int i = JOptionPane.showConfirmDialog(POSUtil.getBackOfficeWindow(), Messages.getString("DatabaseConfigurationDialog.33"), //$NON-NLS-1$ Messages.getString("DatabaseConfigurationDialog.34"), JOptionPane.YES_NO_OPTION); //$NON-NLS-1$ if (i != JOptionPane.YES_OPTION) { return; } i = JOptionPane.showConfirmDialog(POSUtil.getBackOfficeWindow(), Messages.getString("DatabaseConfigurationView.3"), //$NON-NLS-1$ Messages.getString("DatabaseConfigurationView.4"), JOptionPane.YES_NO_OPTION); //$NON-NLS-1$ boolean generateSampleData = false; if (i == JOptionPane.YES_OPTION) generateSampleData = true; saveConfig(selectedDb, providerName, databaseURL, databasePort, databaseName, user, pass, connectionString, hibernateDialect); String connectionString2 = selectedDb.getCreateDbConnectString(databaseURL, databasePort, databaseName); this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); boolean createDatabase = DatabaseUtil.createDatabase(connectionString2, hibernateDialect, driverClass, user, pass, generateSampleData); this.setCursor(Cursor.getDefaultCursor()); if (createDatabase) { //JOptionPane.showMessageDialog(DatabaseConfigurationView.this, Messages.getString("DatabaseConfigurationDialog.35")); //$NON-NLS-1$ JOptionPane.showMessageDialog(POSUtil.getBackOfficeWindow(), "Database created. Default password is 1111.\n\nThe system will now restart."); //$NON-NLS-1$ Main.restart(); } else { JOptionPane.showMessageDialog(POSUtil.getBackOfficeWindow(), Messages.getString("DatabaseConfigurationDialog.36")); //$NON-NLS-1$ } } else if (SAVE.equalsIgnoreCase(command)) { Application.getInstance().setSystemInitialized(false); saveConfig(selectedDb, providerName, databaseURL, databasePort, databaseName, user, pass, connectionString, hibernateDialect); } else if (CANCEL.equalsIgnoreCase(command)) { } } catch (Exception e2) { POSMessageDialog.showMessage(com.floreantpos.util.POSUtil.getBackOfficeWindow(), e2.getMessage()); } }
From source file:grisu.frontend.view.swing.jobmonitoring.single.appSpecific.Gold.java
private JButton getBtnHistory() { if (btnHistory == null) { btnHistory = new JButton("History"); btnHistory.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); File temp;//from w w w . j a va 2 s .co m try { temp = downloadJobStatusFile(); } catch (final FileTransactionException e1) { final ErrorInfo ei = new ErrorInfo("Download error", "Error while trying to download job status file.", e1.getLocalizedMessage(), (String) null, e1, Level.SEVERE, (Map) null); JXErrorPane.showDialog(Gold.this.getPanel(), ei); return; } final JobStatusFileDialog dialog = new JobStatusFileDialog(); dialog.setFileManagerAndUrl(fm, job_status_url); dialog.setFile(null, temp); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); dialog.setVisible(true); } }); } return btnHistory; }
From source file:grisu.frontend.view.swing.files.preview.fileViewers.JobStatusGridFileViewer.java
private JCheckBox getChckbxShowMinutes() { if (chckbxShowMinutes == null) { chckbxShowMinutes = new JCheckBox("Display minutes"); chckbxShowMinutes.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (chckbxShowMinutes.isSelected()) { showMinutes = true;/*from w w w .j a v a 2 s .c o m*/ } else { showMinutes = false; } new Thread() { @Override public void run() { chckbxShowMinutes.setEnabled(false); setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); generateGraph(); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); chckbxShowMinutes.setEnabled(true); } }.start(); } }); } return chckbxShowMinutes; }
From source file:org.roche.antibody.ui.components.AntibodyEditorPane.java
public void setModel(Antibody ab) { mainEditor.getFrame().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); this.antibody = ab; this.graphSyncer = new GraphSynchronizer(mainEditor, this, ab); createGraph();/*from w w w . j ava 2 s. com*/ updateHELMTextArea(); mainEditor.reset(); mainEditor.getFrame().setCursor(Cursor.getDefaultCursor()); updateGraphLayout(); isBackToDomainEditorEnabled = false; }