PROGRAM JPRINT!       Example mandel2.f

! Code converted using TO_F90 by Alan Miller
! Date: 2001-03-15  Time: 12:38:06

USE JAPI 

INTEGER :: breite,hoehe
INTEGER :: frame,menubar,menu,printframe,printcanvas,quit,obj
INTEGER :: canvas,image


CALL j_setdebug(4)

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

image   = j_loadimage("images/mandel.gif")
breite  = j_getwidth(image)
hoehe   = j_getheight(image)

frame   = j_frame("Drucken")
menubar = j_menubar(frame)
menu    = j_menu(menubar,"File")
printframe  = j_menuitem(menu,"Print Frame")
printcanvas = j_menuitem(menu,"Print Canvas")
quit    = j_menuitem(menu,"Quit")

canvas  = j_canvas(frame,breite,hoehe)
CALL j_setpos(canvas,10,60)

CALL j_show(frame)
CALL j_pack(frame)

CALL j_drawimage(canvas,image,0,0)
NEXTACTION: DO
     obj = j_getaction()

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

IF(obj == printcanvas) CALL j_print(canvas)
IF(obj == printframe)  CALL j_print(frame)

END DO NEXTACTION

20      CONTINUE
CALL j_quit()

END PROGRAM JPRINT
