Results 1 to 10 of 10

Thread: Help with debug

  1. #1
    SwEeTAcTioN's Avatar
    SwEeTAcTioN is offline Member
    Join Date
    Oct 2009
    Posts
    69
    Rep Power
    0

    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:mad:

    Can anyone help debug

    all help is appreciated

    Java 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

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Java Code:
    public class screen.drawLine // ????
    You may want to rename this class.

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Java 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.

  4. #4
    SwEeTAcTioN's Avatar
    SwEeTAcTioN is offline Member
    Join Date
    Oct 2009
    Posts
    69
    Rep Power
    0

    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

  5. #5
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Quote 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.

  6. #6
    SwEeTAcTioN's Avatar
    SwEeTAcTioN is offline Member
    Join Date
    Oct 2009
    Posts
    69
    Rep Power
    0

    Default

    I actually got this code from my computer science teacher
    Are you suggesting that Cocunuts migrate?!! -Monty Python

  7. #7
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Quote 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.

  8. #8
    SwEeTAcTioN's Avatar
    SwEeTAcTioN is offline Member
    Join Date
    Oct 2009
    Posts
    69
    Rep Power
    0

    Default

    Any ideas on new code that does the same thing
    Are you suggesting that Cocunuts migrate?!! -Monty Python

  9. #9
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    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.

  10. #10
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

Similar Threads

  1. error debug
    By stid in forum Eclipse
    Replies: 2
    Last Post: 10-16-2009, 08:44 PM
  2. How to debug javaScript?
    By kishan in forum Advanced Java
    Replies: 2
    Last Post: 07-24-2009, 10:16 AM
  3. Debug challenge: how do you debug a Java program?
    By CJSLMAN in forum New To Java
    Replies: 60
    Last Post: 07-04-2009, 11:28 AM
  4. Cannot debug on Eclipse.. and other IDE
    By pexlee in forum Eclipse
    Replies: 0
    Last Post: 09-26-2008, 06:07 PM
  5. Cannot debug in NetBeans as well as other IDE
    By pexlee in forum NetBeans
    Replies: 0
    Last Post: 09-26-2008, 05:45 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •