jj logo
Take a quick tour of JJ
Teacher Registration
Student Registration
Industry Registration
Guest Registration
Some Humor
Friends
Quotes


Name
Password
School


..
Class StayOrGoWithBorders

Import JJGui  

Class StayOrGoWithBorders

--Name: ?? --replace the ?? with your loginId

Boxes bStay, bGo ofClass JJButton     are private
Box   taTop      ofClass JJTextArea    is private
Box   taMiddle   ofClass JJTextArea    is private
Box   taBottom   ofClass JJTextArea    is private
Box   bp1        ofClass JJBorderPanel is private
Box   bp2        ofClass JJBorderPanel is private
Box   gpMiddle   ofClass JJGridPanel   is private

Constructor StayOrGoWithBorders(none) is public
 -- buttons
 New bStay ofClass JJButton with ("STAY")
 New bGo   ofClass JJButton with ("GO")

 -- all text areas request a small space
 New taTop    ofClass JJTextArea with ("You gotta let me know.  Should I ...",3,36)
 New taMiddle ofClass JJTextArea with ("or should I",3,11)
 New taBottom ofClass JJTextArea with ("",3,18) --we know what may go here

 -- two border panels
 New bp1 ofClass JJBorderPanel
 New bp2 ofClass JJBorderPanel

 -- a grid panel for the middle
 New gpMiddle ofClass JJGridPanel with (1,3) -- 3 across
EndConstructor StayOrGoWithBorders

 Routine ActsAsMain(none) is public
   Start -- tells JJ that this is the "main"

   -- the middle grid panel goes 3 across
   Call gpMiddle.add with (bStay)
   Call gpMiddle.add with (taMiddle)
   Call gpMiddle.add with (bGo)

   -- using only north and south, get top two of our three rows
   Call bp1.add with ("North", taTop)    -- top text area
   Call bp1.add with ("South", gpMiddle) -- middle row goes south of top text area

   -- using only north and south, get the bottom row below bp1
   Call bp2.add with ("North", bp1)      -- above border panel on top
   Call bp2.add with ("Center", taBottom) -- bottom text area south of bp1, and hogs the space

   Call bp2.jjShowAsMainPanel -- specify this panel is the main one
 EndRoutine ActsAsMain

Routine jjHandleButtonPress(b) is public
 Slot b ofClass JJButton

 -- check which button was pressed, and issue a response
 If (b == bStay) then
    Call taBottom.setText with ("it will be trouble")
 ElseIf (b == bGo) then
    Call taBottom.setText with ("it will be double")
 EndIf
EndRoutine jjHandleButtonPress

EndClass StayOrGoWithBorders
Return to
    JJ
home page
..