Example usage for java.awt Cursor getPredefinedCursor

List of usage examples for java.awt Cursor getPredefinedCursor

Introduction

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

Prototype

public static Cursor getPredefinedCursor(int type) 

Source Link

Document

Returns a cursor object with the specified predefined type.

Usage

From source file:com.sshtools.appframework.ui.SshToolsApplication.java

/**
 * Show an 'About' dialog//from  w ww .jav a  2  s. c om
 */
public void showAbout(Component parent) {
    JPanel p = new JPanel(new GridBagLayout());
    p.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
    GridBagConstraints gBC = new GridBagConstraints();
    gBC.anchor = GridBagConstraints.CENTER;
    gBC.fill = GridBagConstraints.HORIZONTAL;
    gBC.insets = new Insets(1, 1, 1, 1);
    JLabel a = new JLabel(getApplicationName());
    a.setFont(a.getFont().deriveFont(24f));
    UIUtil.jGridBagAdd(p, a, gBC, GridBagConstraints.REMAINDER);
    JLabel v = new JLabel("Version " + getApplicationVersion());
    v.setFont(v.getFont().deriveFont(10f));
    UIUtil.jGridBagAdd(p, v, gBC, GridBagConstraints.REMAINDER);
    MultilineLabel x = new MultilineLabel(getAboutLicenseDetails());
    x.setBorder(BorderFactory.createEmptyBorder(8, 0, 8, 0));
    x.setFont(x.getFont().deriveFont(12f));
    UIUtil.jGridBagAdd(p, x, gBC, GridBagConstraints.REMAINDER);
    MultilineLabel c = new MultilineLabel(getExpiryInfo());
    c.setFont(c.getFont().deriveFont(10f));
    UIUtil.jGridBagAdd(p, c, gBC, GridBagConstraints.REMAINDER);
    final JLabel h = new JLabel(getAboutURL());
    h.setForeground(Color.blue);
    h.setFont(new Font(h.getFont().getName(), Font.BOLD, 10));
    h.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    h.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent evt) {
            try {
                BrowserLauncher.openURL(getAboutURL());
            } catch (IOException ioe) {
                ioe.printStackTrace();
            }
        }
    });
    UIUtil.jGridBagAdd(p, h, gBC, GridBagConstraints.REMAINDER);
    JOptionPane.showMessageDialog(parent, p, "About", JOptionPane.PLAIN_MESSAGE, getApplicationLargeIcon());
}

From source file:au.com.jwatmuff.eventmanager.gui.main.MainWindow.java

private void firewallMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_firewallMenuItemActionPerformed
    String rule = "EventManager Port 1199";
    String title = "Update Firewall";

    try {//from   w w  w . ja  v  a 2  s  .  c  o  m
        setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
        if (WindowsNetUtil.firewallRuleExists(rule)) {
            GUIUtils.displayMessage(null, "Firewall already configured", title);
            return;
        }
        WindowsNetUtil.openInboundFirewallPort(rule, 1199);
    } finally {
        setCursor(Cursor.getDefaultCursor());
    }
    if (WindowsNetUtil.firewallRuleExists(rule)) {
        GUIUtils.displayMessage(null, "Firewall Successfully Updated", title);
    } else {
        GUIUtils.displayError(null, "Failed to update firewall");
    }
}

From source file:au.com.jwatmuff.eventmanager.gui.main.MainWindow.java

private void networkLogMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_networkLogMenuItemActionPerformed
    try {//w ww .j ava2  s  .  com
        setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
        WindowsNetUtil.logNetworkInfo();
    } finally {
        setCursor(Cursor.getDefaultCursor());
    }

    GUIUtils.displayMessage(null,
            "Network diagnostic information has been logged.\nThis will assist the developers to resolve network related issues with EventManager.",
            "Log Network Info");
}

From source file:org.javaswift.cloudie.CloudiePanel.java

@Override
public void onStart() {
    if (busyCnt == 0) {
        setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
        statusPanel.onStart();/*from  www. j  a v a 2  s.  c  o  m*/
    }
    busyCnt++;
}

From source file:org.javaswift.cloudie.CloudiePanel.java

@Override
public void onDone() {
    busyCnt--;//w  w  w. ja v  a2  s  .c o m
    if (busyCnt == 0) {
        setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
        statusPanel.onEnd();
    }
    enableDisable();
}

From source file:uk.ac.ucl.cs.cmic.giftcloud.uploadapp.ConfigurationDialog.java

private void applyProperties() {

    // Extract out all the new values (this makes the code a little clearer below)
    final int newListeningPortValue = Integer.parseInt(listeningPortField.getText());
    final String newListeningAeTitle = listeningAETitleField.getText();
    final String newGiftCloudUrl = giftCloudServerText.getText();
    final String newGiftCloudUserName = giftCloudUsernameText.getText();
    final char[] newGiftCloudPassword = giftCloudPasswordText.getPassword();
    final char[] newPatientListPassword = patientListSpreadsheetPasswordField.getPassword();
    final String newPatientListExportFolder = patientListExportFolderField.getText();
    final String newSubjectPrefix = subjectPrefixField.getText();
    final int newPacsPort = Integer.parseInt(remoteAEPortField.getText());
    final String newPacsAeTitle = remoteAETitleField.getText();
    final String newPacsHostName = remoteAEHostName.getText();

    // Determine whether to restart the listener service based on changes to the listener or PACS properties
    final boolean restartDicomNode = giftCloudProperties.getListeningPort() != newListeningPortValue
            || !newListeningAeTitle.equals(giftCloudProperties.getListenerAETitle())
            || giftCloudProperties.getPacsPort() != newPacsPort
            || !newPacsAeTitle.equals(giftCloudProperties.getPacsAeTitle().orElse(""))
            || !newPacsHostName.equals(giftCloudProperties.getPacsHostName().orElse(""));

    final boolean restartUploader = !newGiftCloudUrl.equals(giftCloudProperties.getGiftCloudUrl().orElse(""))
            || !newGiftCloudUserName.equals(giftCloudProperties.getLastUserName().orElse(""))
            || !newGiftCloudPassword.equals(giftCloudProperties.getLastPassword().orElse("".toCharArray()))
            || !temporaryDropDownListModel.getSelectedItem().equals(projectListModel.getSelectedItem());

    final boolean forcePatientListExport = StringUtils.isNotBlank(newPatientListExportFolder)
            && (!giftCloudProperties.getPatientListExportFolder().isPresent()
                    || !newPatientListExportFolder
                            .equals(giftCloudProperties.getPatientListExportFolder().get())
                    || !newPatientListPassword
                            .equals(giftCloudProperties.getPatientListPassword().orElse("".toCharArray())));

    // Change the properties (must be done after we access the current values to check for changes)
    giftCloudProperties.setListeningPort(newListeningPortValue);
    giftCloudProperties.setListenerAETitle(newListeningAeTitle);
    giftCloudProperties.setPatientListExportFolder(newPatientListExportFolder);
    giftCloudProperties.setGiftCloudUrl(newGiftCloudUrl);
    giftCloudProperties.setLastUserName(newGiftCloudUserName);
    giftCloudProperties.setLastPassword(newGiftCloudPassword);
    giftCloudProperties.setPatientListPassword(newPatientListPassword);
    giftCloudProperties.setSubjectPrefix(newSubjectPrefix);
    giftCloudProperties.setPacsPort(newPacsPort);
    giftCloudProperties.setPacsAeTitle(newPacsAeTitle);
    giftCloudProperties.setPacsHostName(newPacsHostName);

    // We only update the last project with a valid value. A null value may indicate the project list hasn't been
    // set because the server login details are incorrect or some communication error
    final Object selectedProjectItem = temporaryDropDownListModel.getSelectedItem();
    if (selectedProjectItem instanceof String) {
        final String newProject = (String) selectedProjectItem;
        if (StringUtils.isNotBlank(newProject)) {
            giftCloudProperties.setLastProject(newProject);
        }/*ww  w .  ja  v a2s  . c o m*/
    }

    giftCloudProperties.save();

    if (restartDicomNode || restartUploader || forcePatientListExport) {
        Cursor was = dialog.getCursor();
        dialog.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

        if (restartDicomNode) {
            controller.restartDicomService();
        }
        if (restartUploader) {
            controller.invalidateServerAndRestartUploader();
        }
        if (forcePatientListExport) {
            controller.exportPatientList(false);
        }

        dialog.setCursor(was);
    }

}

From source file:com.intellij.lang.jsgraphql.ide.project.JSGraphQLLanguageUIProjectService.java

private void createToolWindowResultEditor(ToolWindow toolWindow) {

    final LightVirtualFile virtualFile = new LightVirtualFile("GraphQL.result.json", JsonFileType.INSTANCE, "");
    fileEditor = PsiAwareTextEditorProvider.getInstance().createEditor(myProject, virtualFile);

    if (fileEditor instanceof TextEditor) {
        final Editor editor = ((TextEditor) fileEditor).getEditor();
        final EditorEx editorEx = (EditorEx) editor;

        // set read-only mode
        editorEx.setViewer(true);/*from w  w  w  .  jav a2s.  c  o m*/
        editorEx.getSettings().setShowIntentionBulb(false);
        editor.getSettings().setAdditionalLinesCount(0);
        editor.getSettings().setCaretRowShown(false);
        editor.getSettings().setBlinkCaret(false);

        // query result header
        final JSGraphQLEditorHeaderComponent header = new JSGraphQLEditorHeaderComponent();

        querySuccessLabel = new JBLabel();
        querySuccessLabel.setVisible(false);
        querySuccessLabel.setIconTextGap(0);
        header.add(querySuccessLabel, BorderLayout.WEST);

        queryResultLabel = new JBLabel("", null, SwingConstants.LEFT);
        queryResultLabel.setBorder(new EmptyBorder(4, 6, 4, 6));
        queryResultLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        queryResultLabel.setVisible(false);
        queryResultLabel.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                final String fileUrl = (String) queryResultLabel.getClientProperty(FILE_URL_PROPERTY);
                if (fileUrl != null) {
                    final VirtualFile queryFile = VirtualFileManager.getInstance().findFileByUrl(fileUrl);
                    if (queryFile != null) {
                        final FileEditorManager fileEditorManager = FileEditorManager.getInstance(myProject);
                        fileEditorManager.openFile(queryFile, true, true);
                    }
                }
            }
        });
        header.add(queryResultLabel, BorderLayout.CENTER);

        // finally set the header as permanent such that it's restored after searches
        editor.setHeaderComponent(header);
        editorEx.setPermanentHeaderComponent(header);
    }

    Disposer.register(this, fileEditor);

    final ContentImpl content = new ContentImpl(fileEditor.getComponent(), "Query result", true);
    content.setCloseable(false);
    toolWindow.getContentManager().addContent(content);

}

From source file:com.signalcollect.sna.visualization.SignalCollectSNATopComponent.java

/**
 * Gets and visualizes the chart of the Local Cluster Coefficient
 * Distribution/*from w  ww .  j ava 2s . c  om*/
 *
 * @param evt
 */
private void clusterDistributionButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_clusterDistributionButtonActionPerformed

    try {
        mainPanel.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
        if (jTextArea1.getText() == null) {
            throw new IllegalArgumentException("No file was chosen!\nPlease choose a valid .gml file");
        }
        if (!jTextArea1.getText().contains(".gml")) {
            throw new IllegalArgumentException(
                    "The chosen file doesn't have the right format!\nPlease choose a valid .gml file");
        }
        distributionFrame.setVisible(false);
        distributionFrame = new JFrame();

        scgc = new LocalClusterCoefficientSignalCollectGephiConnectorImpl(fileName);
        JFreeChart chart = scgc.createClusterDistributionChart(scgc.getClusterDistribution());
        ChartPanel chartPanel = new ChartPanel(chart);
        Dimension dim = new Dimension(750, 450);
        distributionFrame.setMinimumSize(dim);
        chartPanel.setVisible(true);
        chartPanel.validate();

        distributionFrame.add(chartPanel);

        distributionFrame.pack();
        distributionFrame.setVisible(true);
    } catch (IllegalArgumentException exception) {

        messageFrame = new JFrame();
        JOptionPane.showMessageDialog(messageFrame, exception.getMessage(), "Signal/Collect Error",
                JOptionPane.ERROR_MESSAGE);

    } catch (Exception exception) {
        messageFrame = new JFrame();
        exception.printStackTrace();
        JOptionPane.showMessageDialog(messageFrame,
                "Technical exception happened (" + exception.getCause() + ")", "Signal/Collect Error",
                JOptionPane.ERROR_MESSAGE);
    } finally {
        mainPanel.setCursor(Cursor.getDefaultCursor());
    }
}

From source file:org.fhaes.jsea.JSEAFrame.java

/**
 * Actually perform the Superposed Epoch Analysis
 *///  www  .j av  a 2  s .  co m
private void runAnalysis() {

    // Create default segment if segmentation was selected but not defined
    if (segmentationPanel.chkSegmentation.isSelected()
            && segmentationPanel.table.tableModel.getSegments().isEmpty()) {
        segmentationPanel.table.tableModel
                .addSegment(new SegmentModel(Integer.parseInt(this.firstPossibleYear.toString()),
                        Integer.parseInt(this.lastPossibleYear.toString())));
        segmentationPanel.table.setEarliestYear(Integer.parseInt(this.firstPossibleYear.toString()));
        segmentationPanel.table.setLatestYear(Integer.parseInt(this.lastPossibleYear.toString()));
    }

    // Run the analysis via the JSEAProgressDialog
    new JSEAProgressDialog(this);

    try {
        if (jsea == null)
            return;

        // Populate summary text field
        this.txtSummary.setText(jsea.getReportText());
        setScrollBarToTop();

        // Populate actual data table
        tblActual.setModel(TableUtil.createTableModel(jsea.getActualTableText(), null));
        tblActual.packAll();

        // Populate simulation data table
        tblSimulation.setModel(TableUtil.createTableModel(jsea.getSimulationTableText(), null));
        tblSimulation.packAll();

        // Populate chart panel
        populateSegmentComboBoxAndDrawChart(segmentationPanel.table.tableModel);

        setAnalysisAvailable(true);
    } catch (Exception e) {
        JOptionPane.showMessageDialog(this,
                "An error was caught while running the analysis.\nPlease check the logs for further information",
                "Error", JOptionPane.ERROR_MESSAGE);
        log.error("Error caught when running jSEA analysis");
        e.printStackTrace();
        jsea = null;
        setAnalysisAvailable(false);
    } finally {
        setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
    }
}

From source file:au.com.jwatmuff.eventmanager.gui.main.MainWindow.java

private void manualAddPeerMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_manualAddPeerMenuItemActionPerformed
    String hostname = JOptionPane
            .showInputDialog("Enter an IP Address, Host or Computer Name on which EventManager is running.");

    if (!StringUtils.isBlank(hostname)) {
        try {/* w w  w  .  j av a 2s  .c o  m*/
            setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
            InetAddress.getByName(hostname);
            GUIUtils.displayMessage(null, "The computer '" + hostname
                    + "' was successfully added.\nIf EventManager is able to connect to this computer, it will appear under the chat user list shortly",
                    "Computer added");
            manuallyAddHost(hostname);
        } catch (UnknownHostException e) {
            GUIUtils.displayError(null,
                    "EventManager was unable to identify any computer named '" + hostname + "' (Unknown host)");
        } finally {
            setCursor(Cursor.getDefaultCursor());
        }
    }
}