Re: Saving and Opening an Array List
- From: "BladeZ" <cockjupp@xxxxxxxxxxx>
- Date: Wed, 27 Apr 2005 12:22:55 -0400
Hey Bjorn and Steve,
I still cant get the reading from array to text field working.
I looked through the book I have (Bell & PArr Java for Students) and I
found this piece of code which should've got it working.
---------
private void cut() {
if (itemSelected)
text = (String)artists.get(indexSelected); //This last piece of
code is what the book gave me
--------------
And my program compiles, but when i run it and do the action that uses the
cut method i get a "java.lang.ClassCastException" thrown at me.
I've breifly covered exception, but I haven't come across this before and
cant even figure out what it could mean.
It refers to the code that i got from the book (think it means the String
part)
This isn't related to the Book program I'm trying to do, this is to do
with a little class exercise that I'm trying to develop further so my end
project can be better.
Any ideas?
Here are some notes on my code;
So you know 'text' is a String I declared that gets text from the
TextField. I've also used it here for example;
-----
artist = new Artist(text);
artists.add(artist);
-----
That adds a new 'Artist'(Artist is a class, not the main one. It has a
constructor in it which creates an 'artist', well the visual aspects of it
at least.) to the array list 'artists'.
Can you help me out a little more?
.
- Follow-Ups:
- Re: Saving and Opening an Array List
- From: Steven
- Re: Saving and Opening an Array List
- References:
- Saving and Opening an Array List
- From: BladeZ
- Re: Saving and Opening an Array List
- From: Steven
- Re: Saving and Opening an Array List
- From: Bjorn Abelli
- Re: Saving and Opening an Array List
- From: BladeZ
- Re: Saving and Opening an Array List
- From: Bjorn Abelli
- Re: Saving and Opening an Array List
- From: BladeZ
- Re: Saving and Opening an Array List
- From: Bjorn Abelli
- Re: Saving and Opening an Array List
- From: Steven
- Re: Saving and Opening an Array List
- From: Bjorn Abelli
- Re: Saving and Opening an Array List
- From: Steven
- Saving and Opening an Array List
- Prev by Date: Re: "Exception in thread "main" java.lang.nosuchmethodError: main"
- Next by Date: Re: "Exception in thread "main" java.lang.nosuchmethodError: main"
- Previous by thread: Re: Saving and Opening an Array List
- Next by thread: Re: Saving and Opening an Array List
- Index(es):