Java Code
import java.awt.*;
import javax.swing.*;
public class FancyButtonApplet extends JApplet
{
Image imge;
FancyButton home, portfolio, contact;
public void init( )
{
setLayout( new FlowLayout( ) );
imge = getImage( getCodeBase( ), "buttonGreen.png" );
home = new FancyButton( imge, "Home" );
portfolio = new FancyButton( imge, "Portfolio" );
contact = new FancyButton( imge, "About Us" );
add( home ); add( portfolio ); add( contact );
}
}
import java.awt.*;
import javax.swing.*;
public class FancyButton extends JButton
{
public FancyButton( Image img, String text )
{
setIcon( new ImageIcon(img) );
setText( text );
setHorizontalTextPosition( JButton.CENTER );
setForeground( Color.white );
setBorderPainted( false );
setContentAreaFilled( false );
setFocusable( false );
}
}
©2007-
by E.S.Boese. All Rights Reserved