![]() |
The NetRexx Tutorial
- Applets
|
*** This section is:*** and will be available in next releases
Creating and running your first Applet. I want to show you how to create and run a very simple Applet. As in the "Hello World!" example, the issue is not really the code (that giving the colours I use I think you'll just run only one time), but the whole procedure.
The steps can be resumed:
The Applet.
+----------------------------------------------------------------------+
| -- Your very first applet |01
| -- |02
| class aphello extends Applet |03
| properties private |04
| fo = Font |05
| XMAX = 500 |06
| YMAX = 500 |07
| |08
| method init |09
| resize(XMAX,YMAX) |10
| fo = Font("Helvetica",fo.BOLD,36) |11
| |12
| method paint(g=graphics) |13
| g.setFont(fo) -- set font |14
| g.setColor(Color.Pink) -- all pink, pls |15
| g.fillrect(0,0,XMAX,YMAX) -- |16
| g.setColor(Color.Yellow) -- write yellow |17
| g.drawString('Hello there!',10,200) -- message |18
+----------------------------------------------------------------------+
aphello.nrx
|
|
Download the source for the aphello.nrx example
The HTML.
+----------------------------------------------------------------------+
| <html> |01
| test |02
| <applet code="aphello.class" height=100 width=100 length=100> |03
| </applet> |04
| </html> |05
+----------------------------------------------------------------------+
aphello.html
|
The full procedure as typed in.
....................................................................
--
-- build the Applet
--
rsl3pm1 (68) edit aphello.nrx
--
-- compile it
-
rsl3pm1 (69) java COM.ibm.netrexx.process.NetRexxC aphello
--
-- edit the HTML
--
rsl3pm1 (70) edit aphello.html
--
-- try it out
--
rsl3pm1 (71) appletviewer aphello.html
....................................................................
|