Friends, i m trying add image to my Jbutton using seticon method but it hide the text label on the button. Here is the code :
try {
Image img = ImageIO.read(getClass().getResource("image.jpg"));
studentsButton.setIcon(new ImageIcon(img));
} catch (IOException ex) {
}
And i m using swing in eclipse without init()/paint()/graphics, its simple frame in main method.
Simply use
This will simply place the Text below the Image. And the output will be like this :
Here is one code example for your help having as output:
LATEST EDIT : REGARDING ADDING BACKGROUND IMAGE THROUGH JLABEL
Here is the output of the same :