# fehler



## fehleroOo (22. Okt 2011)

Hallo ich programmiere gerade ein Spiel, jetzt hab ich aber ein Problem undzwar kommt diese fehlermeldung


```
Exception in thread "AWT-EventQueue-0" java.lang.IndexOutOfBoundsException: Index: 2, Size: 2
	at java.util.ArrayList.RangeCheck(Unknown Source)
	at java.util.ArrayList.remove(Unknown Source)
	at Dominion.Spiel.Player.removeDeck(Player.java:157)
	at Dominion.Spiel.Mithintergrundbild.changeCuPlayer(Mithintergrundbild.java:419)
	at Dominion.Spiel.Mithintergrundbild.actionPerformed(Mithintergrundbild.java:455)
	at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
	at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
	at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
	at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
	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$000(Unknown Source)
	at java.awt.EventQueue$1.run(Unknown Source)
	at java.awt.EventQueue$1.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
	at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
	at java.awt.EventQueue$2.run(Unknown Source)
	at java.awt.EventQueue$2.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.AccessControlContext$1.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.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)

Betreffende Linien :
public void removeDeck(int x)
{
	d.remove(x);
} wobei d ein ArrayList ist
				 
p.removeDeck(u);
					
changeCuPlayer(getPlayer1(),getPlayer2(),cu);
```
Braucht ihr noch mehr Infromationen oder habt ihr ne Idee, weswegen es nicht geht.


----------



## Gast2 (22. Okt 2011)

Steht doch direkt in der ersten Zeile was da falsch läuft.
Du versuchst auf den Index 2 zuzugreifen, die Liste hat aber nur 2 Einträge.


----------



## Marco13 (22. Okt 2011)

http://www.java-forum.org/plauderecke/76387-problem.html


----------

