 <p><strong>You can create a Map of JButton's Name to the JButton Object</strong></p> <p><code>Map&lt;String, JButton&gt; mbutt = new HashMap&lt;String, JButton&gt;();</code></p> <p><strong>And you can access the String and JButton by iterating over it like this.</strong></p> <pre><code>for(Map.Entry&lt;String,JButton&gt; map : mbutt.entrySet()){ String k = map.key(); // Key JButton bu = map.value(); // JButton } </code></pre>