home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 18 REXX
/
18-REXX.zip
/
nrxsamp.zip
/
DLR.NRX
next >
Wrap
Text File
|
1997-08-13
|
2KB
|
66 lines
/*
* DLR.nrx -- GUI implementation of user registry
*/
class DLR extends Frame -- inherit from & extend the Frame class
properties private -- several methods in this class use
bstop = Button(" Stop ") -- the buttons and text fields
bhowdy = Button(" Say Howdy ")
method main(s=String[]) static -- static call of self
DLR("DLR" Rexx(s))
method dlr(s=String) -- constructor
super(s) -- Frame needs to know title
setLayout(BorderLayout()) -- our frame's layout
setBackground(Color.blue)
setForeground(Color.cyan)
banner = Label(" My First NetREXX GUI Program ", Label.CENTER)
add("North", banner) -- position our "banner"
p1 = Panel() -- a different layout for the buttons
p1.add(bstop) -- add the buttons to the panel
p1.add(bhowdy)
add("South", p1) -- add the panel to the frame
p2 = Panel() -- a container for the "center" stuff
p2.setLayout(BorderLayout()) -- but we want some control
p2.setBackground(Color.blue) -- set fg and bg colors for this area
p2.setForeground(Color.orange)
ulabel = Label("My Howdy Panel", Label.CENTER) -- some label text
p2.add("Center", ulabel) -- populate this piece
add("Center", p2) -- place the panel within the frame
w = 350 -- calculations to control the position
h = 200 -- of the frame when it appears on the
screen = Toolkit.getDefaultToolkit.getScreenSize -- display
reshape((screen.width-w)%2, (screen.height-h)%2, w, h)
this.pack -- pack up the contents of the frame
this.show -- and display it
/* Handle an action (button press) */
method action(e=Event, o=Object) returns boolean
select
when e.target = bstop then exit -- if Stop button, bye-bye
when e.target = bhowdy then do -- if Howdy button,
return 1
end
otherwise return super.action(e, o) -- some other action we don't handle
end
/* Handle an event (window close) */
method handleEvent(e=Event) returns boolean
if e.id = Event.WINDOW_DESTROY then exit -- close the windows, bye
return super.handleEvent(e)