GROOVY JList in scrollPane wirft ArrayIndexOutOfBoundsException

speedster83

Neues Mitglied
Hallo,

ich habe einem scrollPane eine JList hinzugefügt.

Java:
panelTFSuche = swingBuilder.mpanel()
{        
    textField(id:"tf",/*,columns:27*/, preferredSize:[500,0], constraints:'growx,wrap', keyReleased:{e -> suche(e.getSource().getText())}  );

    scrollPane(id:'myScrollPane', preferredSize:[500,350], constraints:'growx', mouseMoved:{}, mouseEntered:{}, mouseExited:{},  minimumSize:[500,300] ) {
    l = list(id:'listId', font:h5Font,  selectionMode: ListSelectionModel.SINGLE_SELECTION, valueChanged:{
                e -> if(e.isAdjusting==false){addContent(e)}
        })
    }
}

Diese Liste wird über ein Textfeld gefiltert.

Java:
def void suche(def text)
{
    def foundCams =  model.datapoints.findAll(){
        ( (it.name.toLowerCase().contains(text.toLowerCase()))&&
        (it.datapointType.id.equals('c7678c83-2841-435d-b9a7-e4669f64d033')) )||
        ( (it.description.toLowerCase().contains(text.toLowerCase()))&&
        (it.datapointType.id.equals('c7678c83-2841-435d-b9a7-e4669f64d033')) )
    };
    if (foundCams!=null)
    {
        foundCams.sort();
        swingBuilder.listId.listData = foundCams
        swingBuilder.listId.selectedIndex = 0;
        listWithNames = foundCams.description
    }
}

Fehler.png

Ich weiß es ist anhand dieses Codeteils schwer zu erkennen was das Programm genau macht.
Ich denke aber, es handelt sich hier um ein grundsätzliches Problem. Ich habe die ListData auch
schon durch einfache Buchstaben folgen welche in der Liste angezeigt werden ausgetauscht.
Sobald ich mit der Maus auf ein Element in der Liste zeige, wird dieses markiert.
Filtere ich nun die Liste, wird der Eintrag auf dem der Mauszeiger zeigt nach oben verschoben.
Dies hat eine ArrayIndexOutOfBoundsException zu Folge.

Java Web Start 10.55.2.14
JRE-Version verwenden 1.7.0_55-b14 Java HotSpot(TM) Client VM
Benutzer-Home-Verzeichnis = C:\Users\ESSER
----------------------------------------------------
c: Konsolenfenster löschen
f: Objekte in Finalisierungs-Queue finalisieren
g: Garbage Collect
h: Diese Hilfemeldung anzeigen
m: Speicherauslastung drucken
o: Logging auslösen
p: Proxykonfiguration neu laden
q: Konsole ausblenden
r: Policy-Konfiguration neu laden
s: System- und Deployment-Eigenschaften ausgeben
t: Threadliste ausgeben
v: Threadstack ausgeben
0-5: Trace-Ebene auf <n> setzen
----------------------------------------------------
Exception in thread "AWT-EventQueue-2" java.lang.ArrayIndexOutOfBoundsException: 5
at javax.swing.JList$4.getElementAt(Unknown Source)
at org.jvnet.substance.SubstanceListUI$CellRepaintCallback.<init>(SubstanceListUI.java:322)
at org.jvnet.substance.SubstanceListUI$RolloverFadeListener.fadeOut(SubstanceListUI.java:226)
at org.jvnet.substance.SubstanceListUI$RolloverFadeListener.handleMove(SubstanceListUI.java:194)
at org.jvnet.substance.SubstanceListUI$RolloverFadeListener.mouseMoved(SubstanceListUI.java:151)
at java.awt.AWTEventMulticaster.mouseMoved(Unknown Source)
at java.awt.AWTEventMulticaster.mouseMoved(Unknown Source)
at java.awt.Component.processMouseMotionEvent(Unknown Source)
at javax.swing.JComponent.processMouseMotionEvent(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$200(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$1.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$1.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$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.pumpEventsForFilter(Unknown Source)
at java.awt.WaitDispatchSupport$2.run(Unknown Source)
at java.awt.WaitDispatchSupport$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.WaitDispatchSupport.enter(Unknown Source)
at java.awt.Dialog.show(Unknown Source)
at com.jidesoft.dialog.StandardDialog.show(Unknown Source)
at java.awt.Component.show(Unknown Source)
at java.awt.Component.setVisible(Unknown Source)
at java.awt.Window.setVisible(Unknown Source)
at java.awt.Dialog.setVisible(Unknown Source)
at eu.primion.psmConfig.actions.MainActions.runServerScript(MainActions.java:468)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.jdesktop.application.ApplicationAction.noProxyActionPerformed(ApplicationAction.java:647)
at org.jdesktop.application.ApplicationAction.actionPerformed(ApplicationAction.java:687)
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.AbstractButton.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)
at java.awt.AWTEventMulticaster.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$200(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$1.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$1.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$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)

Hat jemand dazu eine Idee?
Ich habe dies nun auf verschiedenste Weise getestet, immer mit dem gleichen Ergebnis.

Dies passiert nicht, wenn der Mauszeiger nicht im ScrollPane Feld ist. ???:L
 
Zuletzt bearbeitet:

Joose

Top Contributor
Was passiert denn wenn du bei der ungefilterten JList mit der Maus über einen Bereich ohne Item gehst?
Fliegt dann ebenfalls eine Exception?
 

speedster83

Neues Mitglied
Nein, in allen anderen Fällen gibt es keine Exception.
Dies passiert nur, wenn per mouse Over ein Element vor selektiert war und die Liste dann so weit schrumpft, dass die Maus auf kein Element mehr zeigt.
 

Ähnliche Java Themen

Neue Themen


Oben