Changing the Cursor : Cursor « Swing JFC « Java
- Java
- Swing JFC
- Cursor
Changing the Cursor
import java.awt.Button;
import java.awt.Component;
import java.awt.Cursor;
import javax.swing.JFrame;
public class Main {
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);
frame.setSize(300, 300);
frame.setVisible(true);
}
}
Related examples in the same category