Results 1 to 2 of 2

Thread: [RESOLVED] "Invalid index" on JFileChooser

  1. #1

    Thread Starter
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Resolved [RESOLVED] "Invalid index" on JFileChooser

    I have no idea why this problem is happening, but whenever I try the following code:
    Code:
    jFileOpenProject.setCurrentDirectory(myFile);
    where jFileOpenProject is a JFileChooser and myFile is a File object pointing to a directory.
    I get the following:

    java.lang.IndexOutOfBoundsException: Invalid index
    at javax.swing.DefaultRowSorter.convertRowIndexToModel(DefaultRowSorter.java:497)
    at sun.swing.FilePane$SortableListModel.getElementAt(FilePane.java:525)
    at javax.swing.plaf.basic.BasicListUI.updateLayoutState(BasicListUI.java:1336)
    at javax.swing.plaf.basic.BasicListUI.maybeUpdateLayoutState(BasicListUI.java:1287)
    at javax.swing.plaf.basic.BasicListUI.getCellBounds(BasicListUI.java:928)
    at javax.swing.JList.getCellBounds(JList.java:1600)
    at javax.swing.JList.ensureIndexIsVisible(JList.java:1116)
    at sun.swing.FilePane.ensureIndexIsVisible(FilePane.java:1514)
    at sun.swing.FilePane.doDirectoryChanged(FilePane.java:1440)
    at sun.swing.FilePane.propertyChange(FilePane.java:1487)
    at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:339)
    at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:276)
    at java.awt.Component.firePropertyChange(Component.java:7865)
    at javax.swing.JFileChooser.setCurrentDirectory(JFileChooser.java:568)
    at JFrameMain.initDialogs(JFrameMain.java:1215)
    Any ideas??
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

  2. #2

    Thread Starter
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: "Invalid index" on JFileChooser

    After 3 hours of researching I found out that some smart guy had the same problem and tried to blame it on the JDK - which is a stupid idea, since this method has been settings there since the swing was created - so he got spanked by the bug db admin saying that the whole test case he provided was wrong and that he's been working with Swing from the wrong thread. Instead.. well, read this if you're interested
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

Posting Permissions

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



Click Here to Expand Forum to Full Width