1. What is purpose of this declaration (line 16): Graphics2D screen2D; code works even without it?
The author left it in inadvertently. The Graphics object passed into the paint method should not be used (or stored) outside of it, so there's no point in having it.
2. What is purpose of getSize().width, getSize().height in this line (33):
I mean, how can it even get size of newly created object when size is not defined (prior to) that object creation?
The size is defined, it should be the size of the JApplet. If you read the javadocs of the fill method, it should make a big difference whether the Shape covers 0x0 pixels, or the entire applet, don't you think?
Joined: Sep 28, 2013
Yes, you are right. Meanwhile I figured out that Eclipse predefined (by default) JApplet size to 200 x 200, so there is where gets size. I forgot about it so I thought it would be zero anyway. So, I recon if fill is set on 0x0 as in then it does nothing but if set on 200x200 which gets from then it does what it is supposed to do.
Thank you for heads up!
subject: Applet with getSize().width, getSize().height