Example usage for java.awt Cursor getDefaultCursor

List of usage examples for java.awt Cursor getDefaultCursor

Introduction

In this page you can find the example usage for java.awt Cursor getDefaultCursor.

Prototype

public static Cursor getDefaultCursor() 

Source Link

Document

Return the system default cursor.

Usage

From source file:EditorPaneExample11.java

public void enableInput() {
    urlCombo.setEnabled(true); // Allow entry of new URL
    setCursor(Cursor.getDefaultCursor());
}

From source file:jgnash.ui.report.compiled.IncomeExpensePieChart.java

private void setChartCursor(final ChartPanel chartPanel, final ChartEntity e, final Point point) {
    lastPoint = point;/*from w  w w .  jav a 2s.com*/

    EventQueue.invokeLater(new Runnable() {

        ChartEntity entity = e;

        @Override
        public void run() {
            if (entity == null && point != null) {
                entity = chartPanel.getEntityForPoint(lastPoint.x, lastPoint.y);
            }
            Account parent = currentAccount;
            if (entity instanceof PieSectionEntity) {
                // change cursor if section is interesting
                Account a = (Account) ((PieSectionEntity) entity).getSectionKey();
                if (a.getChildCount() > 0 && a != parent) {
                    chartPanel.setCursor(ZOOM_IN);
                } else {
                    chartPanel.setCursor(Cursor.getDefaultCursor());
                }
                return;
            } else if (entity == null && parent != null) {
                parent = parent.getParent();
                if (parent != null && !(parent instanceof RootAccount)) {
                    chartPanel.setCursor(ZOOM_OUT);
                    return;
                }
            }
            chartPanel.setCursor(Cursor.getDefaultCursor());
        }
    });
}

From source file:com.floreantpos.config.ui.DatabaseConfigurationView.java

public void actionPerformed(ActionEvent e) {
    try {//w  w w. jav  a 2 s . c  o  m
        String command = e.getActionCommand();

        Database selectedDb = (Database) databaseCombo.getSelectedItem();

        String providerName = selectedDb.getProviderName();
        String databaseURL = tfServerAddress.getText();
        String databasePort = tfServerPort.getText();
        String databaseName = tfDatabaseName.getText();
        String user = tfUserName.getText();
        String pass = new String(tfPassword.getPassword());

        String connectionString = selectedDb.getConnectString(databaseURL, databasePort, databaseName);
        String hibernateDialect = selectedDb.getHibernateDialect();
        String driverClass = selectedDb.getHibernateConnectionDriverClass();

        if (TEST.equalsIgnoreCase(command)) {
            Application.getInstance().setSystemInitialized(false);
            saveConfig(selectedDb, providerName, databaseURL, databasePort, databaseName, user, pass,
                    connectionString, hibernateDialect);

            try {
                DatabaseUtil.checkConnection(connectionString, hibernateDialect, driverClass, user, pass);
            } catch (DatabaseConnectionException e1) {
                JOptionPane.showMessageDialog(this, Messages.getString("DatabaseConfigurationDialog.32")); //$NON-NLS-1$
                return;
            }

            JOptionPane.showMessageDialog(POSUtil.getBackOfficeWindow(),
                    Messages.getString("DatabaseConfigurationDialog.31")); //$NON-NLS-1$
        } else if (CONFIGURE_DB.equals(command)) {
            Application.getInstance().setSystemInitialized(false);

            int i = JOptionPane.showConfirmDialog(POSUtil.getBackOfficeWindow(),
                    Messages.getString("DatabaseConfigurationDialog.33"), //$NON-NLS-1$
                    Messages.getString("DatabaseConfigurationDialog.34"), JOptionPane.YES_NO_OPTION); //$NON-NLS-1$
            if (i != JOptionPane.YES_OPTION) {
                return;
            }

            i = JOptionPane.showConfirmDialog(POSUtil.getBackOfficeWindow(),
                    Messages.getString("DatabaseConfigurationView.3"), //$NON-NLS-1$
                    Messages.getString("DatabaseConfigurationView.4"), JOptionPane.YES_NO_OPTION); //$NON-NLS-1$
            boolean generateSampleData = false;
            if (i == JOptionPane.YES_OPTION)
                generateSampleData = true;

            saveConfig(selectedDb, providerName, databaseURL, databasePort, databaseName, user, pass,
                    connectionString, hibernateDialect);

            String connectionString2 = selectedDb.getCreateDbConnectString(databaseURL, databasePort,
                    databaseName);

            this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
            boolean createDatabase = DatabaseUtil.createDatabase(connectionString2, hibernateDialect,
                    driverClass, user, pass, generateSampleData);
            this.setCursor(Cursor.getDefaultCursor());

            if (createDatabase) {
                //JOptionPane.showMessageDialog(DatabaseConfigurationView.this, Messages.getString("DatabaseConfigurationDialog.35")); //$NON-NLS-1$
                JOptionPane.showMessageDialog(POSUtil.getBackOfficeWindow(),
                        "Database created. Default password is 1111.\n\nThe system will now restart."); //$NON-NLS-1$

                Main.restart();
            } else {
                JOptionPane.showMessageDialog(POSUtil.getBackOfficeWindow(),
                        Messages.getString("DatabaseConfigurationDialog.36")); //$NON-NLS-1$
            }
        } else if (SAVE.equalsIgnoreCase(command)) {
            Application.getInstance().setSystemInitialized(false);
            saveConfig(selectedDb, providerName, databaseURL, databasePort, databaseName, user, pass,
                    connectionString, hibernateDialect);
        } else if (CANCEL.equalsIgnoreCase(command)) {
        }
    } catch (Exception e2) {
        POSMessageDialog.showMessage(com.floreantpos.util.POSUtil.getBackOfficeWindow(), e2.getMessage());
    }
}

From source file:org.roche.antibody.ui.components.AntibodyEditorPane.java

public void setModel(Antibody ab) {
    mainEditor.getFrame().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    this.antibody = ab;
    this.graphSyncer = new GraphSynchronizer(mainEditor, this, ab);
    createGraph();//from  w ww. ja  va  2 s  . c  o  m
    updateHELMTextArea();
    mainEditor.reset();
    mainEditor.getFrame().setCursor(Cursor.getDefaultCursor());
    updateGraphLayout();
    isBackToDomainEditorEnabled = false;
}

From source file:de.unibayreuth.bayeos.goat.panels.timeseries.JPanelChart.java

private void setPanMode(boolean val) {

    this.chartPanel.setHorizontalZoom(!val);
    // chartPanel.setHorizontalAxisTrace(! val);
    this.chartPanel.setVerticalZoom(!val);
    // chartPanel.setVerticalAxisTrace(! val);

    if (val) {
        this.chartPanel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    } else {// www. j  a v  a  2s .  c  o m
        this.chartPanel.setCursor(Cursor.getDefaultCursor());
    }
}

From source file:biz.wolschon.finance.jgnucash.panels.TaxReportPanel.java

/**
 * Show a dialog to export//from  www .j  a  va  2 s  .  co  m
 * a CSV-file that contains the
 * shown {@link TransactionSum}s
 * for each month, year or day.
 */
protected void showExportCSVDialog() {
    JFileChooser fc = new JFileChooser();
    fc.setAcceptAllFileFilterUsed(true);
    fc.addChoosableFileFilter(new FileFilter() {

        @Override
        public boolean accept(final File aF) {
            return aF.isDirectory() || aF.getName().endsWith(".csv");
        }

        @Override
        public String getDescription() {
            return "CSV-file";
        }
    });
    int dialogResult = fc.showSaveDialog(this);
    if (dialogResult != JFileChooser.APPROVE_OPTION) {
        return;
    }
    File file = fc.getSelectedFile();
    if (file.exists()) {
        int confirmation = JOptionPane.showConfirmDialog(this, "File exists. Replace file?");
        if (confirmation != JOptionPane.YES_OPTION) {
            showExportCSVDialog();
            return;
        }
    }
    ExportGranularities gran = (ExportGranularities) myExportGranularityCombobox.getSelectedItem();
    try {
        setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
        exportCSV(file, gran);
    } finally {
        setCursor(Cursor.getDefaultCursor());
    }
}

From source file:org.yccheok.jstock.gui.LoadFromCloudJDialog.java

private void jLabel5MouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel5MouseExited
    this.setCursor(Cursor.getDefaultCursor());
}

From source file:de.juwimm.cms.gui.admin.PanUnitGroupPerUser.java

public void reload() {
    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            setCursor(new Cursor(Cursor.WAIT_CURSOR));
            try {
                setPickerEnabled(false);
                tblUser.setEnabled(false);
                userTableModel = new UserTableModel(false);
                TableSorter tblSorter = new TableSorter(userTableModel, tblUser.getTableHeader());

                GroupValue[] groups = null;
                if (!comm.isUserInRole(UserRights.SITE_ROOT)) {
                    groups = comm.getGroups();
                } else {
                    groups = comm.getAllGroups();
                }//  w  w  w  .  j  ava2  s  .  c o m
                if (groups != null) {
                    allGroupsOfCaller = new DropDownHolder[groups.length];
                    for (int i = groups.length - 1; i >= 0; i--) {
                        allGroupsOfCaller[i] = new DropDownHolder(groups[i], groups[i].getGroupName());
                    }
                }
                UnitValue[] units = comm.getUnits();
                if (units != null) {
                    allUnits = new DropDownHolder[units.length];
                    for (int i = units.length - 1; i >= 0; i--) {
                        allUnits[i] = new DropDownHolder(units[i], units[i].getName());
                    }
                }

                UserValue[] uv = comm.getAllUser();
                if (uv != null) {
                    if (comm.isUserInRole(UserRights.SITE_ROOT)) {
                        userTableModel.addRows(uv);
                    } else {
                        UserValue me = comm.getUser();
                        for (int i = 0; i < uv.length; i++) {
                            boolean isSiteRoot = comm.isUserInRole(uv[i], UserRights.SITE_ROOT);
                            boolean isMe = uv[i].getUserName().equalsIgnoreCase(me.getUserName());
                            if (!isSiteRoot) {
                                userTableModel.addRow(uv[i]);
                            }
                        }
                    }
                }

                tblUser.setModel(tblSorter);
                unitPickData.getLstLeftModel().clear();
                unitPickData.getLstRightModel().clear();
                groupPickData.getLstLeftModel().clear();
                groupPickData.getLstRightModel().clear();
            } catch (Exception exe) {
                log.error("Error reloading tables: ", exe);
            }
            tblUser.setEnabled(true);
            setCursor(Cursor.getDefaultCursor());
        }
    });
}

From source file:de.juwimm.cms.gui.admin.PanUnitGroupPerUser.java

public void save() {
    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    setPickerEnabled(false);/* w  w  w  . ja v  a 2s.  com*/
    btnSave.setEnabled(false);
    if (currentSelected >= 0)
        saveChanges(currentSelected);
    setPickerEnabled(true);
    btnSave.setEnabled(true);
    setCursor(Cursor.getDefaultCursor());
}

From source file:no.imr.sea2data.stox.InstallerUtil.java

public static boolean installRstox(Window wnd, String ftpPath, String rFolder) {
    //        String pkgFile = getIOTempDirFile(RSTOX + TARGZ);
    //        retrieveRstox(ftpPath, pkgFile);
    wnd.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    try {/*from  www . j  a  va2s  . co m*/
        return RUtils.installRstox(ftpPath, rFolder);
    } finally {
        wnd.setCursor(Cursor.getDefaultCursor());
    }
}