Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Serialization compiler error

 
Nicholas Carrier
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok this is an inner class in my BeatBox class.

public class MyLoadListener implements ActionListener {
public void actionPerformed(ActionEvent a) {

JFileChooser fileOpen = new JFileChooser();
fileOpen.showOpenDialog(theFrame);
File myFile = fileOpen.getSelectedFile();

try {

FileInputStream fileReader = new FileInputStream(myFile);
ObjectInputStream os = new ObjectInputStream(fileReader);
checkboxState = (boolean[]) is.readObject();

} catch(Exception ex) {

ex.printStackTrace();

}

for (int i = 0; i < 256; i++) {
JCheckBox check = (JCheckBox) checkBoxList.get(i);
if(checkboxState[i]) {
check.setSelected(true);
} else {
check.setSelected(false);
}

} // end of for loop

sequencer.stop();
buildTrackAndStart();



} // end of method

} // end of inner class

Now when I try to compile this, I get this error message complaining about my is variable, see below. Now I know I must just be missing something stupid so, if anyone can help that'd be great.

BeatBox.java:185: cannot find symbol
symbol : variable is
location: class BeatBox.MyLoadListener
checkboxState = (boolean[]) is. readObject();
^

the ^ is supposed to be under is, but I can't seem to get it to stick there
[ June 07, 2005: Message edited by: Nicholas Carrier ]
 
Kristin Stromberg
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It doesn't look like you've declared the variable "is".
 
Nicholas Carrier
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is why god invented other people. Just so they can look at something so painfully obvious that it hurts. Thank you very much, I've staring at that for roughly 2 hours.
 
Timmy Marks
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
and the compiler message

cannot find symbol
symbol : variable is


didn't give you a clue? Basically, that's exactly what Kristin said.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic