How can i draw 2d in a JPanel that i have on my GUI? I can do it in eclipse but am having trouble doing it in netbeans. I've looked for some tutorials but the only good one i found was for netbeans 5.5 (world's fasted ja开发者_如何学Cva netbeans 5.5 tutorial) and i guess netbeans removed some of the things needed for that tutorial.
1) Go to the formview where you can edit your frame.
2) Select your panel
3) Click right and select costumize code
4) Add an override:
panel = new JPanel()
{
public void paintComponent(Graphics g)
{
drawPanel(g);
}
}
5) Create the drawPanel(Graphics g)
method.
精彩评论