"AssignmentOperator ArrayInitializer" error

From: Kevin (javarox2000_at_hotmail.com)
Date: 03/24/05


Date: Wed, 23 Mar 2005 22:05:19 -0600

Hi! I'm typing in a program from a magazine and I'm pretty sure I've
typed it in correctly. However, I'm getting an error in one section of
the program, the class SizeListener. The error is: "Syntax error,
insert 'AssignmentOperator ArrayInitializer' to complete Expression."

I have no idea what this is trying to tell me. Can anyone look at the
code below and tell what's wrong with it?

Thanks!

public class SizeListener implements ItemListener {
        public void itemStateChanged(ItemEvent e) {
                if(e.getStateChange() == ItemEvent.SELECTED) {
                        String item = (String)e.getItem() ;
                        JViewport viewport ;
                        int size ;
                        if("2x2".equals(item))
                                size = 2 ;
                        else if("4x4".equals(item))
                                size = 4 ;
                        else if("8x8".equals(item))
                                size = 8 ;
                        else
                                size = 16 ;
                        
                        board.setBoardSize(size, size) ;
                        viewport = boardContainer.getViewport() ;
                        viewport.setViewPosition(new Point(0, 0)) ;
                        repaint() ;
                }
        }
}



Relevant Pages

  • Re: Linux becoming a virus target?
    ... Mark Pearson illuminated uk.comp.os.linux by typing: ... magazine in which there's a Linux column currently with a 'load Ubuntu' ...
    (uk.comp.os.linux)
  • Re: HEY HEY HEY
    ... sealed, with product key, CD, and floppies for Windows 98 2nd Edition. ... gazillion hours typing in code from Compute! ... magazine. ...
    (rec.sport.football.college)
  • Re: Resources to learn C
    ... I actually learned to type numbers by typing in all of those MLX programs out ... magazine on my Commodore 64. ... I was long out of high school when I got my C64, but when I started typing all ... To this day, I never use the numeric keypad on any keyboard, and don't miss it ...
    (Fedora)