of Swing). Will be creating a graphics object!
First, noteworthy that the same old intro appears. Swing defines its own game,
except for a few areas where it deals with the underlying structures. JFrame
is one such area, and creates a basic window.
Had a bit of a run-in with Elipse, which wanted to make this section
serializable. This would have been a mistake, the serializable command
stores data in bytes. To do this for window creation would just slow down
the application. Chose to forget all that, form the Eclipse 'suggestions'.
From the Cyan Code tutorial, drawing a rectangle. As always, x,y gives the reference
point (Dead center in a 400, 400 window).width and height follow. Our Graphics
object calls its draw rectangle method.
We're hot! g passes a set color command for cyan ( with the dot, all caps protocol).
Our rectangle is now a filled figure, all cyan!
On to drawing an arc, with the paint command. Eclipse made me import .awt
or I wasn't getting anything. Fine. (Output is not precisely the same for different
operating systems, and Cyan Code - 2013 - is running a different version of windows
and an earlier Eclipse.) In point of fact, IBM developed Eclipse to help Java produce
more reliable graphics😉
If I draw 360 degress, the oval is always the same. But if there is a gap, it is
given by the start angle.
https://www.jmdoudoux.fr/java/dej/index.htm
No comments:
Post a Comment