Results 1 to 2 of 2
- 07-31-2007, 05:25 PM #1
Member
- Join Date
- Jul 2007
- Posts
- 40
- Rep Power
- 0
Error: myframe.java:26: ')' expected
I do not see anything wrong with this code, but I keep getting an error when I try to compile. I use JDK environment and just compile in a command prompt window. The error I get is:
The code and the text in red is where the error is supposed to be. In the error message, the "<" doesn't show for some reason.Java Code:myframe.java:26: ')' expected if( (x+=3) 200) continue; 1 error
Thanks.Java Code:import java.awt.*; class myframe extends Frame { static int x=0,y=120; // x,y position to display message static int i=0; static int LtoR=1; // 1->msg L-to-R, 0->top to bot. Font fb = new Font("TimesRoman", Font.BOLD, 36); String msg[]={"Java", "Portable", "Secure", "Easy"}; Color color[]={Color.blue, Color.yellow, Color.green, Color.red}; public void paint(Graphics g) { // gets called by the runtime g.setFont( fb ); g.setColor( color[i] ); g.drawString(msg[i],x,y); } static public void main(String s[]) throws Exception { myframe mf = new myframe(); mf.setSize(220,200); int pixelsPerLine=200, totalLines=4; mf.setVisible(true); for (int j=0;j<pixelsPerLine*totalLines; j++) { Thread.sleep(25); mf.repaint(); if (LtoR==1) { [COLOR="Red"]if ( (x+=3) < 200) continue;[/COLOR] i = ++i % 4; // mv i to next msg/color x=50; y=0; LtoR=0; // mv msg top to bot next } else { if ( (y+=3) < 200) continue; i = ++i % 4; // mv i to next msg/color x=0; y=120; LtoR=1; // move msg L-to-R next } } System.exit(0); } }
- 07-31-2007, 07:32 PM #2
Similar Threads
-
Identifier expected error
By vasu18 in forum New To JavaReplies: 1Last Post: 01-01-2008, 05:49 PM -
Error: ')' expected
By baltimore in forum New To JavaReplies: 1Last Post: 08-07-2007, 06:32 AM -
Error: '{' expected
By romina in forum New To JavaReplies: 1Last Post: 07-26-2007, 09:34 AM -
My error is: ')' expected
By silvia in forum New To JavaReplies: 1Last Post: 07-18-2007, 04:49 PM -
MSG ERROR: : expected
By Marty in forum New To JavaReplies: 1Last Post: 05-31-2007, 02:21 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks