Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-31-2007, 07:25 PM
Member
 
Join Date: Jul 2007
Posts: 40
barney is on a distinguished road
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:

Code:
myframe.java:26: ')' expected if( (x+=3) 200) continue; 1 error
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.
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) { if ( (x+=3) < 200) continue; 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); } }
Thanks.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-31-2007, 09:32 PM
Senior Member
 
Join Date: Jul 2007
Posts: 1,266
hardwired is on a distinguished road
I just copied, compiled and ran the code you posted. No compile errors and it ran okay.
In the error message, the "<" doesn't show for some reason.
Could it be that you are compiling a different file?
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Identifier expected error vasu18 New To Java 1 01-01-2008 07:49 PM
Error: ')' expected baltimore New To Java 1 08-07-2007 08:32 AM
Error: '{' expected romina New To Java 1 07-26-2007 11:34 AM
My error is: ')' expected silvia New To Java 1 07-18-2007 06:49 PM
MSG ERROR: : expected Marty New To Java 1 05-31-2007 04:21 AM


All times are GMT +3. The time now is 03:45 PM.


VBulletin, Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org