Download flag icons from www.33ff.com/flags/world-flags0001.html
// Demo of basic Swing JButton effects. // From a demo of Liang's "Java Programming", 5th ed., ch. 13 // Flag GIFs from www.33ff.com/flags/world-flags0001.html // // Written 4/2006 by Wayne Pollock, Tampa Florida USA. import javax.swing.*; public class SwingBtns extends JApplet { public void init () { ImageIcon usFlagIcon = new ImageIcon( getClass().getResource( "FlagIcon-US.gif") ); ImageIcon caFlagIcon = new ImageIcon( getClass().getResource( "FlagIcon-CA.gif") ); ImageIcon ukFlagIcon = new ImageIcon( getClass().getResource( "FlagIcon-UK.gif") ); JButton btn = new JButton( "Click me", usFlagIcon ); btn.setPressedIcon( caFlagIcon ); btn.setRolloverIcon( ukFlagIcon ); JPanel p = new JPanel(); p.add( btn ); add( p ); } public static void main ( String [] args ) { JFrame frame = new JFrame( "ButtonIcons" ); frame.setSize( 220, 72 ); frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); JApplet applet = new SwingBtns(); frame.add( applet ); applet.init(); applet.start(); frame.setVisible( true ); } }