When i try to add background in Jbutton in java by going to its properties and then icon, it then sets the background of the button but the text which i have written on the button,it moves right(outside the button area).What is the solution for this?
Share
As far as I understand you are not setting background but you are setting Icon to button by this. And that is why you see Image on right side and text on left side. To add image as background to button you need to override
paintComponent(g)method ofJButonand draw your image in it.