— Scott McNealy, Sun Microsystems Chairman, President and ceo


Repaint the object at a different x and y coordinate g.fillOval(25,55,100,100)



Download 40,57 Mb.
Pdf ko'rish
bet357/555
Sana26.05.2022
Hajmi40,57 Mb.
#609235
1   ...   353   354   355   356   357   358   359   360   ...   555
Bog'liq
Head First Java (Kathy Sierra, Bert Bates) (z-lib.org)

2
Repaint the object at a different x and y coordinate
g.fillOval(25,55,100,100);
25 pixels from the left, 55 
pixels from the top
(the object moved a little 
down and to the right) 
 3
Repeat the previous step with changing x and y values 
for as long as the animation is supposed to continue.
there are no
Dumb Questions
Q:
Why are we learning about 
animation here? I doubt if I’m 
going to be making games. 
A:
You might not be making 
games, but you might be 
creating simulations, where 
things change over time to show 
the results of a process. Or you 
might be building a visualization 
tool that, for example, updates 
a graphic to show how much 
memory a program is using, 
or to show you how much 
traffic is coming through 
your load-balancing server. 
Anything that needs to take a 
set of continuously-changing 
numbers and translate them into 
something useful for getting 
information out of the numbers.
Doesn’t that all sound business-
like? That’s just the “official 
justification”, of course. The real 
reason we’re covering it here is 
just because it’s a simple way 
to demonstrate another use 
of inner classes. (And because 
we just like animation, and our 
next Head First book is about 
J2EE and we know we can’t get 
animation in that one.)
inner 
classes


getting 
gui
you are here
4
383
What we really want is something like...
class MyDrawPanel extends JPanel {
public void paintComponent(Graphics g) {
g.setColor(Color.orange);
g.fillOval(x,y,100,100);

Download 40,57 Mb.

Do'stlaringiz bilan baham:
1   ...   353   354   355   356   357   358   359   360   ...   555




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish