i want ot make a 2-dimensional array of JToggleButtons to store toggle button names but i cant figure out the snytax Please Help!

Recommended Answers

All 3 Replies

JToggleButton[][] buttons = new JToggleButton[5][5];

That just declares the type and dimensions. You still have to set each element equal to a new instance of JToggleButton.

that doesnt work i get a cannot find symbol error

G:\Chess Game\src\chessgame\frmChessBoard.java:15: cannot find symbol
symbol : class JToggleButton
location: class chessgame.frmChessBoard
JToggleButton[][] buttons = new JToggleButton[8][8];
G:\Chess Game\src\chessgame\frmChessBoard.java:15: cannot find symbol
symbol : class JToggleButton
location: class chessgame.frmChessBoard
JToggleButton[][] buttons = new JToggleButton[8][8];
2 errors

never mind i gottai mport import javax.swing.JToggleButton;

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.