View Single Post
  #1 (permalink)  
Old 07-19-2007, 05:34 PM
ZAXTHEGREAT ZAXTHEGREAT is offline
Member
 
Join Date: Jul 2007
Posts: 10
ZAXTHEGREAT is on a distinguished road
First Typed via video instruction
Ok i have typed via video instruction my first program , but it didnt work.

Im am currently using JCreator as my editor and this is the detailed info i used.

Code:
import java.awt.Canvas; import java.awt.Graphics; import java.awt.FontMetrics; import java.awt.Rectangle; class TextThree extends Canvas { TextThree(){ setSize(300,100); } public void paint(Graphics g) { Rectangle rect = getBounds(); FontMetrics fm = g.getFontMetrics(); String str; int strwidth; int x; int y; str = "Top Left Corner"; y = fm.getAscent(); x = 0; g.drawString(str,x,y); str = "Top Right Corner"; strwidth = fm.stringWidth(str); y = fm.getAscent(); x = rect.width - strwidth; g.drawString(str,x,y); str = "Bottom Left Corner"; y = rect.height - fm.getDescent(); x = 0; g.drawString(str,x,y); str = "Bottom Right Corner"; strwidth = fm.stringWidth(str); y = rect.height - fm.getDescent(); x = rect.width - strwidth; g.drawString(str,x,y); } }
//But this is the error i get after compiling it and then running the file

--------------------Configuration: test1 - JDK version 1.6.0_02 <Default> - <Default>--------------------
java.lang.NoSuchMethodError: main
Exception in thread "main"
Process completed.

Could you help me with this area thx

ZAXTHEGREAT

Last edited by JavaBean : 07-19-2007 at 05:41 PM. Reason: Code placed inside [code] tags.
Reply With Quote
Sponsored Links