Studyon Minte9.com
Java SE




Image Button




package testexample; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.*; public class Test extends JFrame { public static void main(String[] args) { Test frame = new Test(); frame.setBounds(200, 200, 300, 300); frame.setDefaultCloseOperation(EXIT_ON_CLOSE); frame.setLayout(new FlowLayout()); frame.setVisible(true); } public Test() { add(new JButton(){{ // --- Look Here --- // setIcon(new ImageIcon("data/images/red.png")); setBorderPainted(false); setContentAreaFilled(false); setFocusPainted(false); setCursor(new Cursor(Cursor.HAND_CURSOR)); addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { System.out.println("button clicked"); } }); }}); } }
 


http://www.coderanch.com/t/555039/GUI/java/Image-button
http://java-demos.blogspot.ro/2012/12/set-hand-cursor-for-jbutton.html