I Have array of JButtons if a 8x8 grid I want to click a button and change the icon of another in the grid (not the one clicked), I dont seem to be able to access the array outside the mouse listener.
class test
{
//cant access this why?
private JButton but[] = new JButton[64];
private class MyMouseAdapter extends MouseAdapter
{
public void mouseClicked(MouseEvent event)
{
JButton button = (JButton)event.getSource(); // this gets the clicked button but
}
}
class test
{
//cant access this why?
private JButton but[] = new JButton[64];
private class MyMouseAdapter extends MouseAdapter
{
public void mouseClicked(MouseEvent event)
{
JButton button = (JButton)event.getSource(); // this gets the clicked button but
}
}