List of usage examples for java.awt Cursor getPredefinedCursor
public static Cursor getPredefinedCursor(int type)
From source file:org.yccheok.jstock.gui.portfolio.DividendSummaryJDialog.java
private void jLabel2MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel2MouseEntered if (this.dividendSummary == null || this.dividendSummary.getTotal() <= 0.0) { this.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } else {//from ww w . j ava 2 s .co m this.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); } }
From source file:VASSAL.launch.ModuleManagerWindow.java
public void setWaitCursor(boolean wait) { setCursor(Cursor.getPredefinedCursor(wait ? Cursor.WAIT_CURSOR : Cursor.DEFAULT_CURSOR)); }
From source file:com.wet.wired.jsr.player.JPlayer.java
public void beginWaitForBackgroundProcesses() { this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); }
From source file:com.limegroup.gnutella.gui.GUIUtils.java
/** * Returns a <code>MouseListener</code> that changes the cursor and * notifies <code>actionListener</code> on click. *///w w w. j av a2 s . co m public static MouseListener getURLInputListener(final ActionListener actionListener) { return new MouseAdapter() { public void mouseEntered(MouseEvent e) { JComponent comp = (JComponent) e.getComponent(); comp.getTopLevelAncestor().setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { JComponent comp = (JComponent) e.getComponent(); comp.getTopLevelAncestor().setCursor(Cursor.getDefaultCursor()); } public void mouseClicked(MouseEvent e) { actionListener.actionPerformed(new ActionEvent(e.getComponent(), 0, null)); } }; }
From source file:org.yccheok.jstock.gui.portfolio.DividendSummaryJDialog.java
private void jLabel2MouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel2MouseExited this.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }
From source file:com.wet.wired.jsr.player.JPlayer.java
public void endWaitForBackgroundProcesses() { this.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }
From source file:org.broad.igv.hic.MainWindow.java
public Component showGlassPane() { final Component glassPane = getGlassPane(); glassPane.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); glassPane.setVisible(true);/*from ww w. j a va2 s.com*/ return glassPane; }
From source file:org.omegat.gui.main.ProjectUICommands.java
/** * Open project. Does nothing if a project is already open and closeCurrent is false. * /* w w w. j av a 2 s . c o m*/ * @param projectDirectory * project directory or null if user must choose it * @param closeCurrent * whether or not to close the current project first, if any */ public static void projectOpen(final File projectDirectory, boolean closeCurrent) { UIThreadsUtil.mustBeSwingThread(); if (Core.getProject().isProjectLoaded()) { if (closeCurrent) { // Register to try again after closing the current project. CoreEvents.registerProjectChangeListener(new IProjectEventListener() { public void onProjectChanged(PROJECT_CHANGE_TYPE eventType) { if (eventType == PROJECT_CHANGE_TYPE.CLOSE) { projectOpen(projectDirectory, false); CoreEvents.unregisterProjectChangeListener(this); } } }); projectClose(); } return; } final File projectRootFolder; if (projectDirectory == null) { // select existing project file - open it OmegaTFileChooser pfc = new OpenProjectFileChooser(); if (OmegaTFileChooser.APPROVE_OPTION != pfc .showOpenDialog(Core.getMainWindow().getApplicationFrame())) { return; } projectRootFolder = pfc.getSelectedFile(); } else { projectRootFolder = projectDirectory; } 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); try { // convert old projects if need ConvertProject.convert(projectRootFolder); } catch (Exception ex) { Log.logErrorRB(ex, "PP_ERROR_UNABLE_TO_CONVERT_PROJECT"); Core.getMainWindow().displayErrorRB(ex, "PP_ERROR_UNABLE_TO_CONVERT_PROJECT"); mainWindow.setCursor(oldCursor); return null; } // check if project okay ProjectProperties props; try { props = ProjectFileStorage.loadProjectProperties(projectRootFolder.getAbsoluteFile()); } catch (Exception ex) { Log.logErrorRB(ex, "PP_ERROR_UNABLE_TO_READ_PROJECT_FILE"); Core.getMainWindow().displayErrorRB(ex, "PP_ERROR_UNABLE_TO_READ_PROJECT_FILE"); mainWindow.setCursor(oldCursor); return null; } try { boolean needToSaveProperties = false; if (props.hasRepositories()) { // team project - non-exist directories could be created from repo props.autocreateDirectories(); } else { // not a team project - ask for non-exist directories while (!props.isProjectValid()) { needToSaveProperties = true; // something wrong with the project - display open dialog // to fix it ProjectPropertiesDialog prj = new ProjectPropertiesDialog( Core.getMainWindow().getApplicationFrame(), props, new File(projectRootFolder, OConsts.FILE_PROJECT).getAbsolutePath(), ProjectPropertiesDialog.Mode.RESOLVE_DIRS); prj.setVisible(true); props = prj.getResult(); prj.dispose(); if (props == null) { // user clicks on 'Cancel' mainWindow.setCursor(oldCursor); return null; } } } final ProjectProperties propsP = props; Core.executeExclusively(true, () -> ProjectFactory.loadProject(propsP, true)); if (needToSaveProperties) { Core.getProject().saveProjectProperties(); } } catch (Exception ex) { Log.logErrorRB(ex, "PP_ERROR_UNABLE_TO_READ_PROJECT_FILE"); Core.getMainWindow().displayErrorRB(ex, "PP_ERROR_UNABLE_TO_READ_PROJECT_FILE"); mainWindow.setCursor(oldCursor); return null; } RecentProjects.add(projectRootFolder.getAbsolutePath()); 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.unicornlabs.kabouter.gui.power.PowerPanel.java
private void applyButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_applyButtonActionPerformed setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); liveStatus = liveCheckBox.isSelected(); List selectedValuesList = deviceList.getSelectedValuesList(); if (liveStatus == true) { Calendar cal = Calendar.getInstance(); Date currentDate = new Date(); cal.setTime(currentDate);/* w ww.ja v a 2 s. c om*/ cal.add(Calendar.SECOND, -MAX_DATA_POINTS_LIVE); Date startDate = cal.getTime(); ArrayList<Powerlog> logs = theHistorian.getPowerlogs(selectedValuesList, startDate, currentDate, MAX_DATA_POINTS_LIVE); setupChart(logs, "Live Power"); } else { Calendar cal = Calendar.getInstance(); cal.setTime((Date) startTimeSpinner.getValue()); int hour = cal.get(Calendar.HOUR_OF_DAY); int min = cal.get(Calendar.MINUTE); int sec = cal.get(Calendar.SECOND); cal.setTime(startDateChooser.getDate()); cal.set(Calendar.HOUR_OF_DAY, hour); cal.set(Calendar.MINUTE, min); cal.set(Calendar.SECOND, sec); Date start = cal.getTime(); cal.setTime((Date) endTimeSpinner.getValue()); hour = cal.get(Calendar.HOUR_OF_DAY); min = cal.get(Calendar.MINUTE); sec = cal.get(Calendar.SECOND); cal.setTime(endDateChooser.getDate()); cal.set(Calendar.HOUR_OF_DAY, hour); cal.set(Calendar.MINUTE, min); cal.set(Calendar.SECOND, sec); Date end = cal.getTime(); ArrayList<Powerlog> logs = theHistorian.getPowerlogs(selectedValuesList, start, end, MAX_DATA_POINTS); setupChart(logs, "Power"); } setCursor(Cursor.getDefaultCursor()); }
From source file:op.care.prescription.DlgOnDemand.java
/** * This method is called from within the constructor to * initialize the form./*from ww w. j a v a 2 s .c o m*/ * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the PrinterForm Editor. */ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jPanel1 = new JPanel(); txtMed = new JXSearchField(); cmbMed = new JComboBox<>(); panel4 = new JPanel(); btnMedWizard = new JButton(); cmbIntervention = new JComboBox<>(); txtSit = new JXSearchField(); cmbSit = new JComboBox<>(); panel3 = new JPanel(); btnAddSit = new JButton(); txtIntervention = new JXSearchField(); jPanel2 = new JPanel(); lblNumber = new JLabel(); lblDose = new JLabel(); lblMaxPerDay = new JLabel(); txtMaxTimes = new JTextField(); lblX = new JLabel(); txtEDosis = new JTextField(); lblCheckResultAfter = new JLabel(); cmbCheckAfter = new JComboBox<>(); jPanel3 = new JPanel(); pnlOFF = new JPanel(); rbActive = new JRadioButton(); rbDate = new JRadioButton(); txtOFF = new JTextField(); jScrollPane3 = new JScrollPane(); txtBemerkung = new JTextPane(); lblText = new JLabel(); pnlON = new JPanel(); cmbDocON = new JComboBox<>(); cmbHospitalON = new JComboBox<>(); panel1 = new JPanel(); btnClose = new JButton(); btnSave = new JButton(); //======== this ======== setModalityType(Dialog.ModalityType.APPLICATION_MODAL); setResizable(false); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); Container contentPane = getContentPane(); contentPane.setLayout(new FormLayout("14dlu, $lcgap, default, 6dlu, 355dlu, $lcgap, 14dlu", "14dlu, $lgap, fill:default:grow, $lgap, fill:default, $lgap, 14dlu")); //======== jPanel1 ======== { jPanel1.setBorder(null); jPanel1.setLayout(new FormLayout("68dlu, $lcgap, pref:grow, $lcgap, pref", "3*(16dlu, $lgap), default, $lgap, fill:113dlu:grow, $lgap, 60dlu")); //---- txtMed ---- txtMed.setFont(new Font("Arial", Font.PLAIN, 14)); txtMed.setPrompt("Medikamente"); txtMed.setFocusBehavior(PromptSupport.FocusBehavior.HIGHLIGHT_PROMPT); txtMed.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { txtMedActionPerformed(e); } }); txtMed.addFocusListener(new FocusAdapter() { @Override public void focusGained(FocusEvent e) { txtMedFocusGained(e); } }); jPanel1.add(txtMed, CC.xy(1, 1)); //---- cmbMed ---- cmbMed.setModel(new DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); cmbMed.setFont(new Font("Arial", Font.PLAIN, 14)); cmbMed.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { cmbMedItemStateChanged(e); } }); jPanel1.add(cmbMed, CC.xy(3, 1)); //======== panel4 ======== { panel4.setLayout(new BoxLayout(panel4, BoxLayout.LINE_AXIS)); //---- btnMedWizard ---- btnMedWizard.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/add.png"))); btnMedWizard.setBorderPainted(false); btnMedWizard.setBorder(null); btnMedWizard.setContentAreaFilled(false); btnMedWizard.setToolTipText("Neues Medikament eintragen"); btnMedWizard.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); btnMedWizard.setSelectedIcon( new ImageIcon(getClass().getResource("/artwork/22x22/bw/add-pressed.png"))); btnMedWizard.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { btnMedActionPerformed(e); } }); panel4.add(btnMedWizard); } jPanel1.add(panel4, CC.xy(5, 1)); //---- cmbIntervention ---- cmbIntervention .setModel(new DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); cmbIntervention.setFont(new Font("Arial", Font.PLAIN, 14)); jPanel1.add(cmbIntervention, CC.xywh(3, 5, 3, 1)); //---- txtSit ---- txtSit.setPrompt("Situationen"); txtSit.setFont(new Font("Arial", Font.PLAIN, 14)); txtSit.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { txtSitActionPerformed(e); } }); jPanel1.add(txtSit, CC.xy(1, 3)); //---- cmbSit ---- cmbSit.setModel(new DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); cmbSit.setFont(new Font("Arial", Font.PLAIN, 14)); cmbSit.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { cmbSitItemStateChanged(e); } }); cmbSit.addPropertyChangeListener("model", new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent e) { cmbSitPropertyChange(e); } }); jPanel1.add(cmbSit, CC.xy(3, 3)); //======== panel3 ======== { panel3.setLayout(new BoxLayout(panel3, BoxLayout.LINE_AXIS)); //---- btnAddSit ---- btnAddSit.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/add.png"))); btnAddSit.setBorderPainted(false); btnAddSit.setBorder(null); btnAddSit.setContentAreaFilled(false); btnAddSit.setToolTipText("Neue Situation eintragen"); btnAddSit.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); btnAddSit.setSelectedIcon( new ImageIcon(getClass().getResource("/artwork/22x22/bw/add-pressed.png"))); btnAddSit.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { btnSituationActionPerformed(e); } }); panel3.add(btnAddSit); } jPanel1.add(panel3, CC.xy(5, 3, CC.RIGHT, CC.DEFAULT)); //---- txtIntervention ---- txtIntervention.setFont(new Font("Arial", Font.PLAIN, 14)); txtIntervention.setPrompt("Massnahmen"); txtIntervention.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { txtMassActionPerformed(e); } }); jPanel1.add(txtIntervention, CC.xy(1, 5)); //======== jPanel2 ======== { jPanel2.setLayout(new FormLayout("default, $lcgap, pref, $lcgap, default, $lcgap, 37dlu:grow", "23dlu, fill:22dlu, $ugap, default")); //---- lblNumber ---- lblNumber.setText("Anzahl"); jPanel2.add(lblNumber, CC.xy(3, 1)); //---- lblDose ---- lblDose.setText("Dosis"); jPanel2.add(lblDose, CC.xy(7, 1, CC.CENTER, CC.DEFAULT)); //---- lblMaxPerDay ---- lblMaxPerDay.setText("Max. Tagesdosis:"); jPanel2.add(lblMaxPerDay, CC.xy(1, 2)); //---- txtMaxTimes ---- txtMaxTimes.setHorizontalAlignment(SwingConstants.CENTER); txtMaxTimes.setText("1"); txtMaxTimes.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { txtMaxTimesActionPerformed(e); } }); txtMaxTimes.addFocusListener(new FocusAdapter() { @Override public void focusGained(FocusEvent e) { txtMaxTimesFocusGained(e); } @Override public void focusLost(FocusEvent e) { txtMaxTimesFocusLost(e); } }); jPanel2.add(txtMaxTimes, CC.xy(3, 2)); //---- lblX ---- lblX.setText("x"); jPanel2.add(lblX, CC.xy(5, 2)); //---- txtEDosis ---- txtEDosis.setHorizontalAlignment(SwingConstants.CENTER); txtEDosis.setText("1.0"); txtEDosis.addFocusListener(new FocusAdapter() { @Override public void focusGained(FocusEvent e) { txtEDosisFocusGained(e); } @Override public void focusLost(FocusEvent e) { txtEDosisFocusLost(e); } }); txtEDosis.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { txtEDosisActionPerformed(e); } }); jPanel2.add(txtEDosis, CC.xy(7, 2)); //---- lblCheckResultAfter ---- lblCheckResultAfter.setText("Nachkontrolle:"); jPanel2.add(lblCheckResultAfter, CC.xy(1, 4)); //---- cmbCheckAfter ---- cmbCheckAfter.setModel(new DefaultComboBoxModel<>(new String[] { "keine Nachkontrolle", "nach 1 Stunde", "nach 2 Stunden", "nach 3 Stunden" })); jPanel2.add(cmbCheckAfter, CC.xywh(3, 4, 5, 1)); } jPanel1.add(jPanel2, CC.xywh(1, 9, 5, 1, CC.CENTER, CC.TOP)); } contentPane.add(jPanel1, CC.xy(5, 3)); //======== jPanel3 ======== { jPanel3.setBorder(null); jPanel3.setLayout(new FormLayout("149dlu", "3*(fill:default, $lgap), fill:100dlu:grow")); //======== pnlOFF ======== { pnlOFF.setBorder(new TitledBorder("Absetzung")); pnlOFF.setLayout(new FormLayout("pref, 86dlu:grow", "fill:17dlu, $lgap, fill:17dlu")); //---- rbActive ---- rbActive.setText("text"); rbActive.setSelected(true); rbActive.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { rbActiveItemStateChanged(e); } }); pnlOFF.add(rbActive, CC.xywh(1, 1, 2, 1)); //---- rbDate ---- rbDate.setText(null); rbDate.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { rbDateItemStateChanged(e); } }); pnlOFF.add(rbDate, CC.xy(1, 3)); //---- txtOFF ---- txtOFF.setEnabled(false); txtOFF.setFont(new Font("Arial", Font.PLAIN, 14)); txtOFF.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { txtOFFFocusLost(e); } }); pnlOFF.add(txtOFF, CC.xy(2, 3)); } jPanel3.add(pnlOFF, CC.xy(1, 3)); //======== jScrollPane3 ======== { //---- txtBemerkung ---- txtBemerkung.addCaretListener(new CaretListener() { @Override public void caretUpdate(CaretEvent e) { txtBemerkungCaretUpdate(e); } }); jScrollPane3.setViewportView(txtBemerkung); } jPanel3.add(jScrollPane3, CC.xy(1, 7)); //---- lblText ---- lblText.setText("Bemerkung:"); jPanel3.add(lblText, CC.xy(1, 5)); //======== pnlON ======== { pnlON.setBorder(new TitledBorder("Ansetzung")); pnlON.setLayout(new FormLayout("119dlu:grow", "17dlu, $lgap, fill:17dlu")); //---- cmbDocON ---- cmbDocON.setModel( new DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); cmbDocON.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { cmbDocONKeyPressed(e); } }); pnlON.add(cmbDocON, CC.xy(1, 1)); //---- cmbHospitalON ---- cmbHospitalON.setModel( new DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); pnlON.add(cmbHospitalON, CC.xy(1, 3)); } jPanel3.add(pnlON, CC.xy(1, 1)); } contentPane.add(jPanel3, CC.xy(3, 3)); //======== panel1 ======== { panel1.setLayout(new BoxLayout(panel1, BoxLayout.LINE_AXIS)); //---- btnClose ---- btnClose.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/cancel.png"))); btnClose.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); btnClose.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { btnCloseActionPerformed(e); } }); panel1.add(btnClose); //---- btnSave ---- btnSave.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/apply.png"))); btnSave.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); btnSave.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { btnSaveActionPerformed(e); } }); panel1.add(btnSave); } contentPane.add(panel1, CC.xy(5, 5, CC.RIGHT, CC.DEFAULT)); setSize(1035, 515); setLocationRelativeTo(getOwner()); //---- bgMedikament ---- ButtonGroup bgMedikament = new ButtonGroup(); bgMedikament.add(rbActive); bgMedikament.add(rbDate); }