Java Tutorial 50 (GUI) - How to Use the Paint Method with Canvas

preview_player
Показать описание
In this video, you will also learn how to use the paint method in a proper way.
Рекомендации по теме
Комментарии
Автор

I don't get when paint is called. How can I control when things are painted?

matrixxART
Автор

what about adding a key listener to it to move the shapes is that possible?

seebobeebo
Автор

John you rock
I Wonder if you are teacher. You have explained it exceptionally well.
Great.vid
.thanx

sallajeclow
Автор

Sorry, is it good practice to put the graphics in a separate class to the main user interface?
I'd like to put quite a few 3D graphics in my interface but I was wondering about separating them from the button functions, etc.. Or is this not necessary? :3

dianarune
Автор

Much appreciated, I didn't really understand this part in class and this made for an easy study of the topic for my Final.

goodknight
Автор

Nice tutorial. I know this is an old video but do you know how to make a rectangle with columns of different colors instead of just one solid color? Thanks

mab
Автор

hey man thankyou for your great tutorials....i use them alot. been of great help

pizzel
Автор

i learnt so much for the past few days this has been a great experience with you John :* thanks very much :*

shaniavictor
Автор

GREAT tutorial
Many thanks
..kindly do some more if you can.

sallajeclow
Автор

Just wondering but why do you have the constructor "public static void main (String [] args)" outside of your "main" class?

Brandon
Автор

Hey can you do a collision with image or shapes?

cravingbulletsphan
Автор

Do you do OpenGl? Ive been trhing to use it but it hasn't worked

javster
Автор

mab4110 You could just fill progressively smaller rectangles within the big one to make it seem like one with multiple columns, such as:

g.setColor(Color.red);
g.fillRect(10, 10, 100, 50);
g.setColor(Color.orange);
g.fillRect(30, 10, 80, 50);
g.setColor(Color.yellow);
g.fillRect(50, 10, 60, 50);
g.setColor(Color.blue);
g.fillRect(70, 10, 40, 50);
g.setColor(Color.magenta);
g.fillRect(90, 10, 20, 50);

Even though this is late, I hope it helps.

cameronl.
Автор

You should teach me how to draw individual pixels in Java .nc.

xXNiftyLlamaXx
Автор

haha okay, okay, I will! What should I go over in my next tutorial?

JohnGizdich
Автор

This tutorial was good as I am just beginning Java. 1 piece of advice going forward... when I was learning Python I found one problem with tutorials. Everything focus was on what and not why. If you show us how to create a method, we would like to know the how, but also the why and when we should create a method. (Method was an example, the same applies to anything your trying to teach. Tell us why we want to do this, give an example of an actual use for it.)
That tiny overlooked thought is often the difference between something making sense and sinking in or leaving us scratching our heads

BigJDawg
Автор

Please how can I create BufferStrategy in Canvas? thanks :)

kotliikkotliicek
Автор

I like your videos man. But maybe the canvas object is different.

Where exactly is the  paint method invoked? From the video i can see you are overriding the method but where are the methods being called exactly?

Do you have a Graphics variable you are passing into the parameter for the paint method?

losonnyboy
Автор

can you make a series for simple games? like space invaders, snake, brick ball game

can you please?

StefanBanu
Автор

how can i change color during run time?

ayeshabariring