List of usage examples for java.awt Cursor getDefaultCursor
public static Cursor getDefaultCursor()
From source file:org.jhotdraw.samples.svg.figures.SVGImage.java
@Override public Cursor getCursor(Point2D.Double p) { return Cursor.getDefaultCursor(); }
From source file:com.mirth.connect.client.ui.AttachmentExportDialog.java
private void export() { if (StringUtils.isBlank(fileField.getText())) { PlatformUI.MIRTH_FRAME.alertError(this, "Please fill in required fields."); fileField.setBackground(UIConstants.INVALID_COLOR); return;/* w ww.j a v a 2s .co m*/ } else { fileField.setBackground(Color.white); } if (PlatformUI.MIRTH_FRAME.messageBrowser.getSelectedMimeType().equalsIgnoreCase("dicom")) { PlatformUI.MIRTH_FRAME.alertError(this, "Cannot export DICOM attachments."); return; } doExport(); setVisible(false); setCursor(Cursor.getDefaultCursor()); }
From source file:EditorPaneExample9.java
public EditorPaneExample9() { super("JEditorPane Example 9"); pane = new JEditorPane(); pane.setEditable(false); // Read-only getContentPane().add(new JScrollPane(pane), "Center"); // Build the panel of controls JPanel panel = new JPanel(); panel.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.gridwidth = 1;/*from w w w . j a v a 2s . c o m*/ c.gridheight = 1; c.anchor = GridBagConstraints.EAST; c.fill = GridBagConstraints.NONE; c.weightx = 0.0; c.weighty = 0.0; JLabel urlLabel = new JLabel("URL: ", JLabel.RIGHT); panel.add(urlLabel, c); JLabel loadingLabel = new JLabel("State: ", JLabel.RIGHT); c.gridy = 1; panel.add(loadingLabel, c); JLabel typeLabel = new JLabel("Type: ", JLabel.RIGHT); c.gridy = 2; panel.add(typeLabel, c); c.gridy = 3; panel.add(new JLabel(LOAD_TIME), c); c.gridy = 4; c.gridwidth = 2; c.weightx = 1.0; c.anchor = GridBagConstraints.WEST; onlineLoad = new JCheckBox("Online Load"); panel.add(onlineLoad, c); onlineLoad.setSelected(true); onlineLoad.setForeground(typeLabel.getForeground()); c.gridx = 1; c.gridy = 0; c.anchor = GridBagConstraints.EAST; c.fill = GridBagConstraints.HORIZONTAL; textField = new JTextField(32); panel.add(textField, c); loadingState = new JLabel(spaces, JLabel.LEFT); loadingState.setForeground(Color.black); c.gridy = 1; panel.add(loadingState, c); loadedType = new JLabel(spaces, JLabel.LEFT); loadedType.setForeground(Color.black); c.gridy = 2; panel.add(loadedType, c); timeLabel = new JLabel(""); c.gridy = 3; panel.add(timeLabel, c); getContentPane().add(panel, "South"); // Change page based on text field textField.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { String url = textField.getText(); try { // Check if the new page and the old // page are the same. URL newURL = new URL(url); URL loadedURL = pane.getPage(); if (loadedURL != null && loadedURL.sameFile(newURL)) { return; } // Try to display the page textField.setEnabled(false); // Disable input textField.paintImmediately(0, 0, textField.getSize().width, textField.getSize().height); setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); // Busy cursor loadingState.setText("Loading..."); loadingState.paintImmediately(0, 0, loadingState.getSize().width, loadingState.getSize().height); loadedType.setText(""); loadedType.paintImmediately(0, 0, loadedType.getSize().width, loadedType.getSize().height); timeLabel.setText(""); timeLabel.paintImmediately(0, 0, timeLabel.getSize().width, timeLabel.getSize().height); startTime = System.currentTimeMillis(); // Choose the loading method if (onlineLoad.isSelected()) { // Usual load via setPage pane.setPage(url); loadedType.setText(pane.getContentType()); } else { pane.setContentType("text/html"); loadedType.setText(pane.getContentType()); if (loader == null) { loader = new HTMLDocumentLoader(); } HTMLDocument doc = loader.loadDocument(new URL(url)); loadComplete(); pane.setDocument(doc); displayLoadTime(); } } catch (Exception e) { System.out.println(e); JOptionPane.showMessageDialog(pane, new String[] { "Unable to open file", url }, "File Open Error", JOptionPane.ERROR_MESSAGE); loadingState.setText("Failed"); textField.setEnabled(true); setCursor(Cursor.getDefaultCursor()); } } }); // Listen for page load to complete pane.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals("page")) { loadComplete(); displayLoadTime(); } } }); }
From source file:com.mirth.connect.client.ui.MessageExportDialog.java
private void export() { String errorMessage = messageExportPanel.validate(true); if (StringUtils.isNotEmpty(errorMessage)) { parent.alertError(this, errorMessage); return;//from w w w .j ava 2 s.c o m } int exportCount = 0; MessageWriterOptions writerOptions = messageExportPanel.getMessageWriterOptions(); if (StringUtils.isBlank(writerOptions.getRootFolder())) { parent.alertError(parent, "Please enter a valid root path to store exported files."); setVisible(true); return; } setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); try { if (messageExportPanel.isExportLocal()) { PaginatedMessageList messageList = new PaginatedMessageList(); messageList.setChannelId(channelId); messageList.setClient(parent.mirthClient); messageList.setMessageFilter(messageFilter); messageList.setPageSize(pageSize); messageList.setIncludeContent(true); writerOptions.setBaseFolder(SystemUtils.getUserHome().getAbsolutePath()); MessageWriter messageWriter = MessageWriterFactory.getInstance().getMessageWriter(writerOptions, encryptor); AttachmentSource attachmentSource = null; if (writerOptions.includeAttachments()) { attachmentSource = new AttachmentSource() { @Override public List<Attachment> getMessageAttachments(Message message) throws ClientException { return PlatformUI.MIRTH_FRAME.mirthClient .getAttachmentsByMessageId(message.getChannelId(), message.getMessageId()); } }; } try { exportCount = new MessageExporter().exportMessages(messageList, messageWriter, attachmentSource); messageWriter.finishWrite(); } finally { messageWriter.close(); } } else { writerOptions.setIncludeAttachments(messageExportPanel.isIncludeAttachments()); exportCount = parent.mirthClient.exportMessagesServer(channelId, messageFilter, pageSize, writerOptions); } setVisible(false); setCursor(Cursor.getDefaultCursor()); parent.alertInformation(parent, exportCount + " message" + ((exportCount == 1) ? " has" : "s have") + " been successfully exported to: " + writerOptions.getRootFolder()); } catch (Exception e) { setCursor(Cursor.getDefaultCursor()); Throwable cause = (e.getCause() == null) ? e : e.getCause(); parent.alertThrowable(parent, cause); } }
From source file:ste.travian.gui.WorldController.java
/** * Shows the map chart/*from w w w . ja va 2s . c o m*/ */ public void showMap() { mainWindow.setCursor(new Cursor(Cursor.WAIT_CURSOR)); executor.execute(new Runnable() { public void run() { try { load(); mainWindow.showMap(getWorldPanel()); // // do not move the line below, it needs to be here so // that all components will have the wait cursor set // mainWindow.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); } catch (Exception e) { mainWindow.setCursor(Cursor.getDefaultCursor()); mainWindow.error("Error creating the map", e); } } }); }
From source file:EditorPaneExample9.java
public void loadComplete() { loadingState.setText("Page loaded."); textField.setEnabled(true); // Allow entry of new URL setCursor(Cursor.getDefaultCursor()); }
From source file:ome.formats.importer.gui.FileQueueHandler.java
private void addEnabled(boolean enabled) { if (enabled)/*w ww . j av a 2 s .c o m*/ viewer.setCursor(Cursor.getDefaultCursor()); else viewer.setCursor(java.awt.Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); qTable.addBtn.setEnabled(enabled); qTable.removeBtn.setEnabled(enabled); }
From source file:org.languagetool.gui.ResultAreaHelper.java
@Override public void languageToolEventOccurred(LanguageToolEvent event) { if (event.getType() == LanguageToolEvent.Type.CHECKING_STARTED) { Language lang = ltSupport.getLanguage(); String langName;/* ww w . j a v a 2 s.c om*/ if (lang.isExternal()) { langName = lang.getTranslatedName(messages) + Main.EXTERNAL_LANGUAGE_SUFFIX; } else { langName = lang.getTranslatedName(messages); } String msg = org.languagetool.tools.Tools.i18n(messages, "startChecking", langName) + "..."; setHeader(msg); setMain(EMPTY_PARA); if (event.getCaller() == this) { statusPane.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); } } else if (event.getType() == LanguageToolEvent.Type.CHECKING_FINISHED) { setRunTime(event.getElapsedTime()); String inputText = event.getSource().getTextComponent().getText(); displayResult(inputText, event.getSource().getMatches()); if (event.getCaller() == this) { statusPane.setCursor(Cursor.getDefaultCursor()); } } else if (event.getType() == LanguageToolEvent.Type.RULE_DISABLED || event.getType() == LanguageToolEvent.Type.RULE_ENABLED) { String inputText = event.getSource().getTextComponent().getText(); displayResult(inputText, event.getSource().getMatches()); } }
From source file:com.tascape.qa.th.android.tools.UiAutomatorViewer.java
private void launchApp() { try {/* w w w . j a va 2 s . co m*/ jd.setCursor(new Cursor(Cursor.WAIT_CURSOR)); String serial = ((String) this.jcbDevices.getSelectedItem()); Adb adb = new Adb(serial.split(":")[0]); device = new UiAutomatorDevice(); device.setAdb(adb); device.setProductDetail(serial); device.start(); this.setDevice(device); this.launch(); } catch (Throwable ex) { LOG.error("Error", ex); JOptionPane.showMessageDialog(jbLaunch.getTopLevelAncestor(), "Cannot start app"); return; } finally { jd.setCursor(Cursor.getDefaultCursor()); } int debugMinutes = (int) jsDebugMinutes.getValue(); jd.dispose(); try { this.interactManually(debugMinutes); } catch (Throwable ex) { LOG.error("Error", ex); System.exit(1); } finally { System.exit(0); } }
From source file:ffx.ui.UIDataConverter.java
/** * Converts the data structure to MolecularAssembly(s). *///from w w w . java2 s .com public void convert() { if (timer) { startTimer(); } FFXSystem ffxSystem = null; // Continue if the file was read in successfully. if (conversionFilter.convert()) { ffxSystem = (FFXSystem) conversionFilter.getActiveMolecularSystem(); if (!(conversionFilter instanceof BiojavaFilter)) { Utilities.biochemistry(ffxSystem, conversionFilter.getAtomList()); } conversionFilter.applyAtomProperties(); // Add the system to the multiscale hierarchy. mainPanel.getHierarchy().addSystemNode(ffxSystem); ForceFieldEnergy energy = new ForceFieldEnergy(ffxSystem, conversionFilter.getCoordRestraints()); ffxSystem.setPotential(energy); mainPanel.getHierarchy().setActive(ffxSystem); // Check if there are alternate conformers if (conversionFilter instanceof BiojavaFilter) { BiojavaFilter biojFilter = (BiojavaFilter) conversionFilter; List<Character> altLocs = biojFilter.getAltLocs(); if (altLocs.size() > 1 || altLocs.get(0) != ' ') { StringBuilder altLocString = new StringBuilder("\n Alternate locations found [ "); for (Character c : altLocs) { // Do not report the root conformer. if (c == ' ') { continue; } altLocString.append(String.format("(%s) ", c)); } altLocString.append("]\n"); logger.info(altLocString.toString()); } /** * Alternate conformers may have different chemistry, so they * each need to be their own FFX system. */ for (Character c : altLocs) { if (c.equals(' ') || c.equals('A')) { continue; } FFXSystem newSystem = new FFXSystem(ffxSystem.getFile(), "Alternate Location " + c, ffxSystem.getProperties()); newSystem.setForceField(ffxSystem.getForceField()); biojFilter.setAltID(newSystem, c); biojFilter.clearSegIDs(); if (biojFilter.convert()) { biojFilter.applyAtomProperties(); String fileName = ffxSystem.getFile().getAbsolutePath(); newSystem.setName(FilenameUtils.getBaseName(fileName) + " " + c); mainPanel.getHierarchy().addSystemNode(newSystem); energy = new ForceFieldEnergy(newSystem, biojFilter.getCoordRestraints()); newSystem.setPotential(energy); } } } } else { logger.warning(String.format(" Failed to convert structure %s", dataStructure.toString())); } mainPanel.setCursor(Cursor.getDefaultCursor()); if (timer) { stopTimer(ffxSystem); } }