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.*;
|
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.
Ask Questions? Discuss: Setting icon on the button in Java View All Comments
Post your Comment