 <p>Do you mean you want to loop through them?</p> <p>If that's the case I'd probably use a multidimentional array (or arraylist)..</p> <pre><code>JButton[][] bttns = new JButton[5][16](); for(int i = 0; i &lt; bttns.length; i++) { for(int i2 = 0; i2 &lt; bttns[0].length; i2++) { bttns[i][i2].setText( String.valueOf(sh.charAt(i*bttns[0].length + i2)) ); bttns[i][i2].setVisible(True);; } } </code></pre> <p>etc.</p>