PROGRAM FOCUSLISTENER!       Example focuslistener.f

! Code converted using TO_F90 by Alan Miller
! Date: 2001-03-14  Time: 23:02:25


USE JAPI


INTEGER :: frame,obj
INTEGER :: button1,button2,button3
INTEGER :: focuslst

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

frame    = j_frame("watch the Focus")
CALL j_setflowlayout(frame,j_horizontal)

button1  = j_button(frame,"Button 1")
button2  = j_button(frame,"Button 2")
button3  = j_button(frame,"Button 3")

focuslst = j_focuslistener(button3)

CALL j_pack(frame)
CALL j_show(frame)

NEXTACTION: DO
      obj =  j_nextaction()
IF(obj == frame) EXIT NEXTACTION

IF(obj == focuslst) THEN
  IF(j_hasfocus(focuslst)) THEN
    CALL j_setfocus(button2)
  END IF
END IF

END DO NEXTACTION

20   continue

CALL j_quit()
END PROGRAM FOCUSLISTENER

