List of usage examples for java.awt Cursor getPredefinedCursor
public static Cursor getPredefinedCursor(int type)
From source file:ome.formats.importer.gui.GuiImporter.java
/** * Toggles wait cursor.//from w w w . j ava 2s . c om * * @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;/* www. j a v a2 s . c om*/ 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.revager.gui.findings_list.FindingsListFrame.java
private void createBottomOrgPanel() { JLabel locationLbl = new JLabel(translate("Location:")); locationLbl.setFont(UI.VERY_LARGE_FONT_BOLD); JLabel dateLbl = new JLabel(translate("Date:")); dateLbl.setFont(UI.VERY_LARGE_FONT_BOLD); JLabel beginLbl = new JLabel(translate("Period of time:")); beginLbl.setFont(UI.VERY_LARGE_FONT_BOLD); JLabel tillLabel = new JLabel(translate("to")); tillLabel.setFont(UI.VERY_LARGE_FONT_BOLD); clockLabel.setFont(UI.VERY_LARGE_FONT_BOLD); dateTxtFld = new ObservingTextField(); dateTxtFld.setFont(UI.VERY_LARGE_FONT); dateTxtFld.setFocusable(false);//ww w .j a v a 2s . c om dateTxtFld.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); dateTxtFld.setPreferredSize(new Dimension(190, (int) dateTxtFld.getPreferredSize().getHeight())); dateTxtFld.setMinimumSize(dateTxtFld.getPreferredSize()); dateTxtFld.addMouseListener(new MouseListener() { @Override public void mouseClicked(MouseEvent e) { // instantiate the DatePicker DatePicker dp = new DatePicker(UI.getInstance().getProtocolFrame(), UI.getInstance().getProtocolFrame().getDateTxtFld()); // previously selected date Date selectedDate = dp.parseDate(UI.getInstance().getProtocolFrame().getDateTxtFld().getText()); dp.setSelectedDate(selectedDate); dp.start(UI.getInstance().getProtocolFrame().getDateTxtFld()); } @Override public void mouseEntered(MouseEvent e) { } @Override public void mouseExited(MouseEvent e) { } @Override public void mousePressed(MouseEvent e) { } @Override public void mouseReleased(MouseEvent e) { } }); dateTxtFld.addKeyListener(updateListener); /* * creating spinner panel */ beginMSpinner = new JSpinner(new RotateSpinnerNumberModel(00, 00, 59, 1)); beginHSpinner = new JSpinner(new RotateSpinnerNumberModel(00, 00, 23, 1)); endMSpinner = new JSpinner(new RotateSpinnerNumberModel(00, 00, 59, 1)); endHSpinner = new JSpinner(new RotateSpinnerNumberModel(00, 00, 23, 1)); beginMSpinner.setFont(UI.VERY_LARGE_FONT); beginHSpinner.setFont(UI.VERY_LARGE_FONT); endHSpinner.setFont(UI.VERY_LARGE_FONT); endMSpinner.setFont(UI.VERY_LARGE_FONT); beginMSpinner.addChangeListener(spinnerChangeListener); beginHSpinner.addChangeListener(spinnerChangeListener); endHSpinner.addChangeListener(spinnerChangeListener); endMSpinner.addChangeListener(spinnerChangeListener); locationTxtFld = new JTextField(); locationTxtFld.setFont(UI.VERY_LARGE_FONT); /* * Hide border if the application runs on Mac OS X */ boolean hideBorder = UI.getInstance().getPlatform() == UI.Platform.MAC; GUITools.formatSpinner(endHSpinner, hideBorder); GUITools.formatSpinner(endMSpinner, hideBorder); GUITools.formatSpinner(beginHSpinner, hideBorder); GUITools.formatSpinner(beginMSpinner, hideBorder); // TODO: In some cases 'currentProt.getDate()' returns null. dateF.setTimeZone(currentProt.getDate().getTimeZone()); dateTxtFld.setText(dateF.format(currentProt.getDate().getTime())); int beginHours = currentProt.getStart().get(Calendar.HOUR_OF_DAY); beginMSpinner.setValue(currentProt.getStart().get(Calendar.MINUTE)); beginHSpinner.setValue(beginHours); int endHours = currentProt.getEnd().get(Calendar.HOUR_OF_DAY); endMSpinner.setValue(currentProt.getEnd().get(Calendar.MINUTE)); endHSpinner.setValue(endHours); /* * Correct the leading zero's */ if ((Integer) beginMSpinner.getValue() == 0) { ((NumberEditor) beginMSpinner.getEditor()).getTextField().setText("00"); } if ((Integer) beginHSpinner.getValue() == 0) { ((NumberEditor) beginHSpinner.getEditor()).getTextField().setText("00"); } if ((Integer) endMSpinner.getValue() == 0) { ((NumberEditor) endMSpinner.getEditor()).getTextField().setText("00"); } if ((Integer) endHSpinner.getValue() == 0) { ((NumberEditor) endHSpinner.getEditor()).getTextField().setText("00"); } locationTxtFld.setText(currentProt.getLocation().trim()); JPanel spinnerPanel = new JPanel(gbl); spinnerPanel.setOpaque(false); JLabel labelDoubleDot1 = new JLabel(":"); labelDoubleDot1.setFont(UI.VERY_LARGE_FONT_BOLD); JLabel labelDoubleDot2 = new JLabel(":"); labelDoubleDot2.setFont(UI.VERY_LARGE_FONT_BOLD); GUITools.addComponent(spinnerPanel, gbl, beginHSpinner, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.VERTICAL, GridBagConstraints.NORTHWEST); GUITools.addComponent(spinnerPanel, gbl, labelDoubleDot1, 1, 0, 1, 1, 0, 0, 0, 5, 0, 0, GridBagConstraints.VERTICAL, GridBagConstraints.CENTER); GUITools.addComponent(spinnerPanel, gbl, beginMSpinner, 2, 0, 1, 1, 0, 0, 0, 5, 0, 0, GridBagConstraints.VERTICAL, GridBagConstraints.NORTHWEST); GUITools.addComponent(spinnerPanel, gbl, tillLabel, 3, 0, 1, 1, 1.0, 0, 0, 10, 0, 10, GridBagConstraints.VERTICAL, GridBagConstraints.CENTER); GUITools.addComponent(spinnerPanel, gbl, endHSpinner, 4, 0, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.VERTICAL, GridBagConstraints.NORTHEAST); GUITools.addComponent(spinnerPanel, gbl, labelDoubleDot2, 5, 0, 1, 1, 0, 0, 0, 5, 0, 0, GridBagConstraints.VERTICAL, GridBagConstraints.CENTER); GUITools.addComponent(spinnerPanel, gbl, endMSpinner, 6, 0, 1, 1, 0, 0, 0, 5, 0, 0, GridBagConstraints.VERTICAL, GridBagConstraints.NORTHEAST); /* * adding created components to orgpanel */ GUITools.addComponent(bottomOrgPanel, gbl, dateLbl, 2, 0, 1, 1, 0.0, 1.0, 10, 20, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); GUITools.addComponent(bottomOrgPanel, gbl, dateTxtFld, 3, 0, 1, 1, 0.0, 1.0, 10, 5, 0, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST); GUITools.addComponent(bottomOrgPanel, gbl, locationLbl, 0, 0, 1, 1, 0.0, 1.0, 10, 20, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); GUITools.addComponent(bottomOrgPanel, gbl, locationTxtFld, 1, 0, 1, 1, 1.0, 1.0, 10, 5, 0, 10, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST); GUITools.addComponent(bottomOrgPanel, gbl, beginLbl, 5, 0, 1, 1, 0.0, 1.0, 10, 30, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST); GUITools.addComponent(bottomOrgPanel, gbl, spinnerPanel, 6, 0, 1, 1, 0.0, 1.0, 10, 5, 0, 25, GridBagConstraints.VERTICAL, GridBagConstraints.WEST); updateAttButtons(); }
From source file:org.nuclos.client.dbtransfer.DBTransferImport.java
private boolean setupPreviewPanel(List<PreviewPart> previewParts) { boolean blnTransferWithWarnings = false; jpnPreviewHeader.removeAll();/* w w w . j ava2 s . c o m*/ jpnPreviewFooter.removeAll(); // setup parameter scroll pane jpnPreviewContent.removeAll(); double[] rowContraints = new double[previewParts.size()]; for (int i = 0; i < previewParts.size(); i++) rowContraints[i] = TableLayout.PREFERRED; final int iWidthBeginnigSpace = 3; final int iWidthSeparator = 6; final SpringLocaleDelegate localeDelegate = getSpringLocaleDelegate(); JLabel lbPreviewHeaderEntity = new JLabel( localeDelegate.getMessage("dbtransfer.import.step1.11", "Entit\u00e4t")); JLabel lbPreviewHeaderTable = new JLabel( localeDelegate.getMessage("dbtransfer.import.step1.12", "Tabellenname")); JLabel lbPreviewHeaderRecords = new JLabel( localeDelegate.getMessage("dbtransfer.import.step1.4", "Datens\u00e4tze")); lbPreviewHeaderRecords.setToolTipText( localeDelegate.getMessage("dbtransfer.import.step1.5", "Anzahl der betroffenen Datens\u00e4tze")); utils.initJPanel(jpnPreviewContent, new double[] { iWidthBeginnigSpace, TableLayout.PREFERRED, iWidthSeparator, TableLayout.PREFERRED, iWidthSeparator, TableLayout.PREFERRED, iWidthSeparator, TableLayout.PREFERRED, TableLayout.PREFERRED, iWidthSeparator, TableLayout.PREFERRED }, rowContraints); int iWidthEntityLabelSize = 0; int iWidthTableLabelSize = 0; int iWidthRecordsLabelSize = 0; int iCountNew = 0; int iCountDeleted = 0; int iCountChanged = 0; int iRow = 0; for (final PreviewPart pp : previewParts) { String tooltip = ""; JLabel lbEntity = new JLabel(pp.getEntity()); JLabel lbTable = new JLabel(pp.getTable()); JLabel lbRecords = new JLabel(String.valueOf(pp.getDataRecords())); lbRecords.setHorizontalAlignment(SwingConstants.RIGHT); if (lbEntity.getPreferredSize().width < lbPreviewHeaderEntity.getPreferredSize().width) lbEntity.setPreferredSize(lbPreviewHeaderEntity.getPreferredSize()); if (lbTable.getPreferredSize().width < lbPreviewHeaderTable.getPreferredSize().width) lbTable.setPreferredSize(lbPreviewHeaderTable.getPreferredSize()); if (lbRecords.getPreferredSize().width < lbPreviewHeaderRecords.getPreferredSize().width) lbRecords.setPreferredSize(lbPreviewHeaderRecords.getPreferredSize()); iWidthEntityLabelSize = iWidthEntityLabelSize < lbEntity.getPreferredSize().width ? lbEntity.getPreferredSize().width : iWidthEntityLabelSize; iWidthTableLabelSize = iWidthTableLabelSize < lbTable.getPreferredSize().width ? lbTable.getPreferredSize().width : iWidthTableLabelSize; iWidthRecordsLabelSize = iWidthRecordsLabelSize < lbRecords.getPreferredSize().width ? lbRecords.getPreferredSize().width : iWidthRecordsLabelSize; Icon icoStatement = null; switch (pp.getType()) { case PreviewPart.NEW: tooltip = localeDelegate.getMessage("dbtransfer.import.step1.6", "Entit\u00e4t wird hinzugef\u00fcgt"); icoStatement = ParameterEditor.COMPARE_ICON_NEW; iCountNew++; break; case PreviewPart.CHANGE: tooltip = localeDelegate.getMessage("dbtransfer.import.step1.7", "Entit\u00e4t wird ge\u00e4ndert"); icoStatement = ParameterEditor.COMPARE_ICON_VALUE_CHANGED; iCountChanged++; break; case PreviewPart.DELETE: tooltip = localeDelegate.getMessage("dbtransfer.import.step1.8", "Entit\u00e4t wird gel\u00f6scht"); icoStatement = ParameterEditor.COMPARE_ICON_DELETED; iCountDeleted++; break; } JLabel lbIcon = new JLabel(icoStatement); JLabel lbStatemnts = new JLabel("<html><u>" + localeDelegate.getMessage("dbtransfer.import.step1.9", "Script anzeigen") + "...</u></html>"); lbStatemnts.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); lbStatemnts.addMouseListener(new MouseListener() { @Override public void mouseReleased(MouseEvent e) { } @Override public void mousePressed(MouseEvent e) { } @Override public void mouseExited(MouseEvent e) { } @Override public void mouseEntered(MouseEvent e) { } @Override public void mouseClicked(MouseEvent e) { String statements = ""; for (String statement : pp.getStatements()) { statements = statements + statement + ";\n\n"; } JTextArea txtArea = new JTextArea(statements); txtArea.setEditable(false); txtArea.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); JScrollPane scroll = new JScrollPane(txtArea); scroll.getVerticalScrollBar().setUnitIncrement(20); scroll.setPreferredSize(new Dimension(600, 300)); scroll.setBorder(BorderFactory.createEmptyBorder()); MainFrameTab overlayFrame = new MainFrameTab( localeDelegate.getMessage("dbtransfer.import.step1.10", "Script f\u00fcr") + " " + pp.getEntity() + " (" + pp.getTable() + ")"); overlayFrame.setLayeredComponent(scroll); ifrm.add(overlayFrame); } }); lbIcon.setToolTipText(tooltip); lbStatemnts.setToolTipText(tooltip); lbEntity.setToolTipText(tooltip); lbTable.setToolTipText(tooltip); jpnPreviewContent.add(lbEntity, "1," + iRow + ",l,c"); jpnPreviewContent.add(lbTable, "3," + iRow + ",l,c"); jpnPreviewContent.add(lbRecords, "5," + iRow + ",r,c"); jpnPreviewContent.add(lbIcon, "7," + iRow + ",l,c"); jpnPreviewContent.add(lbStatemnts, "8," + iRow + ",l,c"); if (pp.getWarning() > 0) { lbIcon.setIcon(Icons.getInstance().getIconPriorityCancel16()); blnTransferWithWarnings = true; } iRow++; } jpnPreviewContent.add(new JSeparator(JSeparator.VERTICAL), "2,0,2," + (iRow - 1)); jpnPreviewContent.add(new JSeparator(JSeparator.VERTICAL), "4,0,4," + (iRow - 1)); jpnPreviewContent.add(new JSeparator(JSeparator.VERTICAL), "6,0,6," + (iRow - 1)); // setup preview header utils.initJPanel(jpnPreviewHeader, new double[] { iWidthBeginnigSpace, iWidthEntityLabelSize, iWidthSeparator, iWidthTableLabelSize, iWidthSeparator, iWidthRecordsLabelSize, iWidthSeparator, TableLayout.PREFERRED, iWidthSeparator, TableLayout.PREFERRED, TableLayout.PREFERRED }, new double[] { TableLayout.PREFERRED }); if (previewParts.isEmpty()) { jpnPreviewHeader.add(new JLabel(localeDelegate.getMessage("dbtransfer.import.step1.18", "Keine Struktur\u00e4nderungen am Datenbankschema.")), "0,0,8,0"); return blnTransferWithWarnings; } jpnPreviewHeader.add(lbPreviewHeaderEntity, "1,0"); jpnPreviewHeader.add(lbPreviewHeaderTable, "3,0"); jpnPreviewHeader.add(lbPreviewHeaderRecords, "5,0"); jpnPreviewHeader.add(new JLabel(localeDelegate.getMessage("dbtransfer.import.step1.13", "\u00c4nderung")), "7,0"); // setup preview footer utils.initJPanel(jpnPreviewFooter, new double[] { TableLayout.FILL, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED }, new double[] { TableLayout.PREFERRED }); final JLabel lbCompare = new JLabel( localeDelegate.getMessage("dbtransfer.import.step1.14", "\u00c4nderungen") + ":"); final JLabel lbCompareNew = new JLabel(iCountNew + ""); final JLabel lbCompareDeleted = new JLabel(iCountDeleted + ""); final JLabel lbCompareValueChanged = new JLabel(iCountChanged + ""); lbCompareNew.setIcon(ParameterEditor.COMPARE_ICON_NEW); lbCompareDeleted.setIcon(ParameterEditor.COMPARE_ICON_DELETED); lbCompareValueChanged.setIcon(ParameterEditor.COMPARE_ICON_VALUE_CHANGED); lbCompareNew.setToolTipText(localeDelegate.getMessage("dbtransfer.import.step1.15", "Neue Entit\u00e4ten")); lbCompareDeleted.setToolTipText( localeDelegate.getMessage("dbtransfer.import.step1.17", "Gel\u00f6schte Entit\u00e4ten")); lbCompareValueChanged.setToolTipText( localeDelegate.getMessage("dbtransfer.import.step1.16", "Ge\u00e4nderte Entit\u00e4ten")); jpnPreviewFooter.add(lbCompare, "1,0,r,c"); jpnPreviewFooter.add(lbCompareNew, "2,0,r,c"); jpnPreviewFooter.add(lbCompareValueChanged, "3,0,r,c"); jpnPreviewFooter.add(lbCompareDeleted, "4,0,r,c"); return blnTransferWithWarnings; }
From source file:org.omegat.gui.main.ProjectUICommands.java
public static void projectClose() { UIThreadsUtil.mustBeSwingThread();// w w w . j a v a 2s . c om 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:JavaXWin.java
public void mouseEntered(MouseEvent e) { if (!m_dragging) setCursor(Cursor.getPredefinedCursor(Cursor.W_RESIZE_CURSOR)); }
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);/* w w w . j a v a2s .co m*/ 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)); }
From source file:org.graphwalker.GUI.App.java
private void setDefaultCursor() { setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }