
11-22-2009, 05:01 AM
|
 |
Member
|
|
Join Date: Oct 2009
Posts: 69
Rep Power: 0
|
|
Help with debug
I get like 6 errors 5 of them on line 14(public void paint...) and 1 more on public class screen.drawLine
Can anyone help debug
all help is appreciated
|
Code:
|
import java.awt.event.*;
import java.awt.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class screen.drawLine
{
public static void main(String[] args){
{
Window win= new Window();
win.setSize(800,600);
}
public void paint(Graphics g){
{
screen.drawLine(300,250,725,650);
screen.drawLine(400,400,400,800);
}
}
}
} |
__________________
Are you suggesting that Cocunuts migrate?!! -Monty Python
|
|

11-22-2009, 05:08 AM
|
 |
Moderator
|
|
Join Date: Jun 2008
Posts: 6,428
Rep Power: 8
|
|
|
Code:
|
public class screen.drawLine // ???? |
You may want to rename this class.
__________________
When posting code, please use code tags so that your code is readable. To do this, place the tag [code] before your block of code and [/code] after your block of code.
How to use Code Tags
|
|

11-22-2009, 05:10 AM
|
 |
Moderator
|
|
Join Date: Jun 2008
Posts: 6,428
Rep Power: 8
|
|
|
Code:
|
public static void main(String[] args){
{
Window win= new Window(); // what the heck is a Window object and why are you using it?
win.setSize(800,600);
}
public void paint(Graphics g){
{
screen.drawLine(300,250,725,650); // why are you drawing with "screen"???
screen.drawLine(400,400,400,800);
}
} |
Sorry to be brutally blunt, but this code looks like it was put together by blind monkeys. You can't just randomly type in code and expect it to work mathemagically. Instead, you should plan your code before you type it.
|
|

11-22-2009, 05:11 AM
|
 |
Member
|
|
Join Date: Oct 2009
Posts: 69
Rep Power: 0
|
|
|
So i renamed it now im just getting errors in the line of code
(public void paint...)
Any idea?
__________________
Are you suggesting that Cocunuts migrate?!! -Monty Python
|
|

11-22-2009, 05:12 AM
|
 |
Moderator
|
|
Join Date: Jun 2008
Posts: 6,428
Rep Power: 8
|
|
Originally Posted by SwEeTAcTioN
|
So i renamed it now im just getting errors in the line of code
(public void paint...)
Any idea?
|
Yes, again, sorry to be blunt but: scrap this code, it's dreck and start over, but this time plan first.
__________________
When posting code, please use code tags so that your code is readable. To do this, place the tag [code] before your block of code and [/code] after your block of code.
How to use Code Tags
|
|

11-22-2009, 05:14 AM
|
 |
Member
|
|
Join Date: Oct 2009
Posts: 69
Rep Power: 0
|
|
|
I actually got this code from my computer science teacher
__________________
Are you suggesting that Cocunuts migrate?!! -Monty Python
|
|

11-22-2009, 05:32 AM
|
 |
Moderator
|
|
Join Date: Jun 2008
Posts: 6,428
Rep Power: 8
|
|
Originally Posted by SwEeTAcTioN
|
|
I actually got this code from my computer science teacher
|
Then talk to him asap. Either he wrote it bad or you copied it bad. Either way, it cannot be used. Period.
|
|

11-22-2009, 05:34 AM
|
 |
Member
|
|
Join Date: Oct 2009
Posts: 69
Rep Power: 0
|
|
|
Any ideas on new code that does the same thing
__________________
Are you suggesting that Cocunuts migrate?!! -Monty Python
|
|

11-22-2009, 05:36 AM
|
 |
Moderator
|
|
Join Date: Jun 2008
Posts: 6,428
Rep Power: 8
|
|
|
If you want to see code that actually does screen graphics, you'll find lots at the Sun Swing tutorials. That's likely your best bet since it will contain both working code samples and tutorials so you can understand what your coding and adapt it to your desires (and be able to fix errors that come up too). Much luck.
|
|

11-22-2009, 05:39 AM
|
 |
Moderator
|
|
Join Date: Jun 2008
Posts: 6,428
Rep Power: 8
|
|
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT +2. The time now is 07:39 AM.
|
|
VBulletin, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org