List of usage examples for java.awt Cursor Cursor
protected Cursor(String name)
Note: this constructor should only be used by AWT implementations as part of their support for custom cursors.
From source file:gg.pistol.sweeper.gui.component.DecoratedPanel.java
/** * Helper factory method for creating clickable links. * * @param linkText// www. ja v a 2s. c om * a string that will be displayed as a link * @param action * the action performed at click * @return the link component */ protected JComponent createLink(String linkText, final Runnable action) { Preconditions.checkNotNull(linkText); Preconditions.checkNotNull(action); JLabel link = new JLabel("<html><a href=''>" + linkText + "</a></html>"); link.setComponentOrientation(ComponentOrientation.getOrientation(i18n.getLocale())); link.setCursor(new Cursor(Cursor.HAND_CURSOR)); link.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { action.run(); } }); return link; }
From source file:org.ut.biolab.medsavant.client.view.component.KeyValuePairPanel.java
public void addKey(final String key, boolean showExpand) { Color rowColor = Color.WHITE; if (keyKeyComponentMap.size() % 2 == 0) { rowColor = ViewUtil.getAlternateRowColor(); }/*from w w w . ja va2 s. c o m*/ if (newRowsGoIntoMoreSection) { keysInMoreSection.add(key); } rowColor = Color.white; String layoutConstraints = "insets 3 3 3 3, filly"; JPanel valuePanel = ViewUtil.getClearPanel(); valuePanel.setLayout(new MigLayout(layoutConstraints)); valuePanel.setBackground(rowColor); int i = 0; JPanel keyPanel = ViewUtil.getClearPanel(); keyPanel.setLayout(new MigLayout(layoutConstraints + ", alignx right, hmin 30")); keyPanel.setBackground(rowColor); final JLabel keyLabel = getKeyLabel(key); //keyLabel.setBorder(ViewUtil.getMediumBorder()); keyKeyComponentMap.put(key, keyLabel); if (showExpand) { keyLabel.setText("? " + key.toUpperCase()); keyLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); keyLabel.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent me) { toggleMoreVisibility(); if (keyLabel.getText().startsWith("?")) { keyLabel.setText("? " + key.toUpperCase()); } else { keyLabel.setText("? " + key.toUpperCase()); } } }); } keyPanel.add(keyLabel); keyLabel.setVisible(keysVisible); kvpPanel.add(keyPanel, incrementConstraintRow(i++)); kvpPanel.add(valuePanel, incrementConstraintRow(i++)); JPanel[] extraComponents = new JPanel[additionalColumns]; for (int j = 0; j < additionalColumns; j++) { JPanel panel = ViewUtil.getClearPanel(); panel.setBackground(rowColor); ViewUtil.applyHorizontalBoxLayout(panel); //panel.setBorder(border); //panel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); extraComponents[j] = panel;//ViewUtil.getClearPanel(); kvpPanel.add(extraComponents[j], incrementConstraintRow(i++)); } // add hidden panel keyDetailConstraints.gridy++; keyDetailConstraints.gridy++; JPanel detailPanel = ViewUtil.getClearPanel(); detailPanel.setBackground(rowColor); //detailPanel.setBorder(ViewUtil.getTinyLineBorder()); detailPanel.setVisible(false); keyDetailComponentMap.put(key, detailPanel); kvpPanel.add(detailPanel, keyDetailConstraints); // update all constraints to skip a line for (int k = 0; k < 2 + additionalColumns; k++) { incrementConstraintRow(k); } keyValueComponentMap.put(key, valuePanel); keyExtraComponentsMap.put(key, extraComponents); setMoreVisibility(showingMore); }
From source file:com.rapidminer.gui.properties.OperatorPropertyPanel.java
public OperatorPropertyPanel(final MainFrame mainFrame) { super();//from www. j a v a 2 s. c o m this.mainFrame = mainFrame; breakpointButton = new BreakpointButton(); headerLabel.setHorizontalAlignment(SwingConstants.CENTER); expertModeHintLabel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); expertModeHintLabel.setIcon(WARNING_ICON); expertModeHintLabel.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { mainFrame.TOGGLE_EXPERT_MODE_ACTION.actionPerformed(null); } }); expertModeHintLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); expertModeHintLabel.setHorizontalAlignment(SwingConstants.LEFT); setupComponents(); compatibilityLevelSpinner.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { // compatibility level OperatorVersion[] versionChanges = operator.getIncompatibleVersionChanges(); // sort to have an ascending order Arrays.sort(versionChanges); if (versionChanges.length != 0) { OperatorVersion latestChange = versionChanges[versionChanges.length - 1]; if (latestChange.isAtLeast(operator.getCompatibilityLevel())) { compatibilityLabel.setIcon(WARNING_ICON); } else { compatibilityLabel.setIcon(SwingTools.createIcon("16/ok.png")); } } } }); showHelpAction = new ToggleAction(true, "show_parameter_help") { private static final long serialVersionUID = 1L; @Override public void actionToggled(ActionEvent e) { setShowParameterHelp(isSelected()); mainFrame.getPropertyPanel().setupComponents(); } }; }
From source file:edu.harvard.i2b2.patientMapping.ui.PatientIDConversionJFrame.java
private void jConvertButtonActionPerformed(java.awt.event.ActionEvent evt) { int inputIndex = jInputComboBox.getSelectedIndex() + 1; int outputIndex = jOutputComboBox.getSelectedIndex() + 1; if ((inputIndex == 2 && outputIndex != 2) || (inputIndex == 4 && outputIndex != 5)) { Display.getDefault().syncExec(new Runnable() { public void run() { MessageBox messageBox = new MessageBox(new Shell(), SWT.ICON_WARNING | SWT.OK); messageBox.setText("Not valid selections"); messageBox.setMessage("Input and output pair selected is not valid."); messageBox.open();// ww w .java 2 s . c om } }); return; } //jConvertButton.setCursor(new Cursor(Cursor.WAIT_CURSOR)); String inputFile = this.jInputFilePathTextField.getText(); if (inputFile == null || inputFile.equalsIgnoreCase("")) { JOptionPane.showMessageDialog(this, "Please select a input file."); return; } final String outputFile = this.jOutputFilePathTextField.getText(); if (outputFile == null || outputFile.equalsIgnoreCase("")) { JOptionPane.showMessageDialog(this, "Please select an output file."); return; } final File oDelete = new File(outputFile); Display.getDefault().syncExec(new Runnable() { public void run() { if (oDelete != null && oDelete.exists()) { MessageBox messageBox = new MessageBox(new Shell(), SWT.ICON_WARNING | SWT.YES | SWT.NO); messageBox.setText("Warning"); messageBox.setMessage(outputFile + " already exists,\nDo you want to replace it?"); int buttonID = messageBox.open(); switch (buttonID) { case SWT.YES: oDelete.delete(); break; case SWT.NO: return; case SWT.CANCEL: // does nothing ... } } } }); log.info("Selected output file: " + outputFile); //if (fileName != null && fileName.trim().length() > 0) { log.info("Selected input file: " + inputFile); PatientIDConversionFactory converter = new PatientIDConversionFactory(); if ((inputIndex == 1 && (outputIndex == 2 || outputIndex == 3)) || (inputIndex == 3 && (outputIndex == 5 || outputIndex == 6))) { converter.sitename(jSiteTextField.getText()); } FileReader fr; BufferedReader inbr = null; RandomAccessFile f = null; //append(f, resultFile.toString()); jConvertButton.setCursor(new Cursor(Cursor.WAIT_CURSOR)); try { f = new RandomAccessFile(outputFile, "rw"); fr = new FileReader(new File(inputFile)); inbr = new BufferedReader(fr); //String line = inbr.readLine(); /*if(!line.startsWith("@@i2b2 patient mapping file@@")) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { //setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); JOptionPane.showMessageDialog(jLabel1, "The file is not in a valid format.", "Error importing", JOptionPane.ERROR_MESSAGE); } }); //JOptionPane.showMessageDialog(null, "The file is not a valid.", "Error importing", JOptionPane.ERROR_MESSAGE); return; }*/ String line = inbr.readLine(); //log.info("column name: "+line); int rowCount = 0; while (line != null) { log.info(line); String outputline = ""; /*String[] cols = line.split(","); String id; if(cols.length < 2) { id = ""; } else { id = converter.convert(cols[1], 1, 1); }*/ outputline = converter.convertLine(line, inputIndex, outputIndex); append(f, outputline);//cols[0]+","+id+"\n"); rowCount++; line = inbr.readLine(); } log.info("From " + inputIndex + " to " + outputIndex + " total lines: " + rowCount); inbr.close(); f.close(); } catch (Exception e) { e.printStackTrace(); if (inbr != null) { try { inbr.close(); } catch (Exception e1) { } } if (f != null) { try { f.close(); } catch (Exception e1) { } } } jConvertButton.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); }
From source file:nz.govt.natlib.ndha.manualdeposit.CMSSearchResults.java
public void setWaitCursor(boolean isWaiting) { // NOPMD glass.setVisible(isWaiting);/*from ww w . j a va 2 s. c o m*/ if (isWaiting) { final Cursor hourglass = new Cursor(Cursor.WAIT_CURSOR); setCursor(hourglass); } else { final Cursor normal = new Cursor(Cursor.DEFAULT_CURSOR); setCursor(normal); } }
From source file:com.vgi.mafscaling.OpenLoop.java
protected void clearRunTables() { setCursor(new Cursor(Cursor.WAIT_CURSOR)); try {/*from ww w . j a v a 2 s.c om*/ for (int i = 0; i < runTables.length; ++i) { while (RunRowsCount < runTables[i].getRowCount()) Utils.removeRow(RunRowsCount, runTables[i]); Utils.clearTable(runTables[i]); } } finally { setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }
From source file:ro.nextreports.designer.action.report.layout.export.ExportAction.java
public void actionPerformed(ActionEvent event) { executorThread = new Thread(new Runnable() { public void run() { if (MessageUtil.showReconnect()) { return; }//www . ja v a 2 s .c o m DataSource runDS = Globals.getReportLayoutPanel().getRunDataSource(); if (report != null) { ParameterManager.getInstance().setParameters(report.getParameters()); } UIActivator activator = null; UIActivator activatorParam = null; UIActivator exporterActivator = null; QueryResult qr = null; activatorParam = new UIActivator(Globals.getMainFrame(), I18NSupport.getString("generate.report.prepare")); activatorParam.start(); try { FileUtil.copyImagesToClasspath(report); } catch (IOException e) { e.printStackTrace(); } try { FileUtil.copyTemplateToClasspath(report); } catch (IOException e) { e.printStackTrace(); } Connection con = null; try { Set<String> columns = BandUtil.getNotFoundColumns(report, runDS); if (columns.size() > 0) { StringBuilder message = new StringBuilder(); message.append(I18NSupport.getString("band.column.notfound")); message.append("\r\n"); for (String col : columns) { message.append(col).append("\r\n"); } if (activatorParam != null) { activatorParam.stop(); } Show.error(message.toString()); return; } Set<String> groupColumns = BandUtil.getNotFoundColumnsUsedByGroups(report, runDS); if (groupColumns.size() > 0) { StringBuilder message = new StringBuilder(); message.append(I18NSupport.getString("band.column.group.notfound")); message.append("\r\n"); for (String col : groupColumns) { message.append(col).append("\r\n"); } if (activatorParam != null) { activatorParam.stop(); } Show.error(message.toString()); return; } //NextReportsUtil.reloadReportIfNecessary(); if (activatorParam != null) { activatorParam.stop(); activatorParam = null; } // name when run from explorer tree (without open) String notLoadedName = null; if (report != null) { notLoadedName = getNameWithoutExtension(report.getName()); } ExportPropertiesPanel propsPanel = new ExportPropertiesPanel(notLoadedName, exportType, layoutSelection); ExportPropertiesDialog dialog = new ExportPropertiesDialog(propsPanel); // we are interested only in layout property (generated report name is automatically set) // otherwise we do not show the dialog if (layoutSelection) { Show.centrateComponent(Globals.getMainFrame(), dialog); dialog.setVisible(true); } String name = dialog.getReportName(); if (name == null) { return; } if (layoutSelection && !dialog.okPressed() && (report == null)) { return; } name = name.trim(); if (name.length() == 0) { name = "Report"; } ParametersBean pBean = Globals.getMainFrame().getQueryBuilderPanel().selectParameters(report, runDS); if (pBean == null) { return; } if (QueryUtil.restrictQueryExecution(pBean.getQuery().getText())) { Show.info(I18NSupport.getString("export.action.execute")); return; } con = Globals.createTempConnection(runDS); boolean isProcedure = QueryUtil.isProcedureCall(pBean.getQuery().getText()); if (isProcedure) { if (!QueryUtil.isValidProcedureCall(pBean.getQuery().getText(), DialectUtil.getDialect(con))) { Show.info(I18NSupport.getString("export.action.execute.procedure")); return; } } activator = new UIActivator(Globals.getMainFrame(), I18NSupport.getString("generate.report")); activator.start(new ExportStopAction()); qr = Globals.getMainFrame().getQueryBuilderPanel().runQuery(con, pBean, false); if (activator != null) { activator.stop(); activator = null; } if (qr == null) { return; } final int records = qr.getRowCount(); if (records > RECORDS) { eventThreshold = RECORDS_INCREMENT; } exporterActivator = new UIActivator(Globals.getMainFrame(), I18NSupport.getString("generate.report.export"), records); exporterActivator.start(new ExportStopAction()); // boolean ok = startExporter(name, qr, pBean, exporterActivator, isProcedure); if (!ok) { Show.dispose(); // close a possible previous dialog message Show.info(I18NSupport.getString("report.cancelled")); } // } catch (NoDataFoundException e) { Show.info(e.getMessage()); } catch (InterruptedException e) { Show.dispose(); // close a possible previous dialog message Show.info(I18NSupport.getString("report.cancelled")); } catch (Exception e) { Show.error(e); } finally { stop = false; if (con != null) { try { con.close(); } catch (SQLException e) { e.printStackTrace(); } } if (qr != null) { qr.close(); } Cursor normalCursor = new Cursor(Cursor.DEFAULT_CURSOR); Globals.getMainFrame().setCursor(normalCursor); if (activatorParam != null) { activatorParam.stop(); } if (activator != null) { activator.stop(); } if (exporterActivator != null) { exporterActivator.stop(); } if (oldParameters != null) { ParameterManager.getInstance().setParameters(oldParameters); } } } }, "NEXT : " + getClass().getSimpleName()); executorThread.setPriority(EngineProperties.getRunPriority()); executorThread.start(); }
From source file:com.vgi.mafscaling.OpenLoop.java
protected void calculateMafScaling() { setCursor(new Cursor(Cursor.WAIT_CURSOR)); try {// w w w. ja v a2 s. c o m clearData(); clearChartData(); clearChartCheckBoxes(); TreeMap<Integer, ArrayList<Double>> result = new TreeMap<Integer, ArrayList<Double>>(); if (!getMafTableData(voltArray, gsArray)) return; if (!sortRunData(result) || result.isEmpty()) return; calculateCorrectedGS(result); setCorrectedMafData(); smoothGsArray.addAll(gsCorrected); checkBoxCorrectedMaf.setSelected(true); setXYTable(mafSmoothingTable, voltArray, smoothGsArray); setRanges(); setSelectedIndex(1); } catch (Exception e) { e.printStackTrace(); logger.error(e); JOptionPane.showMessageDialog(null, "Error: " + e, "Error", JOptionPane.ERROR_MESSAGE); } finally { setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }
From source file:com.mirth.connect.manager.ManagerDialog.java
private void initInfoPanel() { infoPanel = new JPanel(new MigLayout("insets 8, novisualpadding, hidemode 3", "[right][left]")); infoPanel.setBackground(new Color(255, 255, 255)); infoPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); serverVersionLabel = new JLabel("Server Version:"); serverVersionField = new JLabel("version"); serverIdLabel = new JLabel("Server ID:"); serverIdField = new JLabel("serverId"); javaVersionLabel = new JLabel("Java Version:"); javaVersionField = new JLabel("javaVersion"); contactPrefixLabel = new JLabel("Need Help? Contact"); mirthSupportLink = new JLabel("<html><font color=blue><u>Mirth Corporation</u></font></html>"); mirthSupportLink.setToolTipText("Visit Mirth Corporation's website."); mirthSupportLink.setCursor(new Cursor(Cursor.HAND_CURSOR)); mirthSupportLink.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { mirthSupportLinkMouseClicked(evt); }/* w w w .j a v a2 s. co m*/ }); contactPostfixLabel = new JLabel("for professional support."); }
From source file:net.vanosten.dings.swing.SummaryView.java
/** * Places a chart object into the GUI and makes sure it is painted. * @param aChart/*from w w w . j a v a 2 s. co m*/ */ private final void placeChart(JFreeChart aChart) { chartP.removeAll(); chartP.add(new ChartPanel(aChart), BorderLayout.CENTER); this.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); mainP.invalidate(); mainP.validate(); mainP.repaint(); }