PROGRAM JBUTTON!       Example button.f

! Code converted using TO_F90 by Alan Miller
! Date: 2001-03-14  Time: 19:21:42

USE JAPI

INTEGER :: frame,menubar,FILE,quit,button,obj
INTEGER :: i,big

IF( .NOT. j_start()) THEN
  PRINT*, "can't connect to JAPI server"
  GO TO 20
END IF

frame   = j_frame("")
menubar = j_menubar(frame)
FILE    = j_menu(menubar,"File")
quit    = j_menuitem(FILE,"Quit")


button  = j_button(frame,"increase")
CALL j_setsize(button,80,20)
CALL j_setpos(button,88,138)

CALL j_setsize(frame,256,256)
CALL j_show(frame)

big=0
NEXTACTION: DO
      obj=j_nextaction()

IF(obj == button) THEN
  IF(big == 0) THEN
    DO i=0,40
      CALL j_setsize(button,80+i*2,20+i*2)
      CALL j_setpos(button,88-i,138-i)
      CALL j_sync()
    END DO
    big=1
    CALL j_settext(button,"shrink")
    CALL j_settext(frame,"Shrinking Button")
  ELSE
    DO i=40,0,-1
      CALL j_setsize(button,80+i*2,20+i*2)
      CALL j_setpos(button,88-i,138-i)
      CALL j_sync()
    END DO
    big=0
    CALL j_settext(button,"increase")
    CALL j_settext(frame,"Growing Button")
  END IF
END IF


IF((obj == quit) .OR. (obj == frame)) EXIT

END DO NEXTACTION

20      CONTINUE
CALL j_quit()

END PROGRAM JBUTTON

