Java Video Tutorial 48

Make a Java Paint ApplicationThis tutorial is going to be a ton of fun. Today I’ll show you how to Make a Java Paint Application!

One of you guys asked me to do this and it gives me a great opportunity to review and cover new topics all at once. Somethings I cover that you may want to brush up on include using the Java Box Layout, Java ArrayList, and Java Graphics2D.

All of the code follows the video and it is heavily commented. If you have questions, feel free to ask. Everything used is here Zipped Archive

If you like this video, tell Google please [googleplusone]
Sharing is always appreciated [nttfblike]

Code from the Video

23 thoughts on “Java Video Tutorial 48”

  1. Thanks alot for the amazing tutorial. I have studiet it around 3 times. I want to be able to create it with out looking att your code πŸ™‚

    1. You’re very welcome πŸ™‚ Practicing and experimenting with your own ideas is the best way to go. If you learn to program out of your head, you’ll be able to make anything you can imagine

  2. Great tutorial!
    I am learning Design Patterns and I noticed that those kind of software is the best way to learn how to use Design Patterns.
    Can you please make a case study video tutorial of a paint application by using Design Patterns ?
    I think it will help newbies like me, how to apply OOAD and Design Patterns in real world projects.
    Thanks in advance.

    1. Thank you πŸ™‚ I am still working with Object Oriented Design in my current tutorial. I will cover more before it is over. I also will be covering design patterns further in my next tutorial on refactoring. I hope that helps

  3. All the time when I made a mouseListener and checked(with the simple System.out.println method) whether the repaint method worked when I release the mouse or not I got no result.

    I put the System.out.println method in the paint(Graphics g) method, but it still doesn’t print something in the console when I repaint.

    Do you have any idea what probably may have gone wrong?

    Btw thanks for the time you spent with helping people! I appreciate it!

      1. I only have used a part of your code but I tried to change it a little bit and play with it.

        private class drawStuff extends JComponent
        {
        public void paint(Graphics g)
        {
        Graphics2D graph2 = (Graphics2D)g;

        textArea.append(“PAINTING COMPONENT!\n”);

        }
        }

        1. I tried to repaint it in the timer that I used, a schoolmate told me that I should use paintComponent. He didn’t even know that there is just a paint method.

          I do not understand cause when I run the program, the paint method is called. (3 times; β€œPAINTING COMPONENT!\n” appears) And it still does when I delete the repaint method and then run it again. The repaint method makes no difference…

          The timer;
          //Timer
          new Timer((1000 / 60), new ActionListener() {

          public void actionPerformed(ActionEvent e) {
          repaint();

          }

          }).start();

          I’m still very glad there’s someone who want to help me(on the web)!

          1. Just made another version that works. I showed my friend who’s good at programming, but even he couldnt find a solution. We created a new file. I’m glad it now works.

            And again; Thanks for your tutorials!

  4. What IDE do you use? I try opening the archived files you sent with eclipse,but eclipse does not recognize it as an eclipse project

    1. Ok forget that last question,managed to solve it. My problem is..al I do it only draws rectangles. Any idea why?

      1. if i have to guess..you may not have setup the environment variable paths on the computer your using.

Leave a Reply

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