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.
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); } }
i want to draw tAble in canvaS without using form????!!!!!!!!!
Thanks, +rep.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks