PROGRAM JSCROLLPN!       Example scrollpane.f

! Code converted using TO_F90 by Alan Miller
! Date: 2001-03-15  Time: 13:08:33

USE JAPI 

INTEGER :: frame,obj
INTEGER :: scrollpane,vscroll,hscroll,canvas
INTEGER :: x,y,width,height

x=0
y=0
width =400
height=400

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

frame      = j_frame("Scrollpane Demo")
CALL j_setborderlayout(frame)

scrollpane = j_scrollpane(frame)
vscroll    = j_vscrollbar(scrollpane)
hscroll    = j_hscrollbar(scrollpane)

canvas=j_canvas(scrollpane,400,400)

CALL j_setsize(scrollpane,180,150)

CALL j_pack(frame)
CALL j_show(frame)

DO  x=0,400,10
  CALL j_drawline(canvas,x,0,0,400-x)
  CALL j_drawline(canvas,x,400,400,400-x)
END DO
NEXTACTION: DO
      obj =  j_nextaction()
IF(obj == frame) EXIT NEXTACTION

IF(obj == scrollpane) THEN
  width =j_getviewportwidth(scrollpane)
  height=j_getviewportheight(scrollpane)
END IF

IF(obj == hscroll) x=j_getvalue(hscroll)
IF(obj == vscroll) y=j_getvalue(vscroll)

print*, "Viewport X = ",x,":",x+width
print*, "         Y = ",y,":",y+height

END DO NEXTACTION

20  continue
CALL j_quit()
END PROGRAM JSCROLLPN

