File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Problem with JList Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply locked New topic

Problem with JList

axel axek

Joined: May 28, 2009
Posts: 20
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 can i read elements from Jlist, character by character .... help please....
axel axek

Joined: May 28, 2009
Posts: 20
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

Joined: May 28, 2009
Posts: 20
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(
at Sesiune.init(
at Sesiune.itemStateChanged(
at java.awt.Choice.processItemEvent(
at java.awt.Choice.processEvent(
at java.awt.Component.dispatchEventImpl(
at java.awt.Component.dispatchEvent(
at java.awt.EventQueue.dispatchEvent(
at java.awt.EventDispatchThread.pumpOneEventForFilters(
at java.awt.EventDispatchThread.pumpEventsForFilter(
at java.awt.EventDispatchThread.pumpEventsForHierarchy(
at java.awt.EventDispatchThread.pumpEvents(
at java.awt.EventDispatchThread.pumpEvents(
Rob Spoor

Joined: Oct 27, 2005
Posts: 19685

Please Use One Thread Per Question. Let's continue here.

How To Ask Questions How To Answer Questions
It is sorta covered in the JavaRanch Style Guide.
subject: Problem with JList