Want to use array element as attribute but quotes causes an error Java
<p>I'm really stumped by this simple problem I have.</p>

<p>I have an array with a few colors, like:</p>

<pre><code>String[] colors = {"BLACK", "YELLOW", "ORANGE"};
</code></pre>

<p>and I want to use a color from the array like this:</p>

<pre><code>setBackground(Color.colors[1]);
</code></pre>

<p>but I get the error</p>

<pre><code>colors cannot be resolved or is not a field.
</code></pre>

<p>I'm sure there is a simple solution to my problem?</p>

<p>Thanks!</p>

<hr>

<p>Thanks to everyone for their help! I should have put more detail in my question, it was actually to do with buttons in a GUI.
Big thanks to Igor Rodriguez whose answer was right on the mark :)</p>
