An example on setting hand cursor for JButton in Java.
Example
import javax.swing.*;
import java.awt.*;
class HandCursorButton
{
public static void main(String args[])
{
JFrame f=new JFrame();
f.setTitle("Hand Cursor for JButton");
f.setSize(400,400);
f.setLayout(new FlowLayout());
f.setVisible(true);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JButton b=new JButton("Click me!");
b.setCursor(new Cursor(Cursor.HAND_CURSOR));
f.add(b);
}
}
Output
Hand Cursor for JButton |
No comments:
Post a Comment