Java Code

	import javax.swing.*;
	import java.awt.*;
	public class JButtonImg extends JApplet   
    {
	     JButton one, two, three;
	     Image img;
	     ImageIcon icon;
	     public void init( )
	     {
		    setLayout( new FlowLayout( ) );
		    one = new JButton( "one" );
		    img = getImage( getCodeBase( ), "buttonPoland.png" );
		    icon = new ImageIcon( img );
	   	    two = new JButton( icon  );
		    img = getImage( getCodeBase( ), "buttonYellowstone.png" );
	   	    three = new JButton( "three", new ImageIcon( img ) );
		    add( one );      
			add( two );      
			add( three );
	   }
	}

Back to Code Examples
©2006- by E.S.Boese. All Rights Reserved