Java Video Tutorial 47

Java 2D Graphics TutorialIn this part of my Java Video Tutorial, I cover how to draw 2D graphics in Java. This tutorial will serve as an introduction before I make a paint application with Java.

I cover drawing lines, curves, ellipses, rectangles and numerous other shapes. Then we look at strokes, fills and gradients.

All of the code follows the video and can serve as a cheat sheet, or an additional teaching tool.

If you like videos like this, please tell Google [googleplusone]

Sharing is always appreciated [nttfblike]

Code from the Video

6 thoughts on “Java Video Tutorial 47”

  1. Hi Derek,

    Thanks a lot again for your great tutorials.
    I have two questions :
    1. How can I draw an arrow instead of a line ? I have graphical objects and I want to show their relations by drawing a directed arrow connecting them.
    2. In your tutorial we add the drawing by initializing an object from DrawStuff class , and in the paint method you create the Shape objects and draw them.
    Suppose I have a list of Shape objects , how can I send it to this method to draw them?

    Thanks in advance for your help.

      1. Sorry I did not get you fully
        So is there a way to draw an arrow instead of a line by giving starting and ending coordinates ? Do we have an arrow as a Shape object like a Line2D?

Leave a Reply

Your email address will not be published. Required fields are marked *