Example usage for java.awt Cursor DEFAULT_CURSOR

List of usage examples for java.awt Cursor DEFAULT_CURSOR

Introduction

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

Prototype

int DEFAULT_CURSOR

To view the source code for java.awt Cursor DEFAULT_CURSOR.

Click Source Link

Document

The default cursor type (gets set if no cursor is defined).

Usage

From source file:v800_trainer.JCicloTronic.java

private void Histogramm_PanelComponentShown(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_Histogramm_PanelComponentShown
    // Add your handling code here:
    setCursor(new Cursor(Cursor.WAIT_CURSOR));
    if (SelectionChanged) {
        Statistik_PanelComponentShown_StatistikStarten(evt);
        Update_Graphik_paint = true;//  w  w w.j av  a2  s  .  c o  m
        Update_Map_paint = true;
        alteAuswahl = -2;
    }

    if (Auswahl_Histogramm.getSelectedIndex() == 0) {
        Summenhistogramm_Check.setEnabled(true);
    } else {
        Summenhistogramm_Check.setEnabled(false);
    }

    UpdateHistogram();
    setCursor(new Cursor(Cursor.DEFAULT_CURSOR));

}

From source file:v800_trainer.JCicloTronic.java

private void Graphik_PanelComponentShown(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_Graphik_PanelComponentShown
    // Add your handling code here:

    setCursor(new Cursor(Cursor.WAIT_CURSOR));
    if (SelectionChanged) {
        Statistik_PanelComponentShown_StatistikStarten(evt);
        Update_XYGraphik();//from   w ww  .j  a  v a2 s  .  c  o  m

    }
    if (Update_Graphik_paint == true) {
        Update_XYGraphik();
    }

    Update_Map_paint = true;
    setCursor(new Cursor(Cursor.DEFAULT_CURSOR));

}

From source file:org.jab.docsearch.DocSearch.java

private void deleteRecursive(String folderToDelete) {
    int curFoldNum = 0;
    File curFolderFile;//from   w w w. j a v  a  2  s  .co m
    String curFold = "";
    String[] subFolds;
    int numSubFolds = 0;
    int totalFolds = 0;
    int numFiles = 0;
    String curFolderString = "";
    String curFileString = "";
    File testFile;
    try {
        // first obtain a list of all folders
        setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
        ArrayList<String> allFold = new ArrayList<String>();
        allFold.add(folderToDelete);
        setStatus(dsRmvgIdxFis);
        do {
            // get list of sub folders
            curFolderString = allFold.get(curFoldNum);
            curFolderFile = new File(curFolderString);
            subFolds = curFolderFile.list(ff);
            numSubFolds = subFolds.length;
            for (int y = 0; y < numSubFolds; y++) {
                curFold = curFolderString + pathSep + subFolds[y] + pathSep;
                curFold = Utils.replaceAll(pathSep + pathSep, curFold, pathSep);
                allFold.add(curFold);
                totalFolds++;
            }
            curFoldNum++;
        } while (curFoldNum < totalFolds);
        // next get a list of all files
        ArrayList<String> allFiles = new ArrayList<String>();
        Iterator<String> foldIt = allFold.iterator();
        String[] filesString;
        while (foldIt.hasNext()) {
            curFolderString = foldIt.next();
            curFolderFile = new File(curFolderString);
            // get the files
            filesString = curFolderFile.list();
            numFiles = filesString.length;
            for (int y = 0; y < numFiles; y++) {
                // add the files
                curFileString = curFolderString + pathSep + filesString[y];
                curFileString = Utils.replaceAll(pathSep + pathSep, curFileString, pathSep);
                testFile = new File(curFileString);
                if (!testFile.isDirectory()) {
                    allFiles.add(curFileString);
                }
            }
        }
        // end for iterating
        // delete all files
        Iterator<String> fileIt = allFiles.iterator();
        while (fileIt.hasNext()) {
            curFileString = fileIt.next();
            testFile = new File(curFileString);
            testFile.delete();
        }
        // end while deleteing
        // delete all folders
        int numFoldTotal = allFiles.size();
        for (int y = numFoldTotal - 1; y >= 0; y--) {
            curFolderString = allFiles.get(y);
            curFolderFile = new File(curFolderString);
            logger.info("deleteRecursive() " + I18n.getString("deleting") + " " + curFolderString);
            curFolderFile.delete();
        }
        // delete last folder
        curFolderFile = new File(folderToDelete);
        curFolderFile.delete();
    }
    // end for trrying recursive delete
    catch (Exception e) {
        showMessage(I18n.getString("error"), e.toString());
    } finally {
        setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
        setStatus(I18n.getString("index_removed"));
    }
}

From source file:de.main.sessioncreator.DesktopApplication1View.java

private void btnWizardNext(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnWizardNext
    int selTab = wizardtabp.getSelectedIndex();
    int maxTab = wizardtabp.getTabCount();
    try {/* w w w  .ja va  2s  .  co  m*/
        wizardbtnBack.setEnabled(true);
        wizardbtntopBack.setEnabled(true);
        wizardtabp.setSelectedIndex(selTab + 1);

        if (wizardtabp.getTitleAt(wizardtabp.getSelectedIndex()).contains("Charter")) {
            wizardChckBxNewCharter.addActionListener(new chckBxNewCharterListener());
            swingHelper.setTab1EnableAt(wizardtabp, 1);
            progressBar.setVisible(true);
            progressBar.setIndeterminate(true);
            wizardbtnBack.setEnabled(false);
            wizardbtntopBack.setEnabled(false);
            wizardbtnNext.setEnabled(false);
            wizardbtntopNext.setEnabled(false);
            mainPanel.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
            wizardCmbxCharter.removeAllItems();
            fileHelper.charterList.clear();
            final File directory = new File(wizardTfPathTodo.getText());
            worker = new SwingWorker<String, Void>() {

                @Override
                protected String doInBackground() {
                    return getCharterBackgroundW(directory);
                }

                @Override
                protected void done() {
                    try {
                        if (!worker.get().contains("no")) {
                            progressBar.setIndeterminate(false);
                            progressBar.setVisible(false);
                            wizardbtnBack.setEnabled(true);
                            wizardbtntopBack.setEnabled(true);
                            wizardbtnNext.setEnabled(true);
                            wizardbtntopNext.setEnabled(true);
                            int no = wizardCmbxCharter.getItemCount();
                            wizardLblChooseCharter.setText("Please select one of " + no + " Charter");
                            mainPanel.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
                        } else {
                            progressBar.setIndeterminate(false);
                            progressBar.setVisible(false);
                            wizardbtnBack.setEnabled(true);
                            wizardbtntopBack.setEnabled(true);
                            wizardbtnNext.setEnabled(false);
                            wizardbtntopNext.setEnabled(false);
                            mainPanel.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
                        }
                    } catch (InterruptedException ex) {
                        Logger.getLogger(DesktopApplication1View.class.getName()).log(Level.SEVERE, null, ex);
                    } catch (ExecutionException ex) {
                        Logger.getLogger(DesktopApplication1View.class.getName()).log(Level.SEVERE, null, ex);
                    }
                }
            };
            worker.execute();
        }
        if (wizardtabp.getTitleAt(wizardtabp.getSelectedIndex()).contains("Areas")) {
            swingHelper.setTab1EnableAt(wizardtabp, 2);
            progressBar.setVisible(true);
            progressBar.setIndeterminate(true);
            wizardbtnBack.setEnabled(false);
            wizardbtntopBack.setEnabled(false);
            wizardbtnNext.setEnabled(false);
            wizardbtntopNext.setEnabled(false);
            wizardbtnAddAreas.setEnabled(false);
            if (wizardtaChoosenAreas.getDocument().getLength() == 0) {
                wizardbtnRemoveArea.setEnabled(false);
            } else {
                wizardbtnRemoveArea.setEnabled(true);
            }

            wizardtaChoosenAreas.getDocument().addDocumentListener(new choosenAreaListener());
            wizardtabpAreas.removeAll();
            final File coverageini = new File(wizardtfCoverageini.getText());
            getAreasBacgroundW(coverageini);
            wizardbtnBack.setEnabled(true);
            wizardbtntopBack.setEnabled(true);
            wizardbtnNext.setEnabled(true);
            wizardbtntopNext.setEnabled(true);
            if (wizardChckBxNewCharter.isSelected()) {
                wizardbtnSaveTodo.setEnabled(true);
            }
            wizardbtnNext.setText("Create Testsession");
            progressBar.setIndeterminate(false);
            progressBar.setVisible(false);
            if (!wizardChckBxNewCharter.isSelected()) {
                String todo = ChoosenCharter.substring(ChoosenCharter.indexOf("(" + wizardTfPathTodo.getText()))
                        .replace("(", "").replace(")", "");
                final File todocheckliste = new File(todo);
                String msg = "Import all Areas from the Todo-Session?";
                fileHelper.getAreasChecklist(todocheckliste);
                fileHelper.areaChecklist.remove(0);
                if (!fileHelper.areaChecklist.get(0).isEmpty()) {
                    if (JOptionPane.showConfirmDialog(wizardtabpAreas, msg, "Import?",
                            JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE) == 0) {
                        wizardtaChoosenAreas.setText("");
                        for (String s : fileHelper.areaChecklist) {
                            wizardtaChoosenAreas.append(s + "\n");
                        }
                        wizardtaChoosenAreas.setCaretPosition(0);
                    }
                }
            }
        }
        if (wizardtabp.getTitleAt(wizardtabp.getSelectedIndex()).contains("Testsession")) {
            swingHelper.setTab1EnableAt(wizardtabp, 3);
            wizardbtnNext.setVisible(false);
            wizardbtntopNext.setEnabled(false);
            wizardbtnStart.addActionListener(new ButtonListenerStart());
            wizardbtntopStart.addActionListener(new ButtonListenerStart());
            wizardbtnStop.addActionListener(new ButtonListenerStop());
            wizardbtntopStop.addActionListener(new ButtonListenerStop());
            if (wizardChckBxNewCharter.isSelected()) {
                wizardtaCharterdynamic.setText(wizardtaNewCharter.getText().trim());
            } else {
                wizardtaCharterdynamic.setText(
                        ChoosenCharter.substring(0, ChoosenCharter.indexOf("(" + wizardTfPathTodo.getText())));
            }
            statusMessageLabel.setText("");
            wizardbtnStart.setVisible(true);
            wizardbtnStart.setEnabled(true);
            wizardbtntopStart.setEnabled(true);
            wizardbtnStop.setVisible(true);
            wizardbtnStop.setEnabled(false);
            wizardbtntopStop.setEnabled(false);
            final JPopupMenu popupMenu = new JPopupMenu();
            final File coverageini = new File(wizardtfCoverageini.getText());
            swingHelper.getAreastoPopupMenu(popupMenu, coverageini, new alBugsIssue());
            popupListener2 = new PopupListener(popupMenu);
            wizardtaTestsessionAreas.addMouseListener(popupListener2);
            wizardtaTestsessionAreas.setText(wizardtaChoosenAreas.getText());
            wizardtaTestsessionAreas.setCaretPosition(0);
            wizardtaCharterdynamic.setCaretPosition(0);
            if (wizardChckBxSecondTester.isSelected()) {
                TesterRealname = wizardCmbxTester.getSelectedItem().toString();
                wizardtfNameOfTester.setText(TesterRealname.substring(4) + " "
                        + wizardCmbxMoreTester.getSelectedItem().toString().substring(4));
            } else {
                TesterRealname = wizardCmbxTester.getSelectedItem().toString();
                wizardtfNameOfTester.setText(TesterRealname.substring(4));
            }
        }
        if (wizardtabp.getSelectedIndex() == maxTab) {
            wizardbtnNext.setEnabled(false);
            wizardbtntopNext.setEnabled(false);
        }
    } catch (IndexOutOfBoundsException ex) {
        statusMessageLabel.setText(ex.getMessage());
    }
}

From source file:com.monead.semantic.workbench.SemanticWorkbench.java

/**
 * Sets the mouse pointer. If the supplied parameter is true then the wait
 * cursor (usually an hourglass) is displayed. otherwise the system default
 * cursor is displayed.//w w  w.  j a  v  a  2s .com
 * 
 * @param wait
 *          Whether to display the system default wait cursor
 */
private void setWaitCursor(boolean wait) {
    final JRootPane rootPane = getRootPane();
    final Component glassPane = rootPane.getGlassPane();

    if (wait) {
        final Cursor cursorWait = Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR);
        rootPane.setCursor(cursorWait);
        glassPane.setCursor(cursorWait);
        glassPane.setVisible(true);
    } else {
        final Cursor cursorDefault = Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR);
        glassPane.setVisible(false);
        glassPane.setCursor(cursorDefault);
        rootPane.setCursor(cursorDefault);
    }

    glassPane.invalidate();
    rootPane.validate();
}

From source file:v800_trainer.JCicloTronic.java

private void Statistik_PanelComponentShown_StatistikStarten(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_Statistik_PanelComponentShown_StatistikStarten

    setCursor(new Cursor(Cursor.WAIT_CURSOR));
    if (SelectionChanged) {
        clearStatistik();/*w  ww .j  a v  a2  s  .  c o  m*/

        alteAuswahl = -5;

        Statistikhandle = new JStatistik();
        Statistikhandle.StatistikStart(this);//
        Update_Graphik_paint = true;
        xygraphik = null;
        graph_min = 0;
        graph_max = 999999999;
        graph_crosshair = 0;
        nozoom = true;

        Update_Map_paint = true;

    }

    if (Datentabelle.getSelectedRowCount() != 0) {
        if (Statistikhandle != null) {
            Statistikhandle.TourData[0].createSubStatistik(this, graph_min, graph_max);
        }
        setStatistik(Statistikhandle, Auswahl_Statistik.getSelectedIndex());
    } else {
        clearStatistik();
    }
    setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
}

From source file:v800_trainer.JCicloTronic.java

public void ChangeModel() {

    setCursor(new Cursor(Cursor.WAIT_CURSOR));
    if (Hauptfenster != null)
        Hauptfenster.setSelectedIndex(0);
    DataProperty = new java.util.Properties();

    jTableaccess = Datentabelle;/*from  w w w .  j a v a 2 s  .  c o  m*/
    String Filename = "";
    String PlaceHolder = "          ";
    File path = new File(Properties.getProperty("data.dir"));
    final String[] names = { "Datum", "Strecke", "Hhenmeter", "Zeit", "Titel" };

    String[] list = path.list(new DirFilter("_Tour.cfg"));

    RowCount = 0;
    int Anzahlcfg = 0;
    if (list != null)
        Anzahlcfg = list.length;
    if (Anzahlcfg == 0) {
        setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
        return;
    }

    Object datab[] = new Object[8];
    ArrayList<Object[]> data_list = new ArrayList<Object[]>();

    String hmString = "";
    DecimalFormat form = new DecimalFormat("0");//Format ohne Kommastelle
    int j = 0;
    for (int i = 0; i < Anzahlcfg; i++) { //berprfen ob Hhenmeter eingetragen sind - ansonsten ermitteln (gilt fr neue Dateien)
        Filename = path.getPath() + SystemProperties.getProperty("file.separator") + list[i];
        DataProperty = new java.util.Properties();
        try {

            BufferedInputStream in = new BufferedInputStream(new FileInputStream(Filename));
            DataProperty.load(in);
            in.close();
            // prfen ob Datei gezeigt werden soll - Visible = 0 wenn Datei gelscht wurde
            if (!DataProperty.getProperty("Visible", "1").equalsIgnoreCase("1"))
                continue;
            // wenn keine Hhenmeter eingetragen wurden (Erstaufruf) dann Hhenmeter ermitteln
            if (DataProperty.getProperty("Hoehenmeter", "novalue").equalsIgnoreCase("novalue")
                    && DataProperty.getProperty("Visible", "1").equalsIgnoreCase("1")
                    && !DataProperty.getProperty("Jahr", "keinEintrag").equalsIgnoreCase("keinEintrag")) {
                JTourData Dummydata = new JTourData(Filename.substring(0, Filename.lastIndexOf('.')), this);
                DataProperty.setProperty("Hoehenmeter", form.format(Dummydata.ges_Hoehep));
                try {
                    Ausgabedatei = new FileOutputStream(Filename);
                    DataProperty.store(Ausgabedatei,
                            "Tour Eigenschaften: " + DataProperty.getProperty("Jahr")
                                    + DataProperty.getProperty("Monat") + DataProperty.getProperty("Tag")
                                    + DataProperty.getProperty("Stunde") + DataProperty.getProperty("Minute"));
                    Ausgabedatei.close();
                } catch (Exception e) {
                    JOptionPane.showMessageDialog(null, " Fehler bei Speichern der DataProperty in ChangeModel",
                            "Achtung!", JOptionPane.ERROR_MESSAGE);

                }
            }

            try {
                if (Integer.parseInt(DataProperty.getProperty("Visible", "1")) == 1
                        && !DataProperty.getProperty("Jahr", "keinEintrag").equalsIgnoreCase("keinEintrag")) {

                    datab[0] = new String("  " + DataProperty.getProperty("Tag", "11") + "."
                            + DataProperty.getProperty("Monat", "11") + "."
                            + DataProperty.getProperty("Jahr", "1111"));
                    datab[1] = PlaceHolder.substring(0, 9 - DataProperty.getProperty("Strecke", "0").length())
                            + DataProperty.getProperty("Strecke", "0") + " ";
                    //                      data[j][1] = new String(DataProperty.getProperty("Strecke") + " ");
                    datab[2] = new String(
                            "  " + HMS(java.lang.Integer.parseInt(DataProperty.getProperty("Dauer", "0"))));
                    datab[3] = new String(DataProperty.getProperty("Titel", "---"));
                    datab[4] = new String(DataProperty.getProperty("Jahr", "1111") + "."
                            + DataProperty.getProperty("Monat", "11") + "."
                            + DataProperty.getProperty("Tag", "11") + "."
                            + DataProperty.getProperty("Stunde", "12") + "."
                            + DataProperty.getProperty("Minute", "59"));
                    datab[5] = new String(Filename.substring(0, Filename.lastIndexOf('.')));
                    datab[6] = new String(DataProperty.getProperty("Typ", "unbekannt"));
                    hmString = "" + (int) Float.parseFloat(DataProperty.getProperty("Hoehenmeter", "0"));
                    datab[7] = PlaceHolder.substring(0, 9 - hmString.length()) + hmString + " ";
                    data_list.add(datab.clone());
                }
            } catch (Exception e) {
                JOptionPane.showMessageDialog(null, "Fehler beim Erstellen der Datenliste " + e + " " + j,
                        "Achtung!", JOptionPane.ERROR_MESSAGE);
            }

        } catch (Exception e) {
            System.out.println(
                    "NEW IO-Fehler bei " + path.getPath() + SystemProperties.getProperty("file.separator")
                            + list[i] + "\n " + e + "   " + e.getLocalizedMessage() + "--File deleted");
            e.printStackTrace();
            JOptionPane.showMessageDialog(null,
                    "Fehler beim Einlesen eines cfg Files " + path.getPath()
                            + SystemProperties.getProperty("file.separator") + list[i] + "\n  wurde gelscht!",
                    "Achtung!", JOptionPane.ERROR_MESSAGE);
            File deletefile = new File(
                    path.getPath() + SystemProperties.getProperty("file.separator") + list[i]);
            if (deletefile.exists())
                deletefile.delete();
            ChangeModel();
        }
    }

    TableModel dataModel = new AbstractTableModel() {

        public int getColumnCount() {
            return names.length;
        }

        @Override
        public String getColumnName(int column) {
            return names[column];
        }

        @Override
        public int getRowCount() {
            return data_list.size();
        }

        @Override
        public Object getValueAt(int row, int col) {

            Object data[] = new Object[8];
            data = data_list.get(row);
            return data[col];
        }

        @Override
        public void setValueAt(Object Ob, int row, int col) {
            Object data[] = new Object[8];
            data = data_list.get(row);
            data[col] = Ob;
            data_list.set(row, data);

        }
    };

    sorter = new TableSorter(dataModel);
    DatumColumn = new TableColumn(0);
    DatumColumn.setHeaderValue(names[0]);
    DatumColumn.setResizable(false);
    StreckeColumn = new TableColumn(1);
    StreckeColumn.setHeaderValue(names[1]);
    StreckeColumn.setResizable(false);
    HoeheColumn = new TableColumn(7);
    HoeheColumn.setHeaderValue(names[2]);
    HoeheColumn.setResizable(false);
    ZeitColumn = new TableColumn(2);
    ZeitColumn.setHeaderValue(names[3]);
    ZeitColumn.setResizable(false);
    NotizColumn = new TableColumn(3);
    NotizColumn.setHeaderValue(names[4]);

    DatumColumn.setMinWidth((int) 80 * FontSize / 12);
    StreckeColumn.setMinWidth((int) 65 * FontSize / 12);
    HoeheColumn.setMinWidth((int) 75 * FontSize / 12);
    ZeitColumn.setMinWidth((int) 75 * FontSize / 12);
    NotizColumn.setMinWidth((int) 75 * FontSize / 12);
    NotizColumn.setPreferredWidth((int) 75 * FontSize / 12 + 1000);
    DefaultTableCellRenderer TableCell = new DefaultTableCellRenderer();
    TableCell.setHorizontalAlignment(JLabel.CENTER);
    HoeheColumn.setCellRenderer(TableCell);
    StreckeColumn.setCellRenderer(TableCell);
    DatumColumn.setCellRenderer(TableCell);
    ZeitColumn.setCellRenderer(TableCell);
    HoeheColumn.setHeaderRenderer(TableCell);
    StreckeColumn.setHeaderRenderer(TableCell);
    DatumColumn.setHeaderRenderer(TableCell);
    ZeitColumn.setHeaderRenderer(TableCell);
    NotizColumn.setHeaderRenderer(TableCell);

    DefaultTableColumnModel FileTableModel = new DefaultTableColumnModel();
    FileTableModel.addColumn(DatumColumn);
    FileTableModel.addColumn(StreckeColumn);
    FileTableModel.addColumn(HoeheColumn);
    FileTableModel.addColumn(ZeitColumn);
    FileTableModel.addColumn(NotizColumn);

    Datentabelle.setModel(sorter);
    Datentabelle.setColumnModel(FileTableModel);
    Datentabelle.setRowHeight(FontSize + 5);
    sorter.addMouseListenerToHeaderInTable(Datentabelle);
    sorter.sortByColumn(0, false);
    Datentabelle.clearSelection();
    SelectionChanged = true;

    JScrollBar verticaldummy = Datenliste_scroll_Panel.getVerticalScrollBar();

    verticaldummy.setPreferredSize(new Dimension(FontSize + 10, FontSize + 10));
    Datenliste_scroll_Panel.setVerticalScrollBar(verticaldummy);

    Update = false;
    Datenliste_Jahr.removeAllItems();
    Datenliste_TourTyp.removeAllItems();
    Auswahl_bersicht.removeAllItems();
    JahrVergleich.removeAllItems();

    InitComboJahr();
    InitComboTyp();

    Update = true;

    if (Datentabelle.getRowCount() != 0) {
        Datentabelle.addRowSelectionInterval(0, 0);
        Datenliste_scroll_Panel.getViewport().setViewPosition(new java.awt.Point(0, 0));
    }

    if (Uebersicht != null) {
        Uebersicht = null;
    }
    jLabel69_Selektiert.setText(Datentabelle.getSelectedRowCount() + " / " + Datentabelle.getRowCount());

    repaint();
    setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
}

From source file:org.openmicroscopy.shoola.agents.treeviewer.view.TreeViewerComponent.java

/**
 * Implemented as specified by the {@link TreeViewer} interface.
 * @see TreeViewer#onNodesMoved()//from   w ww . jav  a 2s  .c  o m
 */
public void onNodesMoved() {
    if (model.getState() != SAVE)
        return;
    model.setState(READY);
    fireStateChange();
    view.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

    view.removeAllFromWorkingPane();
    DataBrowserFactory.discardAll();

    Browser browser = model.getSelectedBrowser();
    browser.refreshTree(null, null);
    model.getMetadataViewer().setRootObject(null, -1, null);
    setStatus(false, "", true);
    view.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}

From source file:lu.fisch.unimozer.Diagram.java

public void printDiagram() {
    // print preview takes a lot of memory (don't know why)
    // so it is a good idea to sugest to the JVM to clean up the heap
    System.gc();//from   w  w  w  .  j av  a2s .c o  m
    printOptions = PrintOptions.showModal(frame, "Print options");
    if (printOptions.OK == true) {
        this.deselectAll();
        this.cleanAll();
        this.repaint();

        if (printOptions.getJob() == PrintOptions.JOB_PREVIEW) {
            PrintPreview pp = new PrintPreview(frame, this);
            pp.setLocation(Math.round((frame.getWidth() - pp.getWidth()) / 2 + frame.getLocation().x),
                    (frame.getHeight() - pp.getHeight()) / 2 + frame.getLocation().y);
            pp.setVisible(true);
        } else {
            try {
                // Use default printer, no dialog
                PrinterJob prnJob = PrinterJob.getPrinterJob();

                // get the default page format
                PageFormat pf0 = prnJob.defaultPage();
                // clone it
                PageFormat pf1 = (PageFormat) pf0.clone();
                Paper p = pf0.getPaper();
                // set to zero margin
                p.setImageableArea(0, 0, pf0.getWidth(), pf0.getHeight());
                pf1.setPaper(p);
                // let the printer validate it
                PageFormat pf2 = prnJob.validatePage(pf1);
                //prnJob.pageDialog(prnJob.defaultPage());

                prnJob.setPrintable(this, pf2);
                if (prnJob.printDialog()) {
                    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                    prnJob.print();
                    setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
                }
            } catch (PrinterException ex) {
                ex.printStackTrace();
                System.err.println("Printing error: " + ex.toString());
            }
        }
    }
    System.gc();
}

From source file:UI.MainUI.java

private void forecastBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_forecastBtnActionPerformed
    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    DefaultTableModel dtm = (DefaultTableModel) forecastTable.getModel();
    dtm.setRowCount(0);/*from w  w w  . j  ava2s.  c  om*/
    dtm.setRowCount(4);

    if (algo == 1) {
        startFForecast();
    } else {
        startRForecast();
    }

    setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));

}