Domanda

How can I create a table of Color elements like below ?

private Color[] = {Color.black, Color.darkGray, Color.gray, Color.lightGray, Color.pink, Color.orange, Color.cyan, Color.yellow, Color.magenta};
È stato utile?

Soluzione

In respect to your comment, your problem is that you have not correctly initialized your variable, in fact you forgot to name it.

Use

private Color[] colors = {Color.black, Color.darkGray, Color.gray, Color.lightGray, Color.pink, Color.orange, Color.cyan, Color.yellow, Color.magenta};

instead of your's and you can use your array.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top