Galera, estou criando um projeto de jogo da velha.
Nesse projeto existe o arquivo JogoDaVelha.java onde tem o construtor e os metodos.
Existe o arquivo TesteJogo.java onde executo o codigo.
Criei um tabuleiro utilizando swing.
O tabuleiro foi criado a partir de um for dentro de outro for, utilizando uma matriz de JLabels. Utilizei o swing tambem para deixar cm uma carinha legal. Ao executa-lo, ao clicar em alguma das celulas, apresenta o seguinte erro. Se alguem puder me dar uma luz fico muito grata.
Exception in thread “AWT-EventQueue-0” java.lang.ArrayIndexOutOfBoundsException: -1
at JogoDaVelha.jogarJogador(JogoDaVelha.java:94)
at Tabuleiro$2.mouseClicked(Tabuleiro.java:127)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDisp*atchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)[Link do projeto completo](https://github.com/raissahonorato/jogodavelha/tree/master/JogoDaVelha/src)



