PROGRAM JLISTMLTPL!       Example listmultiple.f

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

USE JAPI

INTEGER :: frame,obj,list
INTEGER :: r,g,b

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

frame   = j_frame("select the colors")

list    = j_list(frame,3)

CALL j_additem(list,"Red")
CALL j_additem(list,"Green")
CALL j_additem(list,"Blue")

CALL j_setpos(list,130,100)
CALL j_multiplemode(list, .true. )
CALL j_select(list,0)
CALL j_select(list,1)

r=255
g=255
b=0
CALL j_setcolorbg(frame,r,g,b)

CALL j_show(frame)
NEXTACTION: DO
      obj=j_nextaction()

IF(obj == list) THEN
  r=0
  g=0
  b=0
  IF(j_isselect(list,0)) r=255
  IF(j_isselect(list,1)) g=255
  IF(j_isselect(list,2)) b=255
  CALL j_setcolorbg(frame,r,g,b)
END IF

IF(r+g+b < 256) THEN
  CALL j_setcolor(frame,255,255,255)
ELSE
  CALL j_setcolor(frame,0,0,0)
END IF

IF(obj == frame) EXIT NEXTACTION

END DO NEXTACTION

20  continue

CALL j_quit()
END PROGRAM JLISTMLTPL

