Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
    Bookmark Topic Watch Topic
  • New Topic

Problem with JList

 
axel axek
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Report post to moderator
I am having problems reading from a JList, my application consists in adding text line by line from a text file to a JList, ..and the problem that i am facing is...how can i read elements from Jlist, character by character .... help please....
 
axel axek
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Report post to moderator
this is the code that reads form txt:
where "model" is Jlist model


and i have tried to read from list:
the line i'm tryng to read is something like: "S LLLL 0.2"

does anybody know any alternatives to read from a JList.....or a solution here....please help
and oh yes ..i've forgot to mention that this works just fine when using java.awt.List, but when i use JList...."bang" errors
 
axel axek
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Report post to moderator
the complete error is this
Exception in thread "AWT-EventQueue-0" java.lang.StringIndexOutOfBoundsException: String index out of range: 4
at java.lang.String.charAt(String.java:687)
at Sesiune.init(Sesiune.java:595)
at Sesiune.itemStateChanged(Sesiune.java:294)
at java.awt.Choice.processItemEvent(Choice.java:604)
at java.awt.Choice.processEvent(Choice.java:571)
at java.awt.Component.dispatchEventImpl(Component.java:4583)
at java.awt.Component.dispatchEvent(Component.java:4413)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
 
Rob Spoor
Sheriff
Pie
Posts: 20495
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please Use One Thread Per Question. Let's continue here.
 
    Bookmark Topic Watch Topic
  • New Topic