Closed Thread
Results 1 to 4 of 4

Thread: Draw line into Canvas in Netbeans

  1. #1
    Rammstein104 is offline Newbie
    Join Date
    Mar 2010
    Posts
    1
    Rep Power
    0

    Draw line into Canvas in Netbeans

    I put a Canvas on a form in the Form Designer of NetBeans. How can I draw lines onto the canvas?
    Last edited by Rammstein104; 03-14-2010 at 07:41 AM.

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    Join Date
    May 2009
    Location
    Belgium
    Posts
    1,879
    Rep Power
    24

    Re: Draw line into Canvas in Netbeans

    This simple program draws a line onto a canvas:
    Code:
    import java.awt.*; 
    import javax.swing.*;
    
    
    
    public class MyFrame extends Canvas
    {
        JFrame frame;
    
        public MyFrame()
        {
            super();
            super.setSize(800,600);
            frame = new JFrame("canvas line");
            frame.getContentPane().add(this);
            frame.pack();
            frame.setVisible(true);
    
        }
    
        @Override
        public void paint(Graphics g) {
            super.paint(g);
            g.drawLine(1,1,500,500);
        }
    }

  4. #3
    sose is offline Newbie
    Join Date
    Dec 2010
    Posts
    1
    Rep Power
    0

    Re: Draw line into Canvas in Netbeans

    i want to draw tAble in canvaS without using form????!!!!!!!!!

  5. #4
    Java_'s Avatar
    Java_ is offline Newbie
    Join Date
    Oct 2010
    Location
    United Kingdom
    Posts
    13
    Rep Power
    0

    Re: Draw line into Canvas in Netbeans

    Thanks, +rep.

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. to draw a line throgh netbeans IDE
    By Direction in forum Java Help
    Replies: 0
    Last Post: 03-14-2010, 11:23 PM
  2. simple draw line
    By Siten0308 in forum C# Programming
    Replies: 4
    Last Post: 09-25-2009, 12:24 PM

Tags for this Thread

Bookmarks

Posting Permissions

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