Array/Method/Java help
<p>I have two .java's one called GUI.java, another called CustomPanel.java</p>

<p>Once a button is pressed in GUI.java, it does some stuff:</p>

<pre><code>if (e.getSource() == displayButton)
        {
            //pageviews1 = Integer.parseInt(myText1.getText());
            CustomPanel cp = new CustomPanel();
            Graphics g = loginMainPanel.getGraphics();

            int pos = 0;
            while (pos &lt;= 9)
            {
            if (values[pos] &gt; biggestvalue)
            {
            biggestvalue = values[pos];
            }
            pos = pos + 1;
            }

            cp.test(g, values[0], values2[0], "1", biggestvalue);
            cp.test(g, values[1], values2[1], "2", biggestvalue);
            cp.test(g, values[2], values2[2], "3", biggestvalue);
            cp.test(g, values[3], values2[3], "4", biggestvalue);
            cp.test(g, values[4], values2[4], "5", biggestvalue);
            cp.test(g, values[5], values2[5], "6", biggestvalue);
            cp.test(g, values[6], values2[6], "7", biggestvalue);
            cp.test(g, values[7], values2[7], "8", biggestvalue);
            cp.test(g, values[8], values2[8], "9", biggestvalue);
            cp.test(g, values[9], values2[9], "10", biggestvalue);
            //System.out.println("Added Data: " + values2[count2]);
            //count2++;
            graphlink.setEnabled(true);
        }
</code></pre>

<p>You don't really need to know what except cp.test;
(It does alot but i've condensed it to fit my problem)</p>

<pre><code>public void test(Graphics g, int pageviews2, String date2, String extcount5, int maxint)
{
...
critxvalues[0] = calc;
crityvalues[0] = desty;
System.out.println(critxvalues[0] + ":" + crityvalues[0]);
}
</code></pre>

<p>Then once another button is pressed in GUI.java something else happens:</p>

<pre><code>    CustomPanel cp = new CustomPanel();
    cp.tooltip(x,y);
</code></pre>

<p>This cp.tooltip is simply:</p>

<pre><code>public void tooltip(int x, int y)
{   
System.out.println(critxvalues[0] + ":" + crityvalues[0]);
}
</code></pre>

<p>Which I hoped would print out the same values as when the array[0] is printed out before, but it doesn't cp.tooltip only prints out 0:0, while cp.test prints out (example) 200:200, so why is the:</p>

<pre><code>critxvalues[0] = calc;
crityvalues[0] = desty;
</code></pre>

<p>(in cp.test) not saving the values?</p>

<p>The critxvalue/crityvalue is initalised at the top of CustomPanel.java...</p>

<pre><code>int [] critxvalues = new int[100];
    int [] crityvalues = new int[100];
</code></pre>

<p>Please help,</p>

<p>Thanks.</p>
