PROGRAM JLIST!       Example list.f

! Code converted using TO_F90 by Alan Miller
! Date: 2001-03-15  Time: 10:31:55

USE JAPI

INTEGER :: frame,obj
INTEGER :: list,color

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

!       Generate Graphical Objects
frame = j_frame("doubleclick the colors")

list  = j_list(frame,6)
CALL j_additem(list,"Red")
CALL j_additem(list,"Green")
CALL j_additem(list,"Blue")
CALL j_additem(list,"Yellow")
CALL j_additem(list,"White")
CALL j_additem(list,"Black")
CALL j_additem(list,"Magenta")
CALL j_additem(list,"Orange")

CALL j_setpos(list,150,120)

CALL j_select(list,3)
CALL j_setnamedcolorbg(frame,j_yellow)

CALL j_show(frame)
NEXTACTION: DO
!       Waiting for actions */
      obj=j_nextaction()

IF(obj == list) THEN
  color=j_getselect(list)
  
  IF(color == 0) CALL j_setnamedcolorbg(frame,j_red)
  IF(color == 1) CALL j_setnamedcolorbg(frame,j_green)
  IF(color == 2) CALL j_setnamedcolorbg(frame,j_blue)
  IF(color == 3) CALL j_setnamedcolorbg(frame,j_yellow)
  IF(color == 4) CALL j_setnamedcolorbg(frame,j_white)
  IF(color == 5) CALL j_setnamedcolorbg(frame,j_black)
  IF(color == 6) CALL j_setnamedcolorbg(frame,j_magenta)
  IF(color == 7) CALL j_setnamedcolorbg(frame,j_orange)
  
  CALL j_deselect(list,j_getselect(list))
END IF

IF(obj == frame) EXIT NEXTACTION

END DO NEXTACTION

20  continue

CALL j_quit()
END PROGRAM JLIST


