Skip to main content

How to dynamically assign text to a JButton

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
No replies
weejay
Offline
Joined: 2011-01-23

Hello All,
I have a question. I want to dynamically assign text to a JButton, wanted to know if its possible. To be more clear, I have 10 Buttons which are created without initializing to a name and set to invisible.
There is a search button, when I click them it will generate a string array. Based on the values I want to assign those values to the Button text and make them visible. Can someone help me with this?