Skip to content
Advertisement

What is the simplest way to draw in Java?

What is the simplest way to draw in Java?

JavaScript

This doesn’t work and I have no idea how to get anything to appear.

Advertisement

Answer

Easiest way:

JavaScript

You simply need to extend JPanel and override the paintComponent method of the panel.

I’d like to reiterate that you should not be overriding the paint method.

Here is a very minimalistic example that works.

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement