Results 1 to 2 of 2
  1. #1
    helme360 is offline Member
    Join Date
    Apr 2011
    Posts
    1
    Rep Power
    0

    Default I know the problem is with the ArrayList! I just cant find where

    my problem is that each tile created won't add to the arraylist.

    here is the error output:
    Java Code:
    Exception in thread "AWT-EventQueue-0" java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
    	at java.util.ArrayList.RangeCheck(ArrayList.java:546)
    	at java.util.ArrayList.get(ArrayList.java:321)
    	at Tile.rmPos(Tile.java:145)
    	at sudokuSolver.rmV(sudokuSolver.java:121)
    	at sudokuSolver.Solve(sudokuSolver.java:96)
    	at sudokuSolver.access$000(sudokuSolver.java:11)
    	at sudokuSolver$1.actionPerformed(sudokuSolver.java:63)
    	at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1882)
    	at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2202)
    	at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
    	at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
    	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:246)
    	at java.awt.Component.processMouseEvent(Component.java:5617)
    	at javax.swing.JComponent.processMouseEvent(JComponent.java:3129)
    	at java.awt.Component.processEvent(Component.java:5382)
    	at java.awt.Container.processEvent(Container.java:2010)
    	at java.awt.Component.dispatchEventImpl(Component.java:4083)
    	at java.awt.Container.dispatchEventImpl(Container.java:2068)
    	at java.awt.Component.dispatchEvent(Component.java:3918)
    	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4256)
    	at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3936)
    	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3866)
    	at java.awt.Container.dispatchEventImpl(Container.java:2054)
    	at java.awt.Window.dispatchEventImpl(Window.java:1801)
    	at java.awt.Component.dispatchEvent(Component.java:3918)
    	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:501)
    	at java.awt.EventQueue.access$000(EventQueue.java:80)
    	at java.awt.EventQueue$1.run(EventQueue.java:462)
    	at java.awt.EventQueue$1.run(EventQueue.java:461)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:84)
    	at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:95)
    	at java.awt.EventQueue$2.run(EventQueue.java:476)
    	at java.awt.EventQueue$2.run(EventQueue.java:475)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:84)
    	at java.awt.EventQueue.dispatchEvent(EventQueue.java:473)
    	at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:269)
    	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
    	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:184)
    	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:176)
    	at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
    I know it's probably a very silly problem but I just can't find it!
    Last edited by helme360; 07-08-2011 at 05:30 PM.

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,965
    Rep Power
    8

    Default

    That's way too much code to wade through. The problem is that you're trying to access an index that is larger than the ArrayList's size. You can't access index 1 unless you have two items in your ArrayList (index 0 and index 1).
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

Similar Threads

  1. Find the index number of strings in an arraylist
    By africanhacker in forum New To Java
    Replies: 3
    Last Post: 03-24-2011, 03:25 PM
  2. Problem- arraylist
    By whizzz in forum New To Java
    Replies: 3
    Last Post: 12-05-2010, 01:13 AM
  3. ArrayList problem.
    By keo in forum New To Java
    Replies: 4
    Last Post: 10-15-2010, 11:22 AM
  4. ArrayList problem
    By brian.baert in forum New To Java
    Replies: 8
    Last Post: 03-06-2010, 01:49 PM
  5. ArrayList problem
    By khamuruddeen in forum New To Java
    Replies: 7
    Last Post: 12-22-2007, 05:46 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •