Change the cursor shape : Cursor « Swing JFC « Java






Change the cursor shape

   

import java.awt.Cursor;

import javax.swing.JFrame;
import javax.swing.SwingUtilities;

public class Main extends JFrame {
  public static void main(String[] args) {
    SwingUtilities.invokeLater(new Runnable() {
      public void run() {
        Main mainForm = new Main();
        mainForm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        mainForm.setSize(250, 250);

        Cursor cursor = new Cursor(Cursor.HAND_CURSOR);
        mainForm.setCursor(cursor);

        mainForm.pack();
        mainForm.setVisible(true);
      }
    });
  }
}

   
    
    
  








Related examples in the same category

1.Change Cursor in a thread for animation
2.Changing the Cursor
3.Cursor Util