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:MouseDragActionPanel.java

public void mouseMoved(MouseEvent evt) {
    int x = evt.getX();
    int y = evt.getY();

    if (getSquare(x, y) >= 0)
        setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR));
    else/*from   w w  w . j av  a 2 s  .c om*/
        setCursor(Cursor.getDefaultCursor());
}

From source file:org.broad.igv.ui.panel.PanTool.java

public PanTool(DataPanel owner) {
    super(owner, Cursor.getDefaultCursor());
    this.dragCursor = IGV.fistCursor;
    setName("Pan");
    if (owner != null) {
        verticalScrollBar = owner.getVerticalScrollbar();
        Container parentContainer = owner.getParent();
        if (parentContainer != null) {
            Container parentOfParent = parentContainer.getParent();
            if ((parentOfParent != null) && (parentOfParent instanceof JViewport)) {
                //viewport = (JViewport) parentOfParent;
            }//from  w  w w .  j a  v  a2s  .c o m
        }
    }
}

From source file:org.broad.igv.ui.panel.PanTool.java

@Override
public Cursor getCursor() {
    return isDragging ? dragCursor : Cursor.getDefaultCursor();
}

From source file:rod_design_compute.ShowPanel.java

public void reset() {
    originX = 100;
    originY = 560 - 100;
    ratio = 1.0;
    setCursor(Cursor.getDefaultCursor());
    choosePoint = null;
    chooseRod = null;
    repaint();
}

From source file:com.ts.ch.gui.CertifiedHelperController.java

public CertifiedHelperController(PmDatabase database) {
    this.database = database;
    setModelAndView(new CertifiedHelperModel(), new CertifiedHelperView());

    new Task<Void, Void>(Application.getInstance()) {

        public Void doInBackground() {
            CertifiedHelperModel m = (CertifiedHelperModel) CertifiedHelperController.this.getModel();
            CertifiedHelperView v = (CertifiedHelperView) CertifiedHelperController.this.getView();
            v.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

            try {

                dymoAddIn = ClassFactory.createDymoAddIn();
                dymoLabels = ClassFactory.createDymoLabels();

                dymoAddIn.open(LABEL_FILE);

                // Setup printer list
                List<String> printerArray = new ArrayList<String>();
                String prtNames = dymoAddIn.getDymoPrinters();
                if (prtNames != null) {
                    // parse the result
                    String[] names = prtNames.split("\\|");
                    for (String name : names) {
                        printerArray.add(name);
                    }//from www.j av a 2s . com
                    m.setPrinters(printerArray);

                    prtNames = dymoAddIn.getCurrentPrinterName();
                    if (prtNames != null) {
                        m.setSelectedPrinter(prtNames);
                    } else {
                        m.setSelectedPrinter("");

                    }
                }

                // Check if selected/current printer is a twin tubro printer
                m.setTwinTurboPrinter(dymoAddIn.isTwinTurboPrinter(m.getSelectedPrinter()));
            } catch (Exception e) {

            } finally {
                v.setCursor(Cursor.getDefaultCursor());
            }

            return null;
        }

    }.execute();

}

From source file:Main.java

@Override
public void mouseExited(MouseEvent e) {
    tree.setCursor(Cursor.getDefaultCursor());
}

From source file:de.fhg.igd.mapviewer.BasicMapKit.java

/**
 * Creates a basic map kit/*from   w  ww  .  j  a  v a  2  s.  c o m*/
 * 
 * @param cache the tile cache to use
 */
public BasicMapKit(TileCache cache) {
    super();

    this.cache = cache;

    getMiniMap().setPanEnabled(false);
    getMiniMap().setCursor(Cursor.getDefaultCursor());

    getZoomSlider().setCursor(Cursor.getDefaultCursor());
    getZoomInButton().setCursor(Cursor.getDefaultCursor());
    getZoomOutButton().setCursor(Cursor.getDefaultCursor());

    getMiniMap().addMouseListener(new MouseAdapter() {

        /**
         * @see MouseAdapter#mouseClicked(MouseEvent)
         */
        @Override
        public void mouseClicked(MouseEvent me) {
            getMainMap().setCenterPosition(getMiniMap().convertPointToGeoPosition(me.getPoint()));
        }

    });

    // create painter for map tools
    toolPainter = new MapToolPainter(getMainMap());

    customPainter = new CompoundPainter<JXMapViewer>();
    customPainter.setCacheable(false);

    mapPainter = new CompoundPainter<JXMapViewer>();
    mapPainter.setCacheable(false);

    painter = new CompoundPainter<JXMapViewer>();
    painter.setPainters(customPainter, toolPainter, mapPainter);
    painter.setCacheable(false);

    updatePainters();

    // register as state provider
    // GuiState.getInstance().registerStateProvider(this);
}

From source file:EditorPaneExample4.java

public EditorPaneExample4() {
    super("JEditorPane Example 4");

    pane = new JEditorPane();
    pane.setEditable(false); // Read-only
    getContentPane().add(new JScrollPane(pane), "Center");

    // Build the panel of controls
    JPanel panel = new JPanel();

    panel.setLayout(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.gridwidth = 1;//from   ww  w  .  j a v a2  s. c o m
    c.gridheight = 1;
    c.anchor = GridBagConstraints.EAST;
    c.fill = GridBagConstraints.NONE;
    c.weightx = 0.0;
    c.weighty = 0.0;

    JLabel urlLabel = new JLabel("URL: ", JLabel.RIGHT);
    panel.add(urlLabel, c);
    JLabel loadingLabel = new JLabel("State: ", JLabel.RIGHT);
    c.gridy = 1;
    panel.add(loadingLabel, c);
    JLabel typeLabel = new JLabel("Type: ", JLabel.RIGHT);
    c.gridy = 2;
    panel.add(typeLabel, c);

    c.gridx = 1;
    c.gridy = 0;
    c.gridwidth = 1;
    c.weightx = 1.0;
    c.fill = GridBagConstraints.HORIZONTAL;

    textField = new JTextField(32);
    panel.add(textField, c);
    loadingState = new JLabel(spaces, JLabel.LEFT);
    loadingState.setForeground(Color.black);
    c.gridy = 1;
    panel.add(loadingState, c);
    loadedType = new JLabel(spaces, JLabel.LEFT);
    loadedType.setForeground(Color.black);
    c.gridy = 2;
    panel.add(loadedType, c);

    getContentPane().add(panel, "South");

    // Change page based on text field
    textField.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            String url = textField.getText();

            try {
                // Check if the new page and the old
                // page are the same.
                URL newURL = new URL(url);
                URL loadedURL = pane.getPage();
                if (loadedURL != null && loadedURL.sameFile(newURL)) {
                    return;
                }

                // Try to display the page
                textField.setEnabled(false); // Disable input
                textField.paintImmediately(0, 0, textField.getSize().width, textField.getSize().height);
                setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                // Busy cursor
                loadingState.setText("Loading...");
                loadingState.paintImmediately(0, 0, loadingState.getSize().width,
                        loadingState.getSize().height);
                loadedType.setText("");
                loadedType.paintImmediately(0, 0, loadedType.getSize().width, loadedType.getSize().height);
                pane.setPage(url);

                loadedType.setText(pane.getContentType());
            } catch (Exception e) {
                System.out.println(e);
                JOptionPane.showMessageDialog(pane, new String[] { "Unable to open file", url },
                        "File Open Error", JOptionPane.ERROR_MESSAGE);
                loadingState.setText("Failed");
                textField.setEnabled(true);
                setCursor(Cursor.getDefaultCursor());
            }
        }
    });

    // Listen for page load to complete
    pane.addPropertyChangeListener(new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent evt) {
            if (evt.getPropertyName().equals("page")) {
                loadingState.setText("Page loaded.");
                textField.setEnabled(true); // Allow entry of new URL
                setCursor(Cursor.getDefaultCursor());
            }
        }
    });
}

From source file:Main.java

@Override
public void mouseMoved(MouseEvent event) {
    boolean isHyperlink = isHyperlink(event);
    if (isHyperlink) {
        tree.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    } else {//  w  w w. j  ava2 s  .co m
        tree.setCursor(Cursor.getDefaultCursor());
    }

}

From source file:biz.wolschon.finance.jgnucash.actions.SaveAsFilePluginMenuAction.java

@Override
public void actionPerformed(final ActionEvent e) {
    try {//www  .j  a  v  a  2  s  . co  m

        // Activate plug-in that declares extension.
        myJGnucashEditor.getPluginManager().activatePlugin(ext.getDeclaringPluginDescriptor().getId());
        // Get plug-in class loader.
        ClassLoader classLoader = myJGnucashEditor.getPluginManager()
                .getPluginClassLoader(ext.getDeclaringPluginDescriptor());
        // Load Tool class.
        Class toolCls = classLoader.loadClass(ext.getParameter("class").valueAsString());
        // Create Tool instance.
        Object o = toolCls.newInstance();
        if (!(o instanceof DataSourcePlugin)) {
            LOGGER.error("Plugin '" + pluginName + "' does not implement DataSourcePlugin-interface.");
            JOptionPane.showMessageDialog(myJGnucashEditor, "Error",
                    "Plugin '" + pluginName + "' does not implement DataSourcePlugin-interface.",
                    JOptionPane.ERROR_MESSAGE);
            return;

        }
        DataSourcePlugin importer = (DataSourcePlugin) o;
        try {
            myJGnucashEditor.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
            //workaround because of a deadlock in log4j-consoleAppender in the JPf-classloader
            Logger.getLogger("org.java.plugin.standard.StandardPluginClassLoader").removeAllAppenders();
            Logger.getLogger("org.java.plugin.standard.StandardPluginClassLoader").setLevel(Level.FATAL);
            importer.writeTo(myJGnucashEditor.getWritableModel());
        } catch (Exception e1) {
            LOGGER.error("Write via Plugin '" + pluginName + "' failed.", e1);
            JOptionPane
                    .showMessageDialog(
                            myJGnucashEditor, "Error", "Write via Plugin '" + pluginName + "' failed.\n" + "["
                                    + e1.getClass().getName() + "]: " + e1.getMessage(),
                            JOptionPane.ERROR_MESSAGE);
        } finally {
            myJGnucashEditor.setCursor(Cursor.getDefaultCursor());
        }
    } catch (Exception e1) {
        LOGGER.error("Could not activate requested Writer-plugin '" + pluginName + "'.", e1);
        JOptionPane
                .showMessageDialog(
                        myJGnucashEditor, "Error", "Could not activate requested Writer-plugin '" + pluginName
                                + "'.\n" + "[" + e1.getClass().getName() + "]: " + e1.getMessage(),
                        JOptionPane.ERROR_MESSAGE);
    }
}