Java Tutorial 27 (GUI) - Draw Rectangles

preview_player
Показать описание
Java Tutorial 27

After watching this, you will know how to make simple rectangles inside of the window.
Рекомендации по теме
Комментарии
Автор

Thank you five years later this really did help me with my class

pikefolsom
Автор

For people watching this video. Don't call the paint method with null in the parameter. That is wrong! When the window is created it automatically calls the paint method. Doing it the way this guy taught it will give you a nullpointereception. The tutorial is wrong. Yes it will work, but it throws an exception.

xhvyroy
Автор

I highly appreciate this video, and other youtubers who take time out of their lives to make wonderful videos like these :)
Thanks to you, I aced my quiz! (Ok, my quiz is actually tomorrow, but I guarantee I will ace it)
;)

Nuhjeea
Автор

The only line you need in main is Tutorial t = new Tutorial(); Putting t.paint(null); in effectively means you are trying to call the paint() method twice, as paint() is automatically called when you create the class object.

-Coder
Автор

umm I get an error for importing java.awt.Graphics for some reason. Do I need to download it somewhere or what? I'm new to importing stuff and eclipse in general, but have been doing stuff in unity for 9 months.

spidernh
Автор

I miswrote triangles. Am I missing something? He passed null in as a parameter for graphics, how tf did it not throw an exception, and how the actual heck did it work?

chadzack
Автор

setSize(900, 800); and you'll see the rectangle

pc
Автор

hello sir, i am getting null pointer exception while running the program in eclipse

karchanareddy
Автор

can you tell me how to make this user defined

sakshidwivedi
Автор

I am having problem how can I resolve the problem

Khasubas
Автор

How can I make draw rectangular into button ?

steliostb
Автор

I feel like you don't know half of the things you are doing. It would be better if the explanations could be more in depth.

ZeBeaupre