Re: increment letters



On Jul 31, 4:03 pm, glennsno...@xxxxxxxxxxx wrote:
this.add(new JButton("A"));

Try

add(new JButton(""+'A'+i));

This works in C; less sure about Java. There's also:

add(new JButton(LETTERS[i]));

with elsewhere in the class the field

private static final String[] LETTERS = {"A","B","C",...,"Z"};

with the ... filled in in the obvious manner.

The array method is more amenable to any subsequent i18n conversions.

.


Quantcast