use of java.awt.Cursor in project zencash-swing-wallet-ui by ZencashOfficial.
the class MessagingPanel method removeSelectedContact.
/**
* GUI initiated removal
*/
public void removeSelectedContact() {
try {
// Make sure contacts are available
if (this.contactList.getNumberOfContacts() <= 0) {
JOptionPane.showMessageDialog(this.parentFrame, "You have no messaging contacts in your contact list. To use messaging\n" + "you need to add at least one contact. You can add a contact by importing\n" + "their messaging identity using the menu item Messaging >> Import contact \n" + "identity.", "No messaging contacts available...", JOptionPane.ERROR_MESSAGE);
return;
}
MessagingIdentity id = this.contactList.getSelectedContact();
if (id == null) {
JOptionPane.showMessageDialog(this.parentFrame, "No messaging contact is selected in the contact list (on the right side of the UI).\n" + "In order to remove a contact you need to select a contact first!", "No messaging contact is selected...", JOptionPane.ERROR_MESSAGE);
return;
}
// Offer the user a final warning on removing the contact
String contactTAddress = Util.stringIsEmpty(id.getSenderidaddress()) ? "<NONE>" : id.getSenderidaddress();
String contactZAddress = Util.stringIsEmpty(id.getSendreceiveaddress()) ? "<NONE>" : id.getSendreceiveaddress();
int reply = JOptionPane.showConfirmDialog(this.parentFrame, "The " + (id.isGroup() ? "messaging group " : "conact ") + id.getDiplayString() + "\n" + "with messaging identification T address:\n" + contactTAddress + "\n" + "and send/receive Z address:\n" + contactZAddress + "\n" + "will be permanently deleted from your contact list! All incoming messages from\n" + "this contact will subsequently be ignored. Are you sure you want to remove the\n" + "selected contact?", "Are you sure you wish to remove the contant?", JOptionPane.YES_NO_OPTION);
if (reply == JOptionPane.NO_OPTION) {
return;
}
Cursor oldCursor = this.parentFrame.getCursor();
try {
this.parentFrame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
synchronized (this.messageCollectionMutex) {
this.messagingStorage.deleteContact(id);
this.messagingStorage.addIgnoredContact(id);
MessagingPanel.this.contactList.reloadMessagingIdentities();
// Reload the messages for the currently selected user - in the AWT event thread in the mutex!
final MessagingIdentity selectedContact = MessagingPanel.this.contactList.getSelectedContact();
if (selectedContact != null) {
MessagingPanel.this.displayMessagesForContact(selectedContact);
}
}
} finally {
this.parentFrame.setCursor(oldCursor);
}
} catch (Exception ex) {
Log.error("Unexpected error in removing contact!", ex);
this.errorReporter.reportError(ex, false);
}
}
use of java.awt.Cursor in project beast2 by CompEvol.
the class Beauti method addAlignmentProviderMenus.
private void addAlignmentProviderMenus(JMenu fileMenu) {
List<BeautiAlignmentProvider> providers = doc.beautiConfig.alignmentProvider;
for (BeautiAlignmentProvider provider : providers) {
AbstractAction action = new AbstractAction() {
private static final long serialVersionUID = 1L;
@Override
public void actionPerformed(ActionEvent e) {
try {
setCursor(new Cursor(Cursor.WAIT_CURSOR));
// get user-specified alignments
List<BEASTInterface> beastObjects = provider.getAlignments(doc);
if (beastObjects != null) {
for (BEASTInterface o : beastObjects) {
if (o instanceof Alignment) {
try {
BeautiDoc.createTaxonSet((Alignment) o, doc);
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
}
doc.connectModel();
doc.fireDocHasChanged();
if (beastObjects != null) {
for (BEASTInterface o : beastObjects) {
if (o instanceof MRCAPrior) {
doc.addMRCAPrior((MRCAPrior) o);
}
}
}
a_save.setEnabled(true);
a_saveas.setEnabled(true);
} catch (Exception exx) {
exx.printStackTrace();
String text = "Something went wrong importing the alignment:\n";
JTextArea textArea = new JTextArea(text);
textArea.setColumns(30);
textArea.setLineWrap(true);
textArea.setWrapStyleWord(true);
textArea.append(exx.getMessage());
textArea.setSize(textArea.getPreferredSize().width, 1);
textArea.setOpaque(false);
JOptionPane.showMessageDialog(null, textArea, "Error importing alignment", JOptionPane.WARNING_MESSAGE);
}
setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
}
};
String providerInfo = provider.toString().replaceAll("Add ", "Add partition for ");
action.putValue(Action.SHORT_DESCRIPTION, providerInfo);
action.putValue(Action.LONG_DESCRIPTION, providerInfo);
action.putValue(Action.NAME, provider.toString());
fileMenu.add(action);
}
}
use of java.awt.Cursor in project cytoscape-impl by cytoscape.
the class InnerCanvas method setDraggingCanvas.
private void setDraggingCanvas(boolean draggingCanvas) {
if (this.draggingCanvas != draggingCanvas) {
this.draggingCanvas = draggingCanvas;
Cursor cursor = draggingCanvas ? getMoveCursor() : Cursor.getDefaultCursor();
changeCursor(cursor);
}
}
use of java.awt.Cursor in project vcell by virtualcell.
the class BatchRunDisplayPanel method getFRAPDataPanel.
public FRAPDataPanel getFRAPDataPanel() {
if (frapDataPanel == null) {
// the frap data panel in the main frame is not editable
frapDataPanel = new FRAPDataPanel(false);
// set display mode
frapDataPanel.adjustComponents(VFrap_OverlayEditorPanelJAI.DISPLAY_WITH_ROIS);
Hashtable<String, Cursor> cursorsForROIsHash = new Hashtable<String, Cursor>();
cursorsForROIsHash.put(FRAPData.VFRAP_ROI_ENUM.ROI_CELL.name(), FRAPStudyPanel.ROI_CURSORS[FRAPStudyPanel.CURSOR_CELLROI]);
cursorsForROIsHash.put(FRAPData.VFRAP_ROI_ENUM.ROI_BLEACHED.name(), FRAPStudyPanel.ROI_CURSORS[FRAPStudyPanel.CURSOR_BLEACHROI]);
cursorsForROIsHash.put(FRAPData.VFRAP_ROI_ENUM.ROI_BACKGROUND.name(), FRAPStudyPanel.ROI_CURSORS[FRAPStudyPanel.CURSOR_BACKGROUNDROI]);
frapDataPanel.getOverlayEditorPanelJAI().setCursorsForROIs(cursorsForROIsHash);
VFrap_OverlayEditorPanelJAI.CustomROIImport importVFRAPROI = new VFrap_OverlayEditorPanelJAI.CustomROIImport() {
public boolean importROI(File inputFile) throws Exception {
try {
if (!VirtualFrapLoader.filter_vfrap.accept(inputFile)) {
return false;
}
String xmlString = XmlUtil.getXMLString(inputFile.getAbsolutePath());
MicroscopyXmlReader xmlReader = new MicroscopyXmlReader(true);
FRAPStudy importedFrapStudy = xmlReader.getFrapStudy(XmlUtil.stringToXML(xmlString, null).getRootElement(), null);
VirtualFrapMainFrame.updateProgress(0);
ROI roi = getBatchRunWorkspace().getWorkingSingleWorkspace().getWorkingFrapStudy().getFrapData().getCurrentlyDisplayedROI();
ROI[] importedROIs = importedFrapStudy.getFrapData().getRois();
if (importedFrapStudy.getFrapData() != null && importedROIs != null) {
if (!importedROIs[0].getISize().compareEqual(roi.getISize())) {
throw new Exception("Imported ROI mask size (" + importedROIs[0].getISize().getX() + "," + importedROIs[0].getISize().getY() + "," + importedROIs[0].getISize().getZ() + ")" + " does not match current Frap DataSet size (" + roi.getISize().getX() + "," + roi.getISize().getY() + "," + roi.getISize().getZ() + ")");
}
for (int i = 0; i < importedROIs.length; i++) {
getBatchRunWorkspace().getWorkingSingleWorkspace().getWorkingFrapStudy().getFrapData().addReplaceRoi(importedROIs[i]);
}
// undoableEditSupport.postEdit(FRAPStudyPanel.CLEAR_UNDOABLE_EDIT);
}
return true;
} catch (Exception e1) {
throw new Exception("VFRAP ROI Import - " + e1.getMessage());
}
}
};
frapDataPanel.getOverlayEditorPanelJAI().setCustomROIImport(importVFRAPROI);
}
return frapDataPanel;
}
use of java.awt.Cursor in project jmeter by apache.
the class ProxyControlGui method startProxy.
private boolean startProxy() {
ValueReplacer replacer = GuiPackage.getInstance().getReplacer();
modifyTestElement(model);
TreeNodeWrapper treeNodeWrapper = (TreeNodeWrapper) targetNodesModel.getSelectedItem();
if (JMeterUtils.getResString("use_recording_controller").equals(treeNodeWrapper.getLabel())) {
JMeterTreeNode targetNode = model.findTargetControllerNode();
if (targetNode == null || !(targetNode.getTestElement() instanceof RecordingController)) {
JOptionPane.showMessageDialog(this, // $NON-NLS-1$
JMeterUtils.getResString("proxy_cl_wrong_target_cl"), // $NON-NLS-1$
JMeterUtils.getResString("error_title"), JOptionPane.ERROR_MESSAGE);
return false;
}
}
// Proxy can take some while to start up; show a waiting cursor
Cursor cursor = getCursor();
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
try {
replacer.replaceValues(model);
model.startProxy();
start.setEnabled(false);
stop.setEnabled(true);
restart.setEnabled(false);
if (ProxyControl.isDynamicMode()) {
String[] details = model.getCertificateDetails();
StringBuilder sb = new StringBuilder();
sb.append("<html>");
// $NON-NLS-1$
sb.append(JMeterUtils.getResString("proxy_daemon_msg_rootca_cert")).append(" <b>").append(KeyToolUtils.ROOT_CACERT_CRT_PFX).append("</b> ").append(JMeterUtils.getResString("proxy_daemon_msg_created_in_bin"));
// $NON-NLS-1$
sb.append("<br>").append(JMeterUtils.getResString("proxy_daemon_msg_install_as_in_doc"));
sb.append("<br><b>").append(MessageFormat.format(JMeterUtils.getResString("proxy_daemon_msg_check_expiration"), // $NON-NLS-1$
ProxyControl.CERT_VALIDITY)).append("</b><br>");
sb.append("<br>").append(JMeterUtils.getResString("proxy_daemon_msg_check_details")).append(// $NON-NLS-1$
"<ul>");
for (String detail : details) {
sb.append("<li>").append(detail).append("</li>");
}
sb.append("</ul>").append("</html>");
// Make dialog disappear after 7 seconds
JLabel messageLabel = new JLabel(sb.toString());
Timer timer = new Timer(7000, evt -> {
Window window = SwingUtilities.getWindowAncestor(messageLabel);
// Window may be closed by user
if (window != null) {
window.dispose();
}
});
timer.setRepeats(false);
timer.start();
JOptionPane.showMessageDialog(this, messageLabel, // $NON-NLS-1$
JMeterUtils.getResString("proxy_daemon_msg_rootca_cert") + SPACE + KeyToolUtils.ROOT_CACERT_CRT_PFX + SPACE + // $NON-NLS-1$
JMeterUtils.getResString("proxy_daemon_msg_created_in_bin"), JOptionPane.INFORMATION_MESSAGE);
}
return true;
} catch (InvalidVariableException e) {
JOptionPane.showMessageDialog(this, // $NON-NLS-1$ $NON-NLS-2$
JMeterUtils.getResString("invalid_variables") + ": " + e.getMessage(), // $NON-NLS-1$
JMeterUtils.getResString("error_title"), JOptionPane.ERROR_MESSAGE);
return false;
} catch (BindException e) {
JOptionPane.showMessageDialog(this, // $NON-NLS-1$ $NON-NLS-2$
JMeterUtils.getResString("proxy_daemon_bind_error") + ": " + e.getMessage(), // $NON-NLS-1$
JMeterUtils.getResString("error_title"), JOptionPane.ERROR_MESSAGE);
return false;
} catch (IOException e) {
JOptionPane.showMessageDialog(this, // $NON-NLS-1$ $NON-NLS-2$
JMeterUtils.getResString("proxy_daemon_error") + ": " + e.getMessage(), // $NON-NLS-1$
JMeterUtils.getResString("error_title"), JOptionPane.ERROR_MESSAGE);
return false;
} finally {
setCursor(cursor);
}
}
Aggregations