Java Swing Tutorial - Java Cursor.getName()








Syntax

Cursor.getName() has the following syntax.

public String getName()

Example

In the following code shows how to use Cursor.getName() method.

import java.awt.Cursor;
/*www  .jav a2 s .  c om*/
import javax.swing.JFrame;

public class Main {
  public static void main(String[] args) {
    JFrame aWindow = new JFrame();
    aWindow.setBounds(200, 200, 200, 200);
    aWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    aWindow.setCursor(Cursor.getDefaultCursor());
    aWindow.setVisible(true);
    
    System.out.println(Cursor.getDefaultCursor().getName());
  }
}