okay so I have an array of buttons, and at some point in the program I want to access the index of a button clicked in order to perform some calculations....so there are two options that I can think of...maybe there is a method to pull out the index (2d array) and use that...or what I've done in the meanwhile is create an extended class that adds methods like the ones in this code, but I am getting a compiler error saying that it can't find the constructor for it... for example I am creating a button using this new class and placing the string which is the text withinn the button so its not recognizing thtat constructor.....hopefully you all understand what I mean

import javax.swing.*;

public class BoggleButton extends JButton
{
	private int row, col;
	
    
	public void setPosition(int r, int c)
	{
	    row = r;
	    col = c;
	}
		
	public int getRow()
	{
	    return row;
	}
	
	public int getCol()
	{
	    return col;
	}
}

and I am getting that compiler error here:

newGameButton = new BoggleButton("New Game");

and this compiles but doesn't display the letters in each button:

grid[r][c] = new BoggleButton(letterArray[r][c]);

okay...so turns out I found out how to do it....

for those that might need the answer, here goes:

when creating classes that inherit others, all members are passed on to new class except constructor(because its not a member) so if you want to call a constructor that has parameters you have to put (from what I read, if it doesn't have parameters, the parameterless constructor of parent class is automatically called, otherwise you need to do this code or call a method of parent class to do the same thing)

super(parameters go here);
This question has already been answered. Start a new discussion instead.