Example usage for java.awt Component getCursor

List of usage examples for java.awt Component getCursor

Introduction

In this page you can find the example usage for java.awt Component getCursor.

Prototype

public Cursor getCursor() 

Source Link

Document

Gets the cursor set in the component.

Usage

From source file:Main.java

public static void main() {
    Component comp = new Button("OK");

    Cursor cursor = comp.getCursor();

    comp.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));

    JFrame frame = new JFrame();
    frame.add(comp);/* w w w  .j  a v a2s .  co  m*/
    frame.setSize(300, 300);
    frame.setVisible(true);
}

From source file:gmgen.util.MiscUtilities.java

/**
 *  Set the cursor for the specified component to the wait cursor
 *
 *@param  component  The component to set the cursor for
 *@return        The currently set cursor
 *//*from  w w w. ja v  a2  s . c o  m*/
public static Cursor setBusyCursor(java.awt.Component component) {
    Cursor old = component.getCursor();
    component.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

    return old;
}

From source file:plugin.notes.gui.NotesView.java

/**
 *  {@literal handle File->Open.} Will open any .gmn files, and import them into your
 *  notes structure//from www . ja  v  a 2 s.co  m
 */
public void handleOpen() {
    // TODO fix
    String sFile = SettingsHandler.getGMGenOption(OPTION_NAME_LASTFILE, System.getProperty("user.dir"));
    File defaultFile = new File(sFile);
    JFileChooser chooser = new JFileChooser();
    chooser.setCurrentDirectory(defaultFile);
    chooser.addChoosableFileFilter(getFileType());
    chooser.setFileFilter(getFileType());
    chooser.setMultiSelectionEnabled(true);
    Component component = GMGenSystem.inst;
    Cursor originalCursor = component.getCursor();
    component.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

    int option = chooser.showOpenDialog(GMGenSystem.inst);

    if (option == JFileChooser.APPROVE_OPTION) {
        for (File noteFile : chooser.getSelectedFiles()) {
            SettingsHandler.setGMGenOption(OPTION_NAME_LASTFILE, noteFile.toString());

            if (noteFile.toString().endsWith(EXTENSION)) {
                openGMN(noteFile);
            }
        }
    }

    GMGenSystem.inst.setCursor(originalCursor);
    refreshTree();
}