import java.awt.Button;
import java.awt.Component;
import java.awt.Cursor;
import javax.swing.JFrame;
public class MiCursor {
public static void main(String args[]) {
// Creamos un frame
JFrame frame = new JFrame();
// Creamos un boton
Component boton = new Button("Aceptar");
// El cursor del boton por default
// es Cursor.DEFAULT_CURSOR
Cursor cursor = boton.getCursor();
// Cambiamos el cursor
boton.setCursor(
Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)
);
// Agregamos el boton
// hacemos el frame visible
frame.getContentPane().add(boton);
frame.setSize(150, 100);
frame.setDefaultCloseOperation(
JFrame.EXIT_ON_CLOSE
);
frame.setVisible(true);
}
}
Posts Relacionados
Dejanos un comentario.