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:us.paulevans.basicxslt.Utils.java

/**
 * Displays an error dialog// w  w  w.j  av  a  2s. co m
 * @param aParent
 * @param aThrowable
 */
public static void showErrorDialog(Frame aParent, Throwable aThrowable) {

    String message;
    Throwable throwableToReport;

    throwableToReport = ExceptionUtils.getRootCause(aThrowable);
    if (throwableToReport == null) {
        throwableToReport = aThrowable;
    }
    message = throwableToReport.getMessage();
    if (StringUtils.isBlank(message)) {
        message = ExceptionUtils.getStackTrace(throwableToReport);
    }
    if (aParent != null) {
        aParent.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
    }
    JOptionPane.showMessageDialog(aParent,
            MessageFormat.format(stringFactory.getString(LabelStringFactory.ERRORS_MESSAGE), message,
                    AppConstants.BUG_HOME_URL),
            stringFactory.getString(LabelStringFactory.ERRORS_TITLE), JOptionPane.ERROR_MESSAGE);
}

From source file:nz.govt.natlib.ndha.manualdeposit.bulkupload.BulkUploadForm.java

public void setWaitCursor(final boolean isWaiting) {
    glass.setVisible(isWaiting);/*from www. j av  a2  s .co 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:edu.scripps.fl.pubchem.xmltool.gui.PubChemXMLExtractorGUI.java

public void actionPerformed(ActionEvent e) {
    try {/*from ww  w  .jav a2 s  . c  om*/
        setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
        if (e.getSource() == jbnFileXML)
            gc.fileChooser(jtfFileXML, "", "open");
        else if (e.getSource() == jbnRunExtractor) {
            URL template = templateForExcel();
            File fileExcelOutput = extract(template);
            if (fileExcelOutput != null) {
                log.info("Opening excel file through Desktop: " + fileExcelOutput);
                Desktop.getDesktop().open(fileExcelOutput);
            }
        } else if (e.getSource() == jbnCreateReport) {
            URL template = getClass().getClassLoader().getResource("ExcelTemplate.xlsx");
            File fileExcelOutput = extract(template);
            if (fileExcelOutput != null) {
                log.info("Opening report through Desktop: " + fileExcelOutput);
                String fileName = FilenameUtils.removeExtension(fileExcelOutput.getAbsolutePath());
                File filePDFOutput = new File(fileName + ".pdf");
                File fileWordOutput = new File(fileName + ".docx");
                filePDFOutput.deleteOnExit();
                fileWordOutput.deleteOnExit();
                new ReportController().createReport(pcDep, fileExcelOutput, filePDFOutput, fileWordOutput,
                        isInternal);
                gc.openPDF(isInternal, filePDFOutput, this);
                Desktop.getDesktop().open(fileWordOutput);
            }
        }
        setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
    } catch (Throwable throwable) {
        SwingGUI.handleError(this, throwable);
    }

}

From source file:com.mirth.connect.manager.ManagerController.java

public void startMirthWorker() {
    PlatformUI.MANAGER_DIALOG.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    ManagerController.getInstance().setEnabledOptions(false, false, false, false);

    SwingWorker<Void, Void> worker = new SwingWorker<Void, Void>() {
        private String errorMessage = null;

        public Void doInBackground() {
            errorMessage = startMirth();
            return null;
        }/*w w w.  j a  v a  2s . c  o m*/

        public void done() {
            if (errorMessage == null) {
                PlatformUI.MANAGER_TRAY.alertInfo("The Mirth Connect Service was started successfully.");
            } else {
                PlatformUI.MANAGER_TRAY.alertError(errorMessage);
            }

            updateMirthServiceStatus();
            PlatformUI.MANAGER_DIALOG.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
        }
    };

    worker.execute();
}

From source file:com.supermap.desktop.icloud.CloudLicenseDialog.java

private void login() {
    userName = textFieldUserName.getText();
    passWord = String.valueOf(fieldPassWord.getPassword());
    this.setCursor(new Cursor(Cursor.WAIT_CURSOR));
    CloseableHttpClient client = LicenseServiceFactory.getClient(userName, passWord);
    if (null == client) {
        this.labelWarning.setForeground(Color.red);
        this.labelWarning.setText(CommonProperties.getString("String_PermissionCheckFailed"));
    } else {//w w w .j  av a 2s .c o m
        this.labelWarning.setText("");
        try {
            //       CloudLicense.login(userName, passWord);
            //       saveToken();
            //       dialogResult = DIALOGRESULT_OK;
            //       dispose();
            licenseService = LicenseServiceFactory.create(client, ProductType.IDESKTOP);
            licenseId = LicenseManager.getFormalLicenseId(licenseService);
            if (null != licenseId) {
                //??id??
                formalLicenseResponse = LicenseManager.applyFormalLicense(licenseService, licenseId);
                dialogResult = DIALOGRESULT_OK;
                saveToken();
            } else {
                //??id,?
                trialLicenseResponse = LicenseManager.applyTrialLicense(licenseService);
                dialogResult = DIALOGRESULT_OK;
                saveToken();
            }
        } catch (AuthenticationException e1) {
            dialogResult = DIALOGRESULT_CANCEL;
        } finally {
            this.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
            removeEvents();
            dispose();
        }
    }
}

From source file:com.vgi.mafscaling.MafChartPanel.java

public void mouseReleased(MouseEvent arg0) {
    IsMovable = false;
    initialMovePointY = 0;
    chartPanel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
}

From source file:fxts.stations.ui.help.HelpPane.java

/**
 * Inits all components.//from  ww  w  .  j  a v  a2  s .com
 */
private void initComponents() {
    //creates history
    mHistory = new HelpContentHistory();
    //Create the text area for contents
    mTabbedPane = new JTabbedPane();

    //creates content tree
    mContentTree = new ContentTree("fxts/stations/trader/resources/help/contents.xml");
    mContentTree.addListener(this);

    //Create the scroll pane and add the tree to it.
    JScrollPane treeView = new JScrollPane(mContentTree.getTree());
    mTabbedPane.addTab(mResMan.getString("IDS_HELP_CONTENTS", "Contents"), treeView);

    //xxx workaround for bug #6424509, memory leak
    JEditorPane.registerEditorKitForContentType("text/html", WeakHTMLEditorKit.class.getName());
    //creates the text area for the showing of the help.
    mHtmlPage = new JEditorPane();
    mHtmlPage.setEditable(false);
    mHtmlPage.putClientProperty("charset", "UTF-16");
    mHtmlPage.addHyperlinkListener(new HyperlinkListener() {
        public void hyperlinkUpdate(HyperlinkEvent aEvent) {
            if (aEvent.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
                try {
                    onSelectContentByHyperlink(aEvent.getURL());
                    mHtmlPage.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
                } catch (Exception e) {
                    mLogger.error("Hiperlink not processed!");
                    e.printStackTrace();
                }
            }
        }
    });
    JScrollPane scrollPane = new JScrollPane(mHtmlPage);

    //creates a split pane for the change log and the text area.
    mSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, mTabbedPane, scrollPane);
    mSplitPane.setOneTouchExpandable(true);

    //Creates the toolbar area.
    JToolBar toolbar = UIManager.getInst().createToolBar();
    toolbar.setFloatable(false);

    //creates label with left arrow
    UIManager uiMan = UIManager.getInst();
    mBackButton = uiMan.createButton(null, "ID_HELP_LEFT_ARROW", "ID_HELP_LEFT_ARROW_DESC",
            "ID_HELP_LEFT_ARROW_DESC");
    mBackButton.setEnabled(false);
    mBackButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent aEvent) {
            if (mHistory.hasBackStep()) {
                mIsHistorycalStep = true;
                onSelectContent(mHistory.back());
                mBackButton.setEnabled(mHistory.hasBackStep());
                mForwardButton.setEnabled(mHistory.hasForwardStep());
            }
        }
    });
    toolbar.add(mBackButton);

    //creates label with right arrow
    mForwardButton = uiMan.createButton(null, "ID_HELP_RIGHT_ARROW", "ID_HELP_RIGHT_ARROW_DESC",
            "ID_HELP_RIGHT_ARROW_DESC");
    mForwardButton.setEnabled(false);
    mForwardButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent aEvent) {
            if (mHistory.hasForwardStep()) {
                mIsHistorycalStep = true;
                onSelectContent(mHistory.forward());
                mBackButton.setEnabled(mHistory.hasBackStep());
                mForwardButton.setEnabled(mHistory.hasForwardStep());
            }
        }
    });
    toolbar.add(mForwardButton);

    //creates label with up arrow
    mUpButton = uiMan.createButton(null, "ID_HELP_UP_ARROW", "ID_HELP_UP_ARROW_DESC", "ID_HELP_UP_ARROW_DESC");
    mUpButton.setEnabled(mContentTree.getIterator().hasPrevious());
    mUpButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent aEvent) {
            mContentsBrowsing = true;
            onSelectContent(mContentTree.getIterator().previous());
            mUpButton.setEnabled(mContentTree.getIterator().hasPrevious());
            mDownButton.setEnabled(mContentTree.getIterator().hasNext());
        }
    });
    toolbar.add(mUpButton);

    //creates label with down arrow
    mDownButton = uiMan.createButton(null, "ID_HELP_DOWN_ARROW", "ID_HELP_DOWN_ARROW_DESC",
            "ID_HELP_DOWN_ARROW_DESC");
    mDownButton.setEnabled(mContentTree.getIterator().hasNext());
    mDownButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent aEvent) {
            mContentsBrowsing = true;
            onSelectContent(mContentTree.getIterator().next());
            mUpButton.setEnabled(mContentTree.getIterator().hasPrevious());
            mDownButton.setEnabled(mContentTree.getIterator().hasNext());
        }
    });
    toolbar.add(mDownButton);

    //sets layout
    setLayout(new BorderLayout());

    //add the components to the frame.
    add(mSplitPane, BorderLayout.CENTER);
    add(toolbar, BorderLayout.NORTH);

    //sets first page
    onSelectContent(mContentTree.getIterator().toBegin());
}

From source file:org.tinymediamanager.ui.movies.dialogs.MovieBatchEditorDialog.java

/**
 * Instantiates a new movie batch editor.
 * /*from  ww  w .  j  a  v  a2  s. c o  m*/
 * @param movies
 *          the movies
 */
public MovieBatchEditorDialog(final List<Movie> movies) {
    super(BUNDLE.getString("movie.edit"), "movieBatchEditor"); //$NON-NLS-1$
    setBounds(5, 5, 350, 230);
    getContentPane().setLayout(new BorderLayout(0, 0));

    {
        JPanel panelContent = new JPanel();
        getContentPane().add(panelContent, BorderLayout.CENTER);
        panelContent.setLayout(new FormLayout(new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC,
                FormSpecs.DEFAULT_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC,
                ColumnSpec.decode("default:grow"), FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC,
                FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, },
                new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                        FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC,
                        FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                        FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC,
                        FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                        FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC,
                        FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC,
                        FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, }));

        JLabel lblGenres = new JLabel(BUNDLE.getString("metatag.genre")); //$NON-NLS-1$
        panelContent.add(lblGenres, "2, 2, 2, 1, right, default");

        // cbGenres = new JComboBox(MediaGenres2.values());
        cbGenres = new AutocompleteComboBox(MediaGenres.values());
        cbGenres.setEditable(true);
        panelContent.add(cbGenres, "5, 2, fill, default");

        JButton btnAddGenre = new JButton("");
        btnAddGenre.setIcon(IconManager.LIST_ADD);
        btnAddGenre.setMargin(new Insets(2, 2, 2, 2));
        btnAddGenre.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                changed = true;
                setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                MediaGenres genre = null;
                Object item = cbGenres.getSelectedItem();

                // genre
                if (item instanceof MediaGenres) {
                    genre = (MediaGenres) item;
                }

                // newly created genre?
                if (item instanceof String) {
                    genre = MediaGenres.getGenre((String) item);
                }
                // MediaGenres2 genre = (MediaGenres2) cbGenres.getSelectedItem();
                if (genre != null) {
                    for (Movie movie : moviesToEdit) {
                        movie.addGenre(genre);
                    }
                }
                setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
            }
        });
        panelContent.add(btnAddGenre, "7, 2");

        JButton btnRemoveGenre = new JButton("");
        btnRemoveGenre.setIcon(IconManager.LIST_REMOVE);
        btnRemoveGenre.setMargin(new Insets(2, 2, 2, 2));
        btnRemoveGenre.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                changed = true;
                setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                MediaGenres genre = (MediaGenres) cbGenres.getSelectedItem();
                for (Movie movie : moviesToEdit) {
                    movie.removeGenre(genre);
                }
                setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
            }
        });
        panelContent.add(btnRemoveGenre, "9, 2");

        JLabel lblTags = new JLabel(BUNDLE.getString("metatag.tags")); //$NON-NLS-1$
        panelContent.add(lblTags, "2, 4, 2, 1, right, default");

        cbTags = new AutocompleteComboBox(movieList.getTagsInMovies().toArray());
        cbTags.setEditable(true);
        panelContent.add(cbTags, "5, 4, fill, default");

        JButton btnAddTag = new JButton("");
        btnAddTag.setIcon(IconManager.LIST_ADD);
        btnAddTag.setMargin(new Insets(2, 2, 2, 2));
        btnAddTag.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                changed = true;
                setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                String tag = (String) cbTags.getSelectedItem();
                if (StringUtils.isBlank(tag)) {
                    return;
                }

                for (Movie movie : moviesToEdit) {
                    movie.addToTags(tag);
                }
                setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
            }
        });
        panelContent.add(btnAddTag, "7, 4");

        JButton btnRemoveTag = new JButton("");
        btnRemoveTag.setIcon(IconManager.LIST_REMOVE);
        btnRemoveTag.setMargin(new Insets(2, 2, 2, 2));
        btnRemoveTag.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                changed = true;
                setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                String tag = (String) cbTags.getSelectedItem();
                for (Movie movie : moviesToEdit) {
                    movie.removeFromTags(tag);
                }
                setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
            }
        });
        panelContent.add(btnRemoveTag, "9, 4");

        JLabel lblCertification = new JLabel(BUNDLE.getString("metatag.certification")); //$NON-NLS-1$
        panelContent.add(lblCertification, "2, 6, 2, 1, right, default");

        final JComboBox cbCertification = new JComboBox();
        for (Certification cert : Certification
                .getCertificationsforCountry(MovieModuleManager.MOVIE_SETTINGS.getCertificationCountry())) {
            cbCertification.addItem(cert);
        }
        panelContent.add(cbCertification, "5, 6, fill, default");

        JButton btnCertification = new JButton("");
        btnCertification.setMargin(new Insets(2, 2, 2, 2));
        btnCertification.setIcon(IconManager.APPLY);
        btnCertification.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                changed = true;
                setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                Certification cert = (Certification) cbCertification.getSelectedItem();
                for (Movie movie : moviesToEdit) {
                    movie.setCertification(cert);
                    ;
                }
                setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
            }
        });
        panelContent.add(btnCertification, "7, 6");

        JLabel lblMovieSet = new JLabel(BUNDLE.getString("metatag.movieset")); //$NON-NLS-1$
        panelContent.add(lblMovieSet, "2, 8, 2, 1, right, default");

        cbMovieSet = new JComboBox();
        panelContent.add(cbMovieSet, "5, 8, fill, default");

        JButton btnSetMovieSet = new JButton("");
        btnSetMovieSet.setMargin(new Insets(2, 2, 2, 2));
        btnSetMovieSet.setIcon(IconManager.APPLY);
        btnSetMovieSet.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                changed = true;
                setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                // movie set
                Object obj = cbMovieSet.getSelectedItem();
                for (Movie movie : moviesToEdit) {
                    if (obj instanceof String) {
                        movie.removeFromMovieSet();
                    }
                    if (obj instanceof MovieSet) {
                        MovieSet movieSet = (MovieSet) obj;

                        if (movie.getMovieSet() != movieSet) {
                            movie.removeFromMovieSet();
                            movie.setMovieSet(movieSet);
                            movieSet.insertMovie(movie);
                        }
                    }
                }
                setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
            }
        });
        panelContent.add(btnSetMovieSet, "7, 8");

        JButton btnNewMovieset = new JButton("");
        btnNewMovieset.setMargin(new Insets(2, 2, 2, 2));
        btnNewMovieset.setAction(new MovieSetAddAction(false));
        panelContent.add(btnNewMovieset, "9, 8");

        JLabel lblWatched = new JLabel(BUNDLE.getString("metatag.watched")); //$NON-NLS-1$
        panelContent.add(lblWatched, "2, 10, 2, 1, right, default");

        chckbxWatched = new JCheckBox("");
        panelContent.add(chckbxWatched, "5, 10");

        JButton btnWatched = new JButton("");
        btnWatched.setMargin(new Insets(2, 2, 2, 2));
        btnWatched.setIcon(IconManager.APPLY);
        btnWatched.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                changed = true;
                setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                for (Movie movie : moviesToEdit) {
                    movie.setWatched(chckbxWatched.isSelected());
                }
                setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
            }
        });
        panelContent.add(btnWatched, "7, 10");

        JLabel lblVideo3D = new JLabel(BUNDLE.getString("metatag.3d")); //$NON-NLS-1$
        panelContent.add(lblVideo3D, "2, 12, 2, 1, right, default");

        final JCheckBox chckbxVideo3D = new JCheckBox("");
        panelContent.add(chckbxVideo3D, "5, 12");

        JButton btnVideo3D = new JButton("");
        btnVideo3D.setMargin(new Insets(2, 2, 2, 2));
        btnVideo3D.setIcon(IconManager.APPLY);
        btnVideo3D.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                changed = true;
                setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                for (Movie movie : moviesToEdit) {
                    movie.setVideoIn3D(chckbxVideo3D.isSelected());
                }
                setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
            }
        });
        panelContent.add(btnVideo3D, "7, 12");

        JLabel lblMediasource = new JLabel(BUNDLE.getString("metatag.source")); //$NON-NLS-1$
        panelContent.add(lblMediasource, "2, 14, 2, 1, right, default");

        final JComboBox cbMediaSource = new JComboBox(MediaSource.values());
        panelContent.add(cbMediaSource, "5, 14, fill, default");

        JButton btnMediaSource = new JButton("");
        btnMediaSource.setMargin(new Insets(2, 2, 2, 2));
        btnMediaSource.setIcon(IconManager.APPLY);
        btnMediaSource.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                changed = true;
                Object obj = cbMediaSource.getSelectedItem();
                if (obj instanceof MediaSource) {
                    MediaSource mediaSource = (MediaSource) obj;
                    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                    for (Movie movie : moviesToEdit) {
                        movie.setMediaSource(mediaSource);
                    }
                    setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
                }
            }
        });
        panelContent.add(btnMediaSource, "7, 14");

        JLabel lblLanguage = new JLabel(BUNDLE.getString("metatag.language")); //$NON-NLS-1$
        panelContent.add(lblLanguage, "2, 16, 2, 1, right, default");

        tfLanguage = new JTextField();
        panelContent.add(tfLanguage, "5, 16, fill, default");
        tfLanguage.setColumns(10);

        JButton btnLanguage = new JButton("");
        btnLanguage.setMargin(new Insets(2, 2, 2, 2));
        btnLanguage.setIcon(IconManager.APPLY);
        btnLanguage.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                changed = true;
                setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                for (Movie movie : moviesToEdit) {
                    movie.setSpokenLanguages(tfLanguage.getText());
                }
                setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
            }
        });
        panelContent.add(btnLanguage, "7, 16");
        {

            JLabel lblSorttitleT = new JLabel(BUNDLE.getString("metatag.sorttitle")); //$NON-NLS-1$
            panelContent.add(lblSorttitleT, "2, 18, right, default");

            JButton btnSetSorttitle = new JButton(BUNDLE.getString("edit.setsorttitle")); //$NON-NLS-1$
            btnSetSorttitle.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    changed = true;
                    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                    for (Movie movie : moviesToEdit) {
                        movie.setSortTitle(movie.getTitleSortable());
                    }
                    setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
                }
            });

            JLabel lblSorttitleInfo = new JLabel(IconManager.HINT);
            lblSorttitleInfo.setToolTipText(BUNDLE.getString("edit.setsorttitle.desc")); //$NON-NLS-1$
            panelContent.add(lblSorttitleInfo, "3, 18");
            panelContent.add(btnSetSorttitle, "5, 18");

            JButton btnClearSorttitle = new JButton(BUNDLE.getString("edit.clearsorttitle")); //$NON-NLS-1$
            btnClearSorttitle.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    changed = true;
                    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                    for (Movie movie : moviesToEdit) {
                        movie.setSortTitle("");
                    }
                    setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
                }
            });
            panelContent.add(btnClearSorttitle, "5, 20");
        }
    }

    {
        JPanel panelButtons = new JPanel();
        FlowLayout flowLayout = (FlowLayout) panelButtons.getLayout();
        flowLayout.setAlignment(FlowLayout.RIGHT);
        getContentPane().add(panelButtons, BorderLayout.SOUTH);

        JButton btnClose = new JButton(BUNDLE.getString("Button.close")); //$NON-NLS-1$
        btnClose.setIcon(IconManager.APPLY);
        btnClose.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent arg0) {
                // rewrite movies, if anything changed
                if (changed) {
                    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                    for (Movie movie : moviesToEdit) {
                        movie.writeNFO();
                        movie.saveToDb();
                    }
                    setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
                }
                setVisible(false);
            }
        });
        panelButtons.add(btnClose);

        // add window listener to write changes (if the window close button "X" is
        // pressed)
        addWindowListener(new WindowAdapter() {
            @Override
            public void windowClosing(WindowEvent e) {
                // rewrite movies, if anything changed
                if (changed) {
                    for (Movie movie : moviesToEdit) {
                        movie.writeNFO();
                        movie.saveToDb();
                    }
                    // if configured - sync with trakt.tv
                    if (MovieModuleManager.MOVIE_SETTINGS.getSyncTrakt()) {
                        TmmTask task = new SyncTraktTvTask(moviesToEdit, null);
                        TmmTaskManager.getInstance().addUnnamedTask(task);
                    }
                }
            }
        });
    }

    {
        setMovieSets();
        moviesToEdit = movies;

        PropertyChangeListener listener = new PropertyChangeListener() {
            @Override
            public void propertyChange(PropertyChangeEvent evt) {
                if ("addedMovieSet".equals(evt.getPropertyName())) {
                    setMovieSets();
                }
            }
        };
        movieList.addPropertyChangeListener(listener);
    }
}

From source file:com.ssn.listener.SSNFacebookAlbumSelectionListener.java

private void createComponents(SSNHomeForm ssnHomeForm, List<Photo> completePhotoList, SSNAlbumNode albumNode) {
    SSNHelper.toggleDeleteAndShareImages(false, ssnHomeForm);

    try {//from   w  w  w.j  av a 2  s.  c  o m
        List<File> listOfFiles = new ArrayList<File>();

        File facebookPhotosDir = new File(
                SSNHelper.getFacebookPhotosDirPath() + albumNode.getAlbum().getName() + File.separator);
        if (!facebookPhotosDir.exists()) {
            facebookPhotosDir.mkdir();
        }

        for (Photo photo : completePhotoList) {
            String imageUrl = "";
            for (Image image : photo.getImages()) {
                if (image != null && image.getHeight() <= 500) {
                    imageUrl = image.getSource();
                    break;
                }
            }

            if (imageUrl.isEmpty()) {
                imageUrl = photo.getSource();
            }
            URL url = new URL(imageUrl);
            File file = new File(facebookPhotosDir.getAbsolutePath() + File.separator + photo.getId() + ".jpg");
            if (!file.exists()) {
                try {
                    FileUtils.copyURLToFile(url, file);
                    listOfFiles.add(file);
                } catch (Exception e) {
                    logger.error(e);
                }
            } else {
                listOfFiles.add(file);
            }
        }

        File[] fileArray = listOfFiles.toArray(new File[0]);
        SSNGalleryHelper contentPane = new SSNGalleryHelper(fileArray, ssnHomeForm);
        contentPane.setBackground(SSNConstants.SSN_BLACK_BACKGROUND_COLOR);

        ssnHomeForm.getSsnHomeCenterPanel().removeAll();
        ssnHomeForm.getSsnHomeCenterMainPanel().removeAll();

        ssnHomeForm.getSsnHomeCenterPanel().add(ssnHomeForm.getScrollPane(contentPane,
                SSNHelper.getAlbumNameFromPath(ssnHomeForm.ssnFileExplorer.m_display.getText())));
        ssnHomeForm
                .getSsnHomeCenterMainPanel().add(
                        ssnHomeForm.getSortPanel("Date", false,
                                SSNHelper
                                        .getAlbumNameFromPath(ssnHomeForm.ssnFileExplorer.m_display.getText())),
                        BorderLayout.NORTH);
        ssnHomeForm.getSsnHomeCenterMainPanel().add(ssnHomeForm.getSsnHomeCenterPanel(), BorderLayout.CENTER);
        ssnHomeForm.getHomeModel().getSSNMediaFolderProperties(
                ssnHomeForm.getHomeModel().getHomeForm().ssnFileExplorer.m_display.getText(), fileArray);
        // ssnHomeForm.add(ssnHomeForm.getSsnHomeCenterMainPanel());

        //             ssnHomeForm.getSplitPane().setLeftComponent(ssnHomeForm.getSsnHomeLeftMainPanel());
        //             ssnHomeForm.getSplitPane().setRightComponent(ssnHomeForm.getSsnHomeCenterMainPanel());
        //                //ssnHomeForm.getSplitPane().setDividerLocation(200);
        //             ssnHomeForm.getSplitPane().revalidate();
        //             ssnHomeForm.getSplitPane().repaint();

        ssnHomeForm.revalidate();
        ssnHomeForm.repaint();
        ssnHomeForm.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));

    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:strobe.spectroscopy.StrobeSpectroscopy.java

/**
 * This method is called from within the constructor to initialize the form.
 * WARNING: Do NOT modify this code. The content of this method is always
 * regenerated by the Form Editor.//from w w  w . jav a  2  s  .  co  m
 */
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
    //        initListOfCOMports();
    stepper.initSerial();

    fileChooser = new javax.swing.JFileChooser();
    graphPanel = new javax.swing.JPanel();
    controlPanel = new javax.swing.JPanel();
    btnStart = new javax.swing.JButton();
    btnPause = new javax.swing.JButton();
    btnStop = new javax.swing.JButton();
    spr1 = new javax.swing.JSeparator();
    tbtnBackward = new javax.swing.JToggleButton();
    tbtnForward = new javax.swing.JToggleButton();
    spr2 = new javax.swing.JSeparator();
    jPanel1 = new javax.swing.JPanel();
    cBoxSpeed = new javax.swing.JComboBox<>();
    spr4 = new javax.swing.JSeparator();
    cBoxResolution = new javax.swing.JComboBox<>();
    spr3 = new javax.swing.JSeparator();
    cBoxFromWavelength = new javax.swing.JComboBox<>();
    cBoxToWavelength = new javax.swing.JComboBox<>();
    spr5 = new javax.swing.JSeparator();
    btnSetZero = new javax.swing.JButton();
    btnSetMark = new javax.swing.JButton();
    strobeMenuBar = new javax.swing.JMenuBar();
    menuFile = new javax.swing.JMenu();
    menuFileOpen = new javax.swing.JMenuItem();
    menuFileSave = new javax.swing.JMenuItem();
    menuFileExit = new javax.swing.JMenuItem();
    settingMenu = new javax.swing.JMenu();
    menuAbout = new javax.swing.JMenu();
    menuAboutAbout = new javax.swing.JMenuItem();

    fileChooser.setAcceptAllFileFilterUsed(false);

    setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    setTitle("Strobe-spectroscopy");
    setIconImage(new javax.swing.ImageIcon(getClass().getResource("/icons/iconFrame.png")).getImage());
    setLocationByPlatform(true);
    setMinimumSize(new java.awt.Dimension(800, 550));
    setName("strobeFrame"); // NOI18N
    setPreferredSize(new java.awt.Dimension(800, 550));

    controlPanel.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(204, 204, 204)));
    controlPanel.setLayout(new javax.swing.BoxLayout(controlPanel, javax.swing.BoxLayout.X_AXIS));

    btnStart.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/iconStart.png"))); // NOI18N
    btnStart.setToolTipText("Start measurement");
    btnStart.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnStartActionPerformed(evt);
        }
    });
    controlPanel.add(btnStart);

    btnPause.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/iconPause.png"))); // NOI18N
    btnPause.setToolTipText("Pause measurement");
    btnPause.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnPauseActionPerformed(evt);
        }
    });
    controlPanel.add(btnPause);

    btnStop.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/iconStop.png"))); // NOI18N
    btnStop.setToolTipText("Stop measurement");
    btnStop.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnStopActionPerformed(evt);
        }
    });
    controlPanel.add(btnStop);

    spr1.setForeground(new java.awt.Color(255, 255, 255));
    spr1.setOrientation(javax.swing.SwingConstants.VERTICAL);
    spr1.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
    spr1.setMaximumSize(new java.awt.Dimension(5, 0));
    spr1.setPreferredSize(new java.awt.Dimension(5, 0));
    spr1.setRequestFocusEnabled(false);
    controlPanel.add(spr1);
    spr1.getAccessibleContext().setAccessibleDescription("");

    tbtnBackward.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/iconBackward.png"))); // NOI18N
    tbtnBackward.setToolTipText("Backwar spinning of the driver, while pressed.");
    tbtnBackward.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            tbtnBackwardActionPerformed(evt);
        }
    });
    controlPanel.add(tbtnBackward);

    tbtnForward.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/iconForward.png"))); // NOI18N
    tbtnForward.setToolTipText("Forward spinning of the drive, while pressed.");
    tbtnForward.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            tbtnForwardActionPerformed(evt);
        }
    });
    controlPanel.add(tbtnForward);

    spr2.setForeground(new java.awt.Color(255, 255, 255));
    spr2.setOrientation(javax.swing.SwingConstants.VERTICAL);
    spr2.setAlignmentX(1.0F);
    spr2.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
    spr2.setMaximumSize(new java.awt.Dimension(5, 0));
    spr2.setPreferredSize(new java.awt.Dimension(5, 0));
    spr2.setRequestFocusEnabled(false);
    controlPanel.add(spr2);

    jPanel1.setLayout(new javax.swing.BoxLayout(jPanel1, javax.swing.BoxLayout.LINE_AXIS));

    cBoxSpeed.setToolTipText("");
    cBoxSpeed.setMinimumSize(new java.awt.Dimension(50, 20));
    cBoxSpeed.setPreferredSize(new java.awt.Dimension(50, 20));
    jPanel1.add(cBoxSpeed);

    spr4.setForeground(new java.awt.Color(255, 255, 255));
    spr4.setOrientation(javax.swing.SwingConstants.VERTICAL);
    spr4.setAlignmentX(1.0F);
    spr4.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
    spr4.setMaximumSize(new java.awt.Dimension(5, 0));
    spr4.setPreferredSize(new java.awt.Dimension(5, 0));
    spr4.setRequestFocusEnabled(false);
    jPanel1.add(spr4);

    cBoxResolution.setAutoscrolls(true);
    cBoxResolution.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
    cBoxResolution.setMinimumSize(new java.awt.Dimension(50, 20));
    cBoxResolution.setPreferredSize(new java.awt.Dimension(50, 20));
    cBoxResolution.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            cBoxResolutionActionPerformed(evt);
        }
    });
    jPanel1.add(cBoxResolution);

    controlPanel.add(jPanel1);

    spr3.setForeground(new java.awt.Color(255, 255, 255));
    spr3.setOrientation(javax.swing.SwingConstants.VERTICAL);
    spr3.setAlignmentX(1.0F);
    spr3.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
    spr3.setMaximumSize(new java.awt.Dimension(5, 0));
    spr3.setPreferredSize(new java.awt.Dimension(5, 0));
    spr3.setRequestFocusEnabled(false);
    controlPanel.add(spr3);

    cBoxFromWavelength.setEditable(true);
    cBoxFromWavelength.setAutoscrolls(true);
    controlPanel.add(cBoxFromWavelength);

    cBoxToWavelength.setEditable(true);
    cBoxToWavelength.setAutoscrolls(true);
    cBoxToWavelength.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            cBoxToWavelengthActionPerformed(evt);
        }
    });
    controlPanel.add(cBoxToWavelength);

    spr5.setForeground(new java.awt.Color(255, 255, 255));
    spr5.setOrientation(javax.swing.SwingConstants.VERTICAL);
    spr5.setAlignmentX(1.0F);
    spr5.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
    spr5.setMaximumSize(new java.awt.Dimension(5, 0));
    spr5.setPreferredSize(new java.awt.Dimension(5, 0));
    spr5.setRequestFocusEnabled(false);
    controlPanel.add(spr5);

    btnSetZero.setText("Set zero");
    btnSetZero.setToolTipText("Set zero imput signal level to subtract thermal noise");
    btnSetZero.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnSetZeroActionPerformed(evt);
        }
    });
    controlPanel.add(btnSetZero);

    btnSetMark.setText("Mark");
    btnSetMark.setToolTipText("Set a mark on the input graph");
    btnSetMark.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnSetMarkActionPerformed(evt);
        }
    });
    controlPanel.add(btnSetMark);

    getContentPane().add(controlPanel, java.awt.BorderLayout.SOUTH);

    menuFile.setText("File");
    menuFile.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            menuFileActionPerformed(evt);
        }
    });

    menuFileOpen.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O,
            java.awt.event.InputEvent.CTRL_MASK));
    menuFileOpen.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/open.png"))); // NOI18N
    menuFileOpen.setText("Open");
    menuFileOpen.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            menuFileOpenActionPerformed(evt);
        }
    });
    menuFile.add(menuFileOpen);

    menuFileSave.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S,
            java.awt.event.InputEvent.CTRL_MASK));
    menuFileSave.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/save.png"))); // NOI18N
    menuFileSave.setText("Save");
    menuFileSave.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            menuFileSaveActionPerformed(evt);
        }
    });
    menuFile.add(menuFileSave);

    menuFileExit.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_W,
            java.awt.event.InputEvent.CTRL_MASK));
    menuFileExit.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/close.png"))); // NOI18N
    menuFileExit.setText("Exit");
    menuFileExit.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            menuFileExitActionPerformed(evt);
        }
    });
    menuFile.add(menuFileExit);

    strobeMenuBar.add(menuFile);

    settingMenu.setText("Settings");
    strobeMenuBar.add(settingMenu);

    menuAbout.setText("About");

    menuAboutAbout.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/info.png"))); // NOI18N
    menuAboutAbout.setText("About");
    menuAboutAbout.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            menuAboutAboutActionPerformed(evt);
        }
    });
    menuAbout.add(menuAboutAbout);

    //chartPanel.setPreferredSize( new java.awt.Dimension(graphPanel.getMinimumSize()));

    chartPanel.setMaximumSize(new Dimension(3000, 2000));
    graphPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Spectrum"));

    graphPanel.add(chartPanel);
    graphPanel.setLayout(new GridLayout(0, 1));
    getContentPane().add(graphPanel, java.awt.BorderLayout.CENTER);

    chartRenderer.setSeriesPaint(0, Color.RED);
    chartRenderer.setSeriesStroke(0, new BasicStroke(2.0f));
    plot.setRenderer(chartRenderer);
    plot.datasetChanged(new DatasetChangeEvent(graphChart, dataSet));
    marker.setPaint(Color.red);
    plot.addDomainMarker(marker);

    strobeMenuBar.add(menuAbout);

    setJMenuBar(strobeMenuBar);

    pack();
}