Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-22-2009, 05:01 AM
SwEeTAcTioN's Avatar
Member
 
Join Date: Oct 2009
Posts: 69
Rep Power: 0
SwEeTAcTioN is on a distinguished road
Default 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
Bookmark Post in Technorati
Reply With Quote
  #2 (permalink)  
Old 11-22-2009, 05:08 AM
Fubarable's Avatar
Moderator
 
Join Date: Jun 2008
Posts: 6,428
Rep Power: 8
Fubarable is on a distinguished road
Default
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
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 11-22-2009, 05:10 AM
Fubarable's Avatar
Moderator
 
Join Date: Jun 2008
Posts: 6,428
Rep Power: 8
Fubarable is on a distinguished road
Default
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.
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 11-22-2009, 05:11 AM
SwEeTAcTioN's Avatar
Member
 
Join Date: Oct 2009
Posts: 69
Rep Power: 0
SwEeTAcTioN is on a distinguished road
Default
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
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 11-22-2009, 05:12 AM
Fubarable's Avatar
Moderator
 
Join Date: Jun 2008
Posts: 6,428
Rep Power: 8
Fubarable is on a distinguished road
Default
Originally Posted by SwEeTAcTioN View Post
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
Bookmark Post in Technorati
Reply With Quote
  #6 (permalink)  
Old 11-22-2009, 05:14 AM
SwEeTAcTioN's Avatar
Member
 
Join Date: Oct 2009
Posts: 69
Rep Power: 0
SwEeTAcTioN is on a distinguished road
Default
I actually got this code from my computer science teacher
__________________
Are you suggesting that Cocunuts migrate?!! -Monty Python
Bookmark Post in Technorati
Reply With Quote
  #7 (permalink)  
Old 11-22-2009, 05:32 AM
Fubarable's Avatar
Moderator
 
Join Date: Jun 2008
Posts: 6,428
Rep Power: 8
Fubarable is on a distinguished road
Default
Originally Posted by SwEeTAcTioN View Post
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.
Bookmark Post in Technorati
Reply With Quote
  #8 (permalink)  
Old 11-22-2009, 05:34 AM
SwEeTAcTioN's Avatar
Member
 
Join Date: Oct 2009
Posts: 69
Rep Power: 0
SwEeTAcTioN is on a distinguished road
Default
Any ideas on new code that does the same thing
__________________
Are you suggesting that Cocunuts migrate?!! -Monty Python
Bookmark Post in Technorati
Reply With Quote
  #9 (permalink)  
Old 11-22-2009, 05:36 AM
Fubarable's Avatar
Moderator
 
Join Date: Jun 2008
Posts: 6,428
Rep Power: 8
Fubarable is on a distinguished road
Default
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.
Bookmark Post in Technorati
Reply With Quote
  #10 (permalink)  
Old 11-22-2009, 05:39 AM
Fubarable's Avatar
Moderator
 
Join Date: Jun 2008
Posts: 6,428
Rep Power: 8
Fubarable is on a distinguished road
Default
Some links that might help:

Performing Custom Painting in Swing
2D Graphics Tutorial
Painting in AWT and Swing
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

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

BB 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
error debug stid Eclipse 2 10-16-2009 08:44 PM
How to debug javaScript? kishan Advanced Java 2 07-24-2009 10:16 AM
Debug challenge: how do you debug a Java program? CJSLMAN New To Java 60 07-04-2009 11:28 AM
Cannot debug on Eclipse.. and other IDE pexlee Eclipse 0 09-26-2008 06:07 PM
Cannot debug in NetBeans as well as other IDE pexlee NetBeans 0 09-26-2008 05:45 PM


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