program T_japi2

! prevod real na string,vystup textu, Konec z menu 

use std_type
use japi
use VstupVystup


implicit none

integer :: frame,canvas,menubar,soubor,menu,konec
real(kind=SP) :: xsp
real(kind=DP) :: xdp
integer :: menobj

integer,parameter :: CanvasWidth=300 ,CanvasHeight=200


IF( .NOT. j_start()) THEN
		PRINT*, "can't connect to JAPI server"
  		CALL j_quit()
  		stop
	END IF


frame = j_frame("T_japi2")
call j_setsize(frame,CanvasWidth,CanvasHeight)
call j_setpos(frame,100,100)
call j_setflowlayout(frame,J_CENTER)
 
canvas = j_canvas(frame,CanvasWidth+1,CanvasHeight+1)
!call j_setpos(canvas,0,25)
call j_setnamedcolorbg(canvas,J_YELLOW)

menubar = j_menubar(frame)
soubor  = j_menu(menubar,"Soubor")
konec	= j_menuitem(soubor,"Konec")

call j_pack(frame)
call j_show(frame)


call j_setnamedcolor(canvas,J_BLUE)
call j_drawrect(canvas,0,0,30,30)
call j_drawrect(canvas,0,0,CanvasWidth,CanvasHeight)
call j_drawstring(canvas,30,30,"Test")

! Ceka na udalost z menu, zde jen konec
NEXTACTION: DO
menobj = j_nextaction()
if (menobj==konec) call j_quit()
END DO NEXTACTION
!
! Nebo ukoncit takto
!read *
!call j_quit()

end program T_japi2
