Question

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 java netbeans 5.5 tutorial) and i guess netbeans removed some of the things needed for that tutorial.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top