@@JobMETechSolutions ok sir InshAllah. Sir g if we add icon as well as text in JButton but text and icon shown in JButto togather i wanto that if i click button the only icon should be shown and when i click again the JButto the text should be shown without making the JButto icon null? Is it possible
Just play with setIcon function of JButton! You’ll need statement which holds the current and precious state of the click listener! Where you’ll track when to set Icon or not!
Just follow the video carefully.!! It’s all about margin and snapping to other edges of panels and frame. If you any kind of detailed query then mail us at: info@jobme.pk
@@JobMETechSolutions ya....but I have set an icon to the button and made size of button as exact as icon .So if I change bounds of the buttons icon is moving
I understand your situation you have to use bounds method from your button if it’s added into a null or FreeLayout if not and you have added the button into a Flow or other layouts you have to use prefferedSize method of button. Let me show you the example: if your button variable name is homeBtn. You have to use homeBtn.setBounds(0, 0, 200, 40); first two parameters are for position in x and y