This section illustrates you how to show the icon on the button in Java Swing.
Setting icon on the button in Java
This section illustrates you how to show the icon on the button in Java Swing.
This program sets the icon on the button in Java Swing.
Following is the output of the program:
Code description:
setIcon(Icon):
Above method sets the specified Icon on the button.
ImagIcon(String image_name):
Above code creates an object of image.
Here is the code of the program:
import javax.swing.*;
|