Author Topic: JAPI - ScriptBasic Java GUI extension module  (Read 30574 times)

Support

  • Administrator
  • *****
  • Posts: 22
    • View Profile
JAPI - ScriptBasic Java GUI extension module
« on: May 18, 2013, 01:24:15 PM »
JAPI Project Site

JAPI Reference Manual


I was strolling through the ScriptBasic source and noticed a JRE API extension module a user started on but didn't seem to finish. After tracking down the JAPI site I was able to download the source for the ScriptBasic binding and some examples. Here is a few screen shots and the ScriptBasic JAPI include declaring available functions. There is even a Java console/debugger that can be enable with J_ call.

This is nice that SB can interface through JRE to the Java VM under Linux. What has my interest is this JRE interface running on Android Linux and interfacing with Android's Java VM.



Code: [Select]
rem Example mandel.bas

import japi.bas

xstart = -1.8
xend   =  0.8
ystart = -1.0
yend   =  1.0

hoehe  = 240
breite = 320

if(j_start() = J_FALSE) then
    print("can't connect to JAPI server")
    end
endif

jframe  = j_frame("Variables Mandelbrot")
j_setborderlayout(jframe)

menubar = j_menubar(jframe)
jfile   = j_menu(menubar,"File")
calc    = j_menu(menubar,"Calc")
quit    = j_menuitem(jfile,"Quit")
start   = j_menuitem(calc,"Start")
jstop   = j_menuitem(calc,"Stop")

canvas  = j_canvas(jframe,breite,hoehe)

j_pack(jframe)
j_show(jframe)

obj = 0
do_work = 0

while((obj <> jframe) and (obj <> quit))

    if(do_work = 1) then
        obj = j_getaction()
    else
        obj = j_nextaction()
    endif      

    if(obj = start) then
        x = -1
        y = -1
        do_work = 1
    endif

    if(obj = jstop) then
       do_work = 0
    endif
    
    if(do_work = 1) then
        x = (x+1) % breite
        if(x = 0) then
            y = (y+1) % hoehe
        endif
        if((x = breite-1) and (y = hoehe-1)) then
            do_work = 0
        else
            zre = xstart + x*(xend-xstart)/breite
            zim = ystart + y*(yend-ystart)/hoehe
            it = mandel(zre,zim,512)
            j_setcolor(canvas,it*11,it*13,it*17)
            j_drawpixel(canvas,x,y)
        endif
    endif

    if(obj = canvas) then
        breite = j_getwidth(canvas)
        hoehe = j_getheight(canvas)
        x=-1
        y=-1
    endif
wend
j_quit()



function mandel(zre,zim,maxiter)
    mx = 0.0
    my = 0.0
    iter=0
    betrag=0.0
 
    while ((iter < maxiter) and (betrag < 4.0))
        iter = iter+1
        tmp = mx*mx-my*my+zre
        my = 2*mx*my+zim
        mx = tmp
        betrag = (mx*mx + my*my)
    wend
    mandel=iter
end function

This shows that animation is possible. (cool demo)

Code: [Select]
rem Example video.bas

    import japi.bas
    j_setdebug(0)

    if( j_start() = J_FALSE ) then
       print "can't connect to JAPI server"  
       end
    endif

    for i=0 to 17
       filename$ = "images/ms"&str$(fix(i+1))&".gif"
           print "Loading ",filename$,"\n"
           image[i]  = j_loadimage(filename$)
    next i
   
    breite  = j_getwidth(image[0])
    hoehe   = j_getheight(image[0])
    jframe   = j_frame("Video")

    menubar = j_menubar(jframe)
    jfile   = j_menu(menubar,"File")
    quit    = j_menuitem(jfile,"Quit")

    play    = j_menu(menubar,"Video")
    start   = j_menuitem(play,"Start")
    jstop   = j_menuitem(play,"Stop")

    canvas  = j_canvas(jframe,breite,hoehe)
    j_setpos(canvas,10,60)

    j_show(jframe)
    j_pack(jframe)
      
    i = 0
    do_work = J_FALSE
    obj = 0
    while((obj <> jframe) and (obj <> quit))

        if(do_work=J_TRUE) then
           obj=j_getaction()
        else
           obj=j_nextaction()
        endif
    
        if(obj = start) then
           do_work = J_TRUE
        endif
        
        if(obj = jstop) then
           do_work = J_FALSE
        endif
        
        if(do_work=J_TRUE) then
           j_drawimage(canvas,image[i],0,0)
           j_sync()
           j_sleep(50)
           i = (i+1) % 18
        endif

    wend
    j_quit()


Code: [Select]
rem Example vumeter.bas

    import japi.bas

    if( j_start() = J_FALSE ) then
        print "can't connect to JAPI server"  
        end
    endif

    jframe = j_frame("Meter")
    j_setborderlayout(jframe)
    j_setinsets(jframe,j_getinsets(jframe,J_TOP)+10,10,10,10)
    j_setvgap(jframe,10)

    progress=j_progressbar(jframe,J_HORIZONTAL)
    j_setborderpos(progress,J_BOTTOM)
    meter=j_meter(jframe,"Volt")

    j_setsize(jframe,150,170)
    j_show(jframe)

    value=50
    while(j_getaction()<>jframe)
       value=value-1
       if(j_random()>J_RANDMAX/2) then
         value = value+2
       endif
       j_setvalue(meter,value)
       j_setvalue(progress,value)
       j_sync()
       j_sleep(50)
    wend

    j_quit()
end


Code: [Select]
rem Example digits.bas

    import japi.bas
        
    if(j_start() = J_FALSE ) then
        print "can't connect to JAPI server"  
        goto 20
    endif

    jframe = j_frame("Digits")
    j_setborderlayout(jframe)
    j_setinsets(jframe,j_getinsets(jframe,J_TOP)+10,10,10,10)
    j_setvgap(jframe,10)

    panel = j_panel(jframe)
    j_setborderpos(panel,J_BOTTOM)
    j_setflowlayout(panel,J_HORIZONTAL)
    j_sethgap(panel,10)
    for i=4 to 1 step -1
       led[i]=j_led(panel,J_ROUND,J_RED)
       mouse[i]=j_mouselistener(led[i],J_RELEASED)
    next i

    seven = j_sevensegment(jframe,J_GREEN)

    j_setsize(jframe,150,250)
    j_show(jframe)
    
    obj=0

10  obj=j_nextaction()

        for i=1 to 4
            if(obj = mouse[i]) then
                j_setstate(led[i], j_getstate(led[i])-1)
            endif
        next i
          
        v=0
        if(j_getstate(led[4])) then v=v+8
        if(j_getstate(led[3])) then v=v+4
        if(j_getstate(led[2])) then v=v+2
        if(j_getstate(led[1])) then v=v+1
        j_setvalue(seven,v)
    
        if(obj = jframe) then goto 20
        
    goto 10

20  j_quit
    end


Code: [Select]
rem Example graphic.bas

    import japi.bas
    for i = 0 to 9
       x[i]=(i+1)*10
        if(even(i)) then
           y[i]=10
        else
           y[i]=90
        endif    
    next i
    
    if( j_start() = J_FALSE ) then
        print "can't connect to JAPI server"  
        end
    endif
 
    jframe   = j_frame("Graphic Primitives")
    j_setsize(jframe,720,260)

    canvas  = j_canvas(jframe,700,230)
    j_setpos(canvas,10,30)

    j_show(jframe)
    j_pack(jframe)

    j_setnamedcolor(canvas,J_BLUE)

rem      Normal

    j_translate(canvas,10,10)
    j_drawline(canvas,10,10,90,90)
    j_drawstring(canvas,0,105,"Line")

    j_translate(canvas,100,0)
    j_drawpolygon(canvas,10,x,y)
    j_drawstring(canvas,0,105,"Polygon")

    j_translate(canvas,100,0)
    j_drawrect(canvas,10,10,80,80)
    j_drawstring(canvas,0,105,"Rectangle")

    j_translate(canvas,100,0)
    j_drawroundrect(canvas,10,10,80,80,20,20)
    j_drawstring(canvas,0,105,"RoundRect")

    j_translate(canvas,100,0)
    j_drawcircle(canvas,50,50,40)
    j_drawstring(canvas,0,105,"Circle")
print "6"

    j_translate(canvas,100,0)
    j_drawoval(canvas,50,50,40,20)
    j_drawstring(canvas,0,105,"Oval")

    j_translate(canvas,100,0)
    j_drawarc(canvas,50,50,40,30,113,210)
    j_drawstring(canvas,0,105,"Arc")


rem     Filled

    j_translate(canvas,-600,100)
    j_drawpolyline(canvas,10,x,y)
    j_drawstring(canvas,0,105,"Polyline")

    j_translate(canvas,100,0)
    j_fillpolygon(canvas,10,x,y)
    j_drawstring(canvas,0,105,"FillPolygon")

    j_translate(canvas,100,0)
    j_fillrect(canvas,10,10,80,80)
    j_drawstring(canvas,0,105,"FillRectangle")

    j_translate(canvas,100,0)
    j_fillroundrect(canvas,10,10,80,80,20,20)
    j_drawstring(canvas,0,105,"FillRoundRect")

    j_translate(canvas,100,0)
    j_fillcircle(canvas,50,50,40)
    j_drawstring(canvas,0,105,"FillCircle")

    j_translate(canvas,100,0)
    j_filloval(canvas,50,50,40,20)
    j_drawstring(canvas,0,105,"FillOval")

    j_translate(canvas,100,0)
    j_fillarc(canvas,50,50,40,30,113,210)
    j_drawstring(canvas,0,105,"FillArc")


    while(j_nextaction()<>jframe)
wend
      
    j_quit()
    end


Code: [Select]
rem     Example graphicbutton.bas
    
    import japi.bas

    if( j_start() = J_FALSE ) then
        print "can't connect to JAPI server"  
        end
    endif

    jframe   = j_frame("Graphic Buttons")
    j_setflowlayout(jframe,J_HORIZONTAL)
    
    gbutton = j_graphicbutton(jframe,"images/open.gif")
    gbutton = j_graphicbutton(jframe,"images/new.gif")
    gbutton = j_graphicbutton(jframe,"images/save.gif")
    gbutton = j_graphicbutton(jframe,"images/cut.gif")
    gbutton = j_graphicbutton(jframe,"images/copy.gif")
    gbutton = j_graphicbutton(jframe,"images/paste.gif")
  
    j_pack(jframe)
    j_show(jframe)


    while(j_nextaction() <> jframe)
    wend
      
    j_quit()
    end


Code: [Select]
rem Example drawables.bas
    
    import japi.bas
    
    j_setdebug(1)
    
    if( j_start() = J_FALSE ) then
       print "can't connect to JAPI server"  
       end
    endif
    
    jframe = j_frame("")
    j_setborderlayout(jframe)
    
    menubar = j_menubar(jframe)
    jfile   = j_menu(menubar,"File")
    jprint  = j_menuitem(jfile,"Print")
    save    = j_menuitem(jfile,"Save BMP")
    quit    = j_menuitem(jfile,"Quit")
    canvas  = j_canvas(jframe,400,600)
    j_pack(jframe)
    j_show(jframe)
    
    a=drawgraphics(canvas,0,0,j_getwidth(canvas)-10,j_getheight(canvas)-10)
      
    obj=0
    while((obj <> jframe) and (obj <> quit))
        obj = j_nextaction()
    
        if(obj = canvas) then
            j_setnamedcolorbg(canvas,J_WHITE)
           call drawgraphics(canvas,10,10,j_getwidth(canvas)-10,j_getheight(canvas)-10)
        endif
    
        if(obj = jprint) then
           jprinter = j_printer(jframe)
           if(jprinter > 0) then
              call drawgraphics(jprinter,40,40,j_getwidth(jprinter)-80,j_getheight(jprinter)-80)
              j_print(jprinter)
           endif
        endif
    
        if(obj = save) then
           rem    NOTE: problems with WinNT 24 Bit Colordepth (use 16 Bit)
           image = j_image(600,800)
           call drawgraphics(image,0,0,600,800)
           if(j_saveimage(image,"test.bmp",J_BMP)=J_FALSE) then
               a=j_alertbox(jframe,"Problems","Can't save image","OK")
           endif
        endif
    
    wend
    j_quit()
    
    
            
    function drawgraphics(drawable,xmin,ymin,xmax,ymax)
    
        fntsize=10
        j_setfontsize(drawable,fntsize)
        j_setnamedcolor(drawable,J_RED)
    
        rem   Drawings
        j_drawline(drawable,xmin,ymin,xmax-1,ymax-1)
        j_drawline(drawable,xmin,ymax-1,xmax-1,ymin)
        j_drawrect(drawable,xmin,ymin,xmax-xmin-1,ymax-xmin-1)
    
        j_setnamedcolor(drawable,J_BLACK)
        j_drawline(drawable,xmin,ymax-30,xmax-1,ymax-30)
        tmpstr$ = "XMax = "+Str$(xmax)
        j_drawstring(drawable,xmax/2-j_getstringwidth(drawable,tmpstr$)/2,ymax-40,tmpstr$)
    
        j_drawline(drawable,xmin+30,ymin,xmin+30,ymax-1)
        tmpstr$ = "YMax = "+Str$(ymax)
        j_drawstring(drawable,xmin+50,40,tmpstr$)
    
        j_setnamedcolor(drawable,J_MAGENTA)
        for i=1 to 10
         j_drawoval(drawable,xmin+(xmax-xmin)/2,ymin+(ymax-ymin)/2,(xmax-xmin)/20*i,(ymax-ymin)/20*i)
        next i
            
        rem   Text
        j_setnamedcolor(drawable,J_BLUE)
        y=ymin
        for i=5 to 22
            j_setfontsize(drawable,i)
            x = xmax-j_getstringwidth(drawable,"JAPI Test Text")
            y = y+j_getfontheight(drawable)
            j_drawstring(drawable,x,y,"JAPI Test Text")
        next i
    
        rem   Images
        twux = j_loadimage("images/twux.gif")
        if(twux > 0) then
            j_drawimage(drawable,twux,100,200)
            j_drawscaledimage(drawable,twux,10,0,35,30,100,300,110,138)
        endif
                
    end function
   

JAPI.bas
Code: [Select]

REM
REM
REM   generated by makejapiscriba   DO NOT EDIT
REM
REM   Die Feb 25 17:56:47 MST 2003
REM
REM



REM BOOLEAN
    const J_TRUE              =    1
    const J_FALSE             =    0



REM ALIGNMENT
    const J_LEFT              =    0
    const J_CENTER            =    1
    const J_RIGHT             =    2
    const J_TOP               =    3
    const J_BOTTOM            =    4
    const J_TOPLEFT           =    5
    const J_TOPRIGHT          =    6
    const J_BOTTOMLEFT        =    7
    const J_BOTTOMRIGHT       =    8



REM CURSOR
    const J_DEFAULT_CURSOR    =    0
    const J_CROSSHAIR_CURSOR  =    1
    const J_TEXT_CURSOR       =    2
    const J_WAIT_CURSOR       =    3
    const J_SW_RESIZE_CURSOR  =    4
    const J_SE_RESIZE_CURSOR  =    5
    const J_NW_RESIZE_CURSOR  =    6
    const J_NE_RESIZE_CURSOR  =    7
    const J_N_RESIZE_CURSOR   =    8
    const J_S_RESIZE_CURSOR   =    9
    const J_W_RESIZE_CURSOR   =    10
    const J_E_RESIZE_CURSOR   =    11
    const J_HAND_CURSOR       =    12
    const J_MOVE_CURSOR       =    13



REM ORIENTATION
    const J_HORIZONTAL        =    0
    const J_VERTICAL          =    1



REM FONTS
    const J_PLAIN             =    0
    const J_BOLD              =    1
    const J_ITALIC            =    2
    const J_COURIER           =    1
    const J_HELVETIA          =    2
    const J_TIMES             =    3
    const J_DIALOGIN          =    4
    const J_DIALOGOUT         =    5



REM COLORS
    const J_BLACK             =    0
    const J_WHITE             =    1
    const J_RED               =    2
    const J_GREEN             =    3
    const J_BLUE              =    4
    const J_CYAN              =    5
    const J_MAGENTA           =    6
    const J_YELLOW            =    7
    const J_ORANGE            =    8
    const J_GREEN_YELLOW      =    9
    const J_GREEN_CYAN        =    10
    const J_BLUE_CYAN         =    11
    const J_BLUE_MAGENTA      =    12
    const J_RED_MAGENTA       =    13
    const J_DARK_GRAY         =    14
    const J_LIGHT_GRAY        =    15
    const J_GRAY              =    16



REM BORDERSTYLE
    const J_NONE              =    0
    const J_LINEDOWN          =    1
    const J_LINEUP            =    2
    const J_AREADOWN          =    3
    const J_AREAUP            =    4



REM MOUSELISTENER
    const J_MOVED             =    0
    const J_DRAGGED           =    1
    const J_PRESSED           =    2
    const J_RELEASED          =    3
    const J_ENTERERD          =    4
    const J_EXITED            =    5
    const J_DOUBLECLICK       =    6



REM COMPONENTLISTENER



REM J_MOVED
    const J_RESIZED           =    1
    const J_HIDDEN            =    2
    const J_SHOWN             =    3



REM WINDOWLISTENER
    const J_ACTIVATED         =    0
    const J_DEACTIVATED       =    1
    const J_OPENED            =    2
    const J_CLOSED            =    3
    const J_ICONIFIED         =    4
    const J_DEICONIFIED       =    5
    const J_CLOSING           =    6



REM IMAGEFILEFORMAT
    const J_GIF               =    0
    const J_JPG               =    1
    const J_PPM               =    2
    const J_BMP               =    3



REM LEDFORMAT
    const J_ROUND             =    0
    const J_RECT              =    1



REM RANDOMMAX
    const J_RANDMAX           =    2147483647




    declare sub j_start               alias "__j_scriba_start"              lib "japi"
    declare sub j_connect             alias "__j_scriba_connect"            lib "japi"
    declare sub j_setport             alias "__j_scriba_setport"            lib "japi"
    declare sub j_setdebug            alias "__j_scriba_setdebug"           lib "japi"
    declare sub j_frame               alias "__j_scriba_frame"              lib "japi"
    declare sub j_button              alias "__j_scriba_button"             lib "japi"
    declare sub j_graphicbutton       alias "__j_scriba_graphicbutton"      lib "japi"
    declare sub j_checkbox            alias "__j_scriba_checkbox"           lib "japi"
    declare sub j_label               alias "__j_scriba_label"              lib "japi"
    declare sub j_graphiclabel        alias "__j_scriba_graphiclabel"       lib "japi"
    declare sub j_canvas              alias "__j_scriba_canvas"             lib "japi"
    declare sub j_panel               alias "__j_scriba_panel"              lib "japi"
    declare sub j_borderpanel         alias "__j_scriba_borderpanel"        lib "japi"
    declare sub j_radiogroup          alias "__j_scriba_radiogroup"         lib "japi"
    declare sub j_radiobutton         alias "__j_scriba_radiobutton"        lib "japi"
    declare sub j_list                alias "__j_scriba_list"               lib "japi"
    declare sub j_choice              alias "__j_scriba_choice"             lib "japi"
    declare sub j_dialog              alias "__j_scriba_dialog"             lib "japi"
    declare sub j_window              alias "__j_scriba_window"             lib "japi"
    declare sub j_popupmenu           alias "__j_scriba_popupmenu"          lib "japi"
    declare sub j_scrollpane          alias "__j_scriba_scrollpane"         lib "japi"
    declare sub j_hscrollbar          alias "__j_scriba_hscrollbar"         lib "japi"
    declare sub j_vscrollbar          alias "__j_scriba_vscrollbar"         lib "japi"
    declare sub j_line                alias "__j_scriba_line"               lib "japi"
    declare sub j_printer             alias "__j_scriba_printer"            lib "japi"
    declare sub j_image               alias "__j_scriba_image"              lib "japi"
    declare sub j_filedialog          alias "__j_scriba_filedialog"         lib "japi"
    declare sub j_fileselect          alias "__j_scriba_fileselect"         lib "japi"
    declare sub j_messagebox          alias "__j_scriba_messagebox"         lib "japi"
    declare sub j_alertbox            alias "__j_scriba_alertbox"           lib "japi"
    declare sub j_choicebox2          alias "__j_scriba_choicebox2"         lib "japi"
    declare sub j_choicebox3          alias "__j_scriba_choicebox3"         lib "japi"
    declare sub j_progressbar         alias "__j_scriba_progressbar"        lib "japi"
    declare sub j_led                 alias "__j_scriba_led"                lib "japi"
    declare sub j_sevensegment        alias "__j_scriba_sevensegment"       lib "japi"
    declare sub j_meter               alias "__j_scriba_meter"              lib "japi"
    declare sub j_additem             alias "__j_scriba_additem"            lib "japi"
    declare sub j_textfield           alias "__j_scriba_textfield"          lib "japi"
    declare sub j_textarea            alias "__j_scriba_textarea"           lib "japi"
    declare sub j_menubar             alias "__j_scriba_menubar"            lib "japi"
    declare sub j_menu                alias "__j_scriba_menu"               lib "japi"
    declare sub j_helpmenu            alias "__j_scriba_helpmenu"           lib "japi"
    declare sub j_menuitem            alias "__j_scriba_menuitem"           lib "japi"
    declare sub j_checkmenuitem       alias "__j_scriba_checkmenuitem"      lib "japi"
    declare sub j_pack                alias "__j_scriba_pack"               lib "japi"
    declare sub j_print               alias "__j_scriba_print"              lib "japi"
    declare sub j_playsoundfile       alias "__j_scriba_playsoundfile"      lib "japi"
    declare sub j_play                alias "__j_scriba_play"               lib "japi"
    declare sub j_sound               alias "__j_scriba_sound"              lib "japi"
    declare sub j_setfont             alias "__j_scriba_setfont"            lib "japi"
    declare sub j_setfontname         alias "__j_scriba_setfontname"        lib "japi"
    declare sub j_setfontsize         alias "__j_scriba_setfontsize"        lib "japi"
    declare sub j_setfontstyle        alias "__j_scriba_setfontstyle"       lib "japi"
    declare sub j_seperator           alias "__j_scriba_seperator"          lib "japi"
    declare sub j_disable             alias "__j_scriba_disable"            lib "japi"
    declare sub j_enable              alias "__j_scriba_enable"             lib "japi"
    declare sub j_getstate            alias "__j_scriba_getstate"           lib "japi"
    declare sub j_getrows             alias "__j_scriba_getrows"            lib "japi"
    declare sub j_getcolumns          alias "__j_scriba_getcolumns"         lib "japi"
    declare sub j_getselect           alias "__j_scriba_getselect"          lib "japi"
    declare sub j_isselect            alias "__j_scriba_isselect"           lib "japi"
    declare sub j_isvisible           alias "__j_scriba_isvisible"          lib "japi"
    declare sub j_isparent            alias "__j_scriba_isparent"           lib "japi"
    declare sub j_isresizable         alias "__j_scriba_isresizable"        lib "japi"
    declare sub j_select              alias "__j_scriba_select"             lib "japi"
    declare sub j_deselect            alias "__j_scriba_deselect"           lib "japi"
    declare sub j_multiplemode        alias "__j_scriba_multiplemode"       lib "japi"
    declare sub j_insert              alias "__j_scriba_insert"             lib "japi"
    declare sub j_remove              alias "__j_scriba_remove"             lib "japi"
    declare sub j_removeitem          alias "__j_scriba_removeitem"         lib "japi"
    declare sub j_removeall           alias "__j_scriba_removeall"          lib "japi"
    declare sub j_setstate            alias "__j_scriba_setstate"           lib "japi"
    declare sub j_setrows             alias "__j_scriba_setrows"            lib "japi"
    declare sub j_setcolumns          alias "__j_scriba_setcolumns"         lib "japi"
    declare sub j_seticon             alias "__j_scriba_seticon"            lib "japi"
    declare sub j_setimage            alias "__j_scriba_setimage"           lib "japi"
    declare sub j_setvalue            alias "__j_scriba_setvalue"           lib "japi"
    declare sub j_setradiogroup       alias "__j_scriba_setradiogroup"      lib "japi"
    declare sub j_setunitinc          alias "__j_scriba_setunitinc"         lib "japi"
    declare sub j_setblockinc         alias "__j_scriba_setblockinc"        lib "japi"
    declare sub j_setmin              alias "__j_scriba_setmin"             lib "japi"
    declare sub j_setmax              alias "__j_scriba_setmax"             lib "japi"
    declare sub j_setdanger           alias "__j_scriba_setdanger"          lib "japi"
    declare sub j_setslidesize        alias "__j_scriba_setslidesize"       lib "japi"
    declare sub j_setcursor           alias "__j_scriba_setcursor"          lib "japi"
    declare sub j_setresizable        alias "__j_scriba_setresizable"       lib "japi"
    declare sub j_getlength           alias "__j_scriba_getlength"          lib "japi"
    declare sub j_getvalue            alias "__j_scriba_getvalue"           lib "japi"
    declare sub j_getdanger           alias "__j_scriba_getdanger"          lib "japi"
    declare sub j_getscreenheight     alias "__j_scriba_getscreenheight"    lib "japi"
    declare sub j_getscreenwidth      alias "__j_scriba_getscreenwidth"     lib "japi"
    declare sub j_getheight           alias "__j_scriba_getheight"          lib "japi"
    declare sub j_getwidth            alias "__j_scriba_getwidth"           lib "japi"
    declare sub j_getinsets           alias "__j_scriba_getinsets"          lib "japi"
    declare sub j_getlayoutid         alias "__j_scriba_getlayoutid"        lib "japi"
    declare sub j_getinheight         alias "__j_scriba_getinheight"        lib "japi"
    declare sub j_getinwidth          alias "__j_scriba_getinwidth"         lib "japi"
    declare sub j_gettext             alias "__j_scriba_gettext"            lib "japi"
    declare sub j_getitem             alias "__j_scriba_getitem"            lib "japi"
    declare sub j_getitemcount        alias "__j_scriba_getitemcount"       lib "japi"
    declare sub j_delete              alias "__j_scriba_delete"             lib "japi"
    declare sub j_replacetext         alias "__j_scriba_replacetext"        lib "japi"
    declare sub j_appendtext          alias "__j_scriba_appendtext"         lib "japi"
    declare sub j_inserttext          alias "__j_scriba_inserttext"         lib "japi"
    declare sub j_settext             alias "__j_scriba_settext"            lib "japi"
    declare sub j_selectall           alias "__j_scriba_selectall"          lib "japi"
    declare sub j_selecttext          alias "__j_scriba_selecttext"         lib "japi"
    declare sub j_getselstart         alias "__j_scriba_getselstart"        lib "japi"
    declare sub j_getselend           alias "__j_scriba_getselend"          lib "japi"
    declare sub j_getseltext          alias "__j_scriba_getseltext"         lib "japi"
    declare sub j_getcurpos           alias "__j_scriba_getcurpos"          lib "japi"
    declare sub j_setcurpos           alias "__j_scriba_setcurpos"          lib "japi"
    declare sub j_setechochar         alias "__j_scriba_setechochar"        lib "japi"
    declare sub j_seteditable         alias "__j_scriba_seteditable"        lib "japi"
    declare sub j_setshortcut         alias "__j_scriba_setshortcut"        lib "japi"
    declare sub j_quit                alias "__j_scriba_quit"               lib "japi"
    declare sub j_kill                alias "__j_scriba_kill"               lib "japi"
    declare sub j_setsize             alias "__j_scriba_setsize"            lib "japi"
    declare sub j_getaction           alias "__j_scriba_getaction"          lib "japi"
    declare sub j_nextaction          alias "__j_scriba_nextaction"         lib "japi"
    declare sub j_show                alias "__j_scriba_show"               lib "japi"
    declare sub j_showpopup           alias "__j_scriba_showpopup"          lib "japi"
    declare sub j_add                 alias "__j_scriba_add"                lib "japi"
    declare sub j_release             alias "__j_scriba_release"            lib "japi"
    declare sub j_releaseall          alias "__j_scriba_releaseall"         lib "japi"
    declare sub j_hide                alias "__j_scriba_hide"               lib "japi"
    declare sub j_dispose             alias "__j_scriba_dispose"            lib "japi"
    declare sub j_setpos              alias "__j_scriba_setpos"             lib "japi"
    declare sub j_getviewportheight   alias "__j_scriba_getviewportheight"  lib "japi"
    declare sub j_getviewportwidth    alias "__j_scriba_getviewportwidth"   lib "japi"
    declare sub j_getxpos             alias "__j_scriba_getxpos"            lib "japi"
    declare sub j_getypos             alias "__j_scriba_getypos"            lib "japi"
    declare sub j_getpos              alias "__j_scriba_getpos"             lib "japi"
    declare sub j_getparentid         alias "__j_scriba_getparentid"        lib "japi"
    declare sub j_setfocus            alias "__j_scriba_setfocus"           lib "japi"
    declare sub j_hasfocus            alias "__j_scriba_hasfocus"           lib "japi"
    declare sub j_getstringwidth      alias "__j_scriba_getstringwidth"     lib "japi"
    declare sub j_getfontheight       alias "__j_scriba_getfontheight"      lib "japi"
    declare sub j_getfontascent       alias "__j_scriba_getfontascent"      lib "japi"
    declare sub j_keylistener         alias "__j_scriba_keylistener"        lib "japi"
    declare sub j_getkeycode          alias "__j_scriba_getkeycode"         lib "japi"
    declare sub j_getkeychar          alias "__j_scriba_getkeychar"         lib "japi"
    declare sub j_mouselistener       alias "__j_scriba_mouselistener"      lib "japi"
    declare sub j_getmousex           alias "__j_scriba_getmousex"          lib "japi"
    declare sub j_getmousey           alias "__j_scriba_getmousey"          lib "japi"
    declare sub j_getmousepos         alias "__j_scriba_getmousepos"        lib "japi"
    declare sub j_getmousebutton      alias "__j_scriba_getmousebutton"     lib "japi"
    declare sub j_focuslistener       alias "__j_scriba_focuslistener"      lib "japi"
    declare sub j_componentlistener   alias "__j_scriba_componentlistener"  lib "japi"
    declare sub j_windowlistener      alias "__j_scriba_windowlistener"     lib "japi"
    declare sub j_setflowlayout       alias "__j_scriba_setflowlayout"      lib "japi"
    declare sub j_setborderlayout     alias "__j_scriba_setborderlayout"    lib "japi"
    declare sub j_setgridlayout       alias "__j_scriba_setgridlayout"      lib "japi"
    declare sub j_setfixlayout        alias "__j_scriba_setfixlayout"       lib "japi"
    declare sub j_setnolayout         alias "__j_scriba_setnolayout"        lib "japi"
    declare sub j_setborderpos        alias "__j_scriba_setborderpos"       lib "japi"
    declare sub j_sethgap             alias "__j_scriba_sethgap"            lib "japi"
    declare sub j_setvgap             alias "__j_scriba_setvgap"            lib "japi"
    declare sub j_setinsets           alias "__j_scriba_setinsets"          lib "japi"
    declare sub j_setalign            alias "__j_scriba_setalign"           lib "japi"
    declare sub j_setflowfill         alias "__j_scriba_setflowfill"        lib "japi"
    declare sub j_translate           alias "__j_scriba_translate"          lib "japi"
    declare sub j_cliprect            alias "__j_scriba_cliprect"           lib "japi"
    declare sub j_drawrect            alias "__j_scriba_drawrect"           lib "japi"
    declare sub j_fillrect            alias "__j_scriba_fillrect"           lib "japi"
    declare sub j_drawroundrect       alias "__j_scriba_drawroundrect"      lib "japi"
    declare sub j_fillroundrect       alias "__j_scriba_fillroundrect"      lib "japi"
    declare sub j_drawoval            alias "__j_scriba_drawoval"           lib "japi"
    declare sub j_filloval            alias "__j_scriba_filloval"           lib "japi"
    declare sub j_drawcircle          alias "__j_scriba_drawcircle"         lib "japi"
    declare sub j_fillcircle          alias "__j_scriba_fillcircle"         lib "japi"
    declare sub j_drawarc             alias "__j_scriba_drawarc"            lib "japi"
    declare sub j_fillarc             alias "__j_scriba_fillarc"            lib "japi"
    declare sub j_drawline            alias "__j_scriba_drawline"           lib "japi"
    declare sub j_drawpolyline        alias "__j_scriba_drawpolyline"       lib "japi"
    declare sub j_drawpolygon         alias "__j_scriba_drawpolygon"        lib "japi"
    declare sub j_fillpolygon         alias "__j_scriba_fillpolygon"        lib "japi"
    declare sub j_drawpixel           alias "__j_scriba_drawpixel"          lib "japi"
    declare sub j_drawstring          alias "__j_scriba_drawstring"         lib "japi"
    declare sub j_setxor              alias "__j_scriba_setxor"             lib "japi"
    declare sub j_getimage            alias "__j_scriba_getimage"           lib "japi"
    declare sub j_getimagesource      alias "__j_scriba_getimagesource"     lib "japi"
    declare sub j_drawimagesource     alias "__j_scriba_drawimagesource"    lib "japi"
    declare sub j_getscaledimage      alias "__j_scriba_getscaledimage"     lib "japi"
    declare sub j_drawimage           alias "__j_scriba_drawimage"          lib "japi"
    declare sub j_drawscaledimage     alias "__j_scriba_drawscaledimage"    lib "japi"
    declare sub j_setcolor            alias "__j_scriba_setcolor"           lib "japi"
    declare sub j_setcolorbg          alias "__j_scriba_setcolorbg"         lib "japi"
    declare sub j_setnamedcolor       alias "__j_scriba_setnamedcolor"      lib "japi"
    declare sub j_setnamedcolorbg     alias "__j_scriba_setnamedcolorbg"    lib "japi"
    declare sub j_loadimage           alias "__j_scriba_loadimage"          lib "japi"
    declare sub j_saveimage           alias "__j_scriba_saveimage"          lib "japi"
    declare sub j_sync                alias "__j_scriba_sync"               lib "japi"
    declare sub j_beep                alias "__j_scriba_beep"               lib "japi"
    declare sub j_random              alias "__j_scriba_random"             lib "japi"
    declare sub j_sleep               alias "__j_scriba_sleep"              lib "japi"
« Last Edit: May 21, 2013, 12:59:57 PM by support »

Support

  • Administrator
  • *****
  • Posts: 22
    • View Profile
Re: JAPI - ScriptBasic Java GUI extension module
« Reply #1 on: May 19, 2013, 09:32:57 PM »
I was able to get the ScriptBasic Windows version of JAPI extension module compiled using MS VC10. The one supplied from the site was too old to work with the current scriba or any version I could find that supports version 10 of the extension module interface. (currently at 11) The same Linux ScriptBasic JAPI scripts run untouched on Windows.  8)















« Last Edit: May 21, 2013, 01:00:28 PM by support »

Support

  • Administrator
  • *****
  • Posts: 22
    • View Profile
Re: JAPI - ScriptBasic Java GUI extension module
« Reply #2 on: May 20, 2013, 01:51:33 PM »
I downloaded to source to JAPI and it has a build system that generates everything from C files. ScriptBasic builds its source tree in much the same way. I'm going to try and regenerate/update the core JAPI JAR server JRE interface. It seems pretty easy to add new .java class files extending the API. The JAR file is converted to a C character string as C source. SB does the same for it's tokenized scripts to be compiled to C.


« Last Edit: May 20, 2013, 07:37:42 PM by support »

Support

  • Administrator
  • *****
  • Posts: 22
    • View Profile
Re: JAPI - ScriptBasic Java GUI extension module
« Reply #3 on: May 20, 2013, 10:52:25 PM »
I started the JAPI rebuilding of its utilities and the JAR file. There were two makefiles in the Java directory and I could only get the JDK2 version to compile. (-depend not a javac optiion in Makefile) It seems there have been some deprecated code since this was originally written 10 years ago. If there are any Java programmers viewing this, I could use a hand updating these Java AWT source files. (producing warnings at this point)

Code: [Select]
javac -Xlint:deprecation -O JAPI.java && jar cf JAPI.jar *.class
./JAPI_Alert.java:159: warning: [deprecation] reshape(int,int,int,int) in java.awt.Window has been deprecated
this.reshape(xpos,ypos,this.getSize().width,this.getSize().height);
   ^
./JAPI_Alert.java:160: warning: [deprecation] show() in java.awt.Dialog has been deprecated
this.show();
   ^
./JAPI_Thread.java:94: warning: [deprecation] readLine() in java.io.DataInputStream has been deprecated
clienthost = in.readLine();
              ^
./JAPI_Thread.java:534: warning: [deprecation] readLine() in java.io.DataInputStream has been deprecated
                String s = in.readLine();
                            ^
./JAPI_Thread.java:632: warning: [deprecation] readLine() in java.io.DataInputStream has been deprecated
                    String title  = in.readLine();
                                      ^
./JAPI_Thread.java:1102: warning: [deprecation] readLine() in java.io.DataInputStream has been deprecated
            String file = in.readLine();
                           ^
./JAPI_Thread.java:1115: warning: [deprecation] readLine() in java.io.DataInputStream has been deprecated
            String file = in.readLine();
                           ^
./JAPI_Thread.java:1252: warning: [deprecation] readLine() in java.io.DataInputStream has been deprecated
                  String title = in.readLine();
                                  ^
./JAPI_Thread.java:1313: warning: [deprecation] readLine() in java.io.DataInputStream has been deprecated
            String item = in.readLine();
                           ^
./JAPI_Thread.java:1317: warning: [deprecation] addItem(java.lang.String,int) in java.awt.List has been deprecated
((List)o[obj]).addItem(item,pos);
             ^
./JAPI_Thread.java:1343: warning: [deprecation] readLine() in java.io.DataInputStream has been deprecated
            String item   = in.readLine();
                             ^
./JAPI_Thread.java:1421: warning: [deprecation] disable() in java.awt.Component has been deprecated
              ((Component)o[obj]).disable();
                                ^
./JAPI_Thread.java:1423: warning: [deprecation] disable() in java.awt.MenuItem has been deprecated
              ((JAPI_Menu)o[obj]).disable();
                                ^
./JAPI_Thread.java:1425: warning: [deprecation] disable() in java.awt.MenuItem has been deprecated
              ((MenuItem)o[obj]).disable();
                               ^
./JAPI_Thread.java:1427: warning: [deprecation] disable() in java.awt.MenuItem has been deprecated
            ((CheckboxMenuItem)o[obj]).disable();
                                     ^
./JAPI_Thread.java:1439: warning: [deprecation] enable() in java.awt.Component has been deprecated
              ((Component)o[obj]).enable();
                                ^
./JAPI_Thread.java:1441: warning: [deprecation] enable() in java.awt.MenuItem has been deprecated
              ((JAPI_Menu)o[obj]).enable();
                                ^
./JAPI_Thread.java:1443: warning: [deprecation] enable() in java.awt.MenuItem has been deprecated
              ((MenuItem)o[obj]).enable();
                               ^
./JAPI_Thread.java:1445: warning: [deprecation] enable() in java.awt.MenuItem has been deprecated
            ((CheckboxMenuItem)o[obj]).enable();
                                     ^
./JAPI_Thread.java:1997: warning: [deprecation] replaceText(java.lang.String,int,int) in java.awt.TextArea has been deprecated
((TextArea)o[obj]).replaceText("",start,end);
                 ^
./JAPI_Thread.java:2181: warning: [deprecation] isSelected(int) in java.awt.List has been deprecated
             out.sendInt(((JAPI_List)o[obj]).isSelected(index)?JAPI_Const.J_TRUE:JAPI_Const.J_FALSE);
                                           ^
./JAPI_Thread.java:2659: warning: [deprecation] readLine() in java.io.DataInputStream has been deprecated
                 String str = in.readLine();
                               ^
./JAPI_Thread.java:2937: warning: [deprecation] hide() in java.awt.Component has been deprecated
  ((Component)o[i]).hide();
                  ^
./JAPI_Thread.java:3087: warning: [deprecation] readLine() in java.io.DataInputStream has been deprecated
               title = in.readLine();
                         ^
./JAPI_Thread.java:3121: warning: [deprecation] readLine() in java.io.DataInputStream has been deprecated
                     title = in.readLine();
                               ^
./JAPI_Thread.java:3264: warning: [deprecation] readLine() in java.io.DataInputStream has been deprecated
                      title = in.readLine();
                                ^
./JAPI_Thread.java:3285: warning: [deprecation] readLine() in java.io.DataInputStream has been deprecated
                    String icon = in.readLine();
                                    ^
./JAPI_Thread.java:3307: warning: [deprecation] readLine() in java.io.DataInputStream has been deprecated
                    title = in.readLine();
                              ^
./JAPI_Thread.java:3330: warning: [deprecation] readLine() in java.io.DataInputStream has been deprecated
                    String icon = in.readLine();
                                    ^
./JAPI_Thread.java:3351: warning: [deprecation] readLine() in java.io.DataInputStream has been deprecated
                    title = in.readLine();
                              ^
./JAPI_Thread.java:3394: warning: [deprecation] readLine() in java.io.DataInputStream has been deprecated
                    title = in.readLine();
                              ^
./JAPI_Thread.java:3524: warning: [deprecation] readLine() in java.io.DataInputStream has been deprecated
                      title = in.readLine();
                                ^
./JAPI_Thread.java:3551: warning: [deprecation] readLine() in java.io.DataInputStream has been deprecated
                      title = in.readLine();
                                ^
./JAPI_Thread.java:3572: warning: [deprecation] readLine() in java.io.DataInputStream has been deprecated
                      title = in.readLine();
                                ^
./JAPI_Thread.java:3592: warning: [deprecation] readLine() in java.io.DataInputStream has been deprecated
                      title = in.readLine();
                                ^
./JAPI_Thread.java:3614: warning: [deprecation] readLine() in java.io.DataInputStream has been deprecated
                      title = in.readLine();
                                ^
./JAPI_Thread.java:3650: warning: [deprecation] readLine() in java.io.DataInputStream has been deprecated
                       String Appath = in.readLine();
                                         ^
./JAPI_Thread.java:3651: warning: [deprecation] readLine() in java.io.DataInputStream has been deprecated
                     title = in.readLine();
                               ^
./JAPI_Thread.java:3652: warning: [deprecation] readLine() in java.io.DataInputStream has been deprecated
                    String dir = in.readLine();
                                   ^
./JAPI_Thread.java:3671: warning: [deprecation] show() in java.awt.Dialog has been deprecated
                          f.show();
                           ^
./JAPI_Thread.java:3715: warning: [deprecation] readLine() in java.io.DataInputStream has been deprecated
                     title = in.readLine();
                               ^
./JAPI_Thread.java:3743: warning: [deprecation] readLine() in java.io.DataInputStream has been deprecated
                     title = in.readLine();
                               ^
./JAPI_Thread.java:3744: warning: [deprecation] readLine() in java.io.DataInputStream has been deprecated
                     String but1 = in.readLine();
                                     ^
./JAPI_Thread.java:3769: warning: [deprecation] readLine() in java.io.DataInputStream has been deprecated
                     title = in.readLine();
                               ^
./JAPI_Thread.java:3770: warning: [deprecation] readLine() in java.io.DataInputStream has been deprecated
                     String but1 = in.readLine();
                                     ^
./JAPI_Thread.java:3771: warning: [deprecation] readLine() in java.io.DataInputStream has been deprecated
                     String but2 = in.readLine();
                                     ^
./JAPI_Thread.java:3796: warning: [deprecation] readLine() in java.io.DataInputStream has been deprecated
                     title = in.readLine();
                               ^
./JAPI_Thread.java:3797: warning: [deprecation] readLine() in java.io.DataInputStream has been deprecated
                     String but1 = in.readLine();
                                     ^
./JAPI_Thread.java:3798: warning: [deprecation] readLine() in java.io.DataInputStream has been deprecated
                     String but2 = in.readLine();
                                     ^
./JAPI_Thread.java:3799: warning: [deprecation] readLine() in java.io.DataInputStream has been deprecated
                     String but3 = in.readLine();
                                     ^
./JAPI_Thread.java:3920: warning: [deprecation] readLine() in java.io.DataInputStream has been deprecated
                    title = in.readLine();
                              ^
./JAPI_Debugwindow.java:26: warning: [deprecation] show() in java.awt.Window has been deprecated
this.show();
   ^
./JAPI_Debugwindow.java:28: warning: [deprecation] hide() in java.awt.Window has been deprecated
this.hide();
   ^
./JAPI_Debugwindow.java:34: warning: [deprecation] appendText(java.lang.String) in java.awt.TextArea has been deprecated
text.appendText(zeilen+": "+s+"\n");
   ^
./JAPI_MultiLineLabel.java:107: warning: [deprecation] preferredSize() in java.awt.Component has been deprecated
    public Dimension preferredSize() {
                     ^
./JAPI_MultiLineLabel.java:114: warning: [deprecation] minimumSize() in java.awt.Component has been deprecated
    public Dimension minimumSize() {
                     ^
./JAPI_MultiLineLabel.java:124: warning: [deprecation] size() in java.awt.Component has been deprecated
        Dimension d = this.size();
                          ^
./JAPI_VFlowlayout.java:103: warning: [deprecation] countComponents() in java.awt.Container has been deprecated
int nmembers = target.countComponents();
                    ^
./JAPI_VFlowlayout.java:110: warning: [deprecation] preferredSize() in java.awt.Component has been deprecated
Dimension d = m.preferredSize();
              ^
./JAPI_VFlowlayout.java:126: warning: [deprecation] countComponents() in java.awt.Container has been deprecated
int nmembers = target.countComponents();
                    ^
./JAPI_VFlowlayout.java:133: warning: [deprecation] minimumSize() in java.awt.Component has been deprecated
Dimension d = m.minimumSize();
              ^
./JAPI_VFlowlayout.java:150: warning: [deprecation] size() in java.awt.Component has been deprecated
int maxheight = target.size().height - (insets.top  + insets.bottom);
                     ^
./JAPI_VFlowlayout.java:151: warning: [deprecation] size() in java.awt.Component has been deprecated
int maxwidth  = target.size().width  - (insets.left + insets.right);
                     ^
./JAPI_VFlowlayout.java:152: warning: [deprecation] countComponents() in java.awt.Container has been deprecated
int nmembers  = target.countComponents();
                     ^
./JAPI_VFlowlayout.java:166: warning: [deprecation] preferredSize() in java.awt.Component has been deprecated
Dimension d = m.preferredSize();
              ^
./JAPI_VFlowlayout.java:185: warning: [deprecation] preferredSize() in java.awt.Component has been deprecated
Dimension d = m.preferredSize();
              ^
./JAPI_VFlowlayout.java:210: warning: [deprecation] preferredSize() in java.awt.Component has been deprecated
Dimension d = m.preferredSize();
              ^
./JAPI_VFlowlayout.java:249: warning: [deprecation] preferredSize() in java.awt.Component has been deprecated
Dimension d = m.preferredSize();
              ^
./JAPI_Ruler.java:33: warning: [deprecation] preferredSize() in java.awt.Component has been deprecated
public Dimension preferredSize()
                ^
./JAPI_Ruler.java:35: warning: [deprecation] preferredSize() in java.awt.Component has been deprecated
Dimension dim = super.preferredSize();
                    ^
./JAPI_Ruler.java:41: warning: [deprecation] minimumSize() in java.awt.Component has been deprecated
public Dimension minimumSize()
                ^
./JAPI_Ruler.java:43: warning: [deprecation] minimumSize() in java.awt.Component has been deprecated
Dimension dim = super.minimumSize();
                    ^
./JAPI_Canvas.java:58: warning: [deprecation] size() in java.awt.Component has been deprecated
Dimension d = super.size();
                  ^
./JAPI_Canvas.java:125: warning: [deprecation] size() in java.awt.Component has been deprecated
Dimension d = super.size();
                  ^
./JAPI_Canvas.java:210: warning: [deprecation] preferredSize() in java.awt.Component has been deprecated
public Dimension preferredSize()
                ^
./JAPI_Canvas.java:212: warning: [deprecation] preferredSize() in java.awt.Component has been deprecated
Dimension dim = super.preferredSize();
                    ^
./JAPI_Canvas.java:218: warning: [deprecation] minimumSize() in java.awt.Component has been deprecated
public Dimension minimumSize()
                ^
./JAPI_Canvas.java:220: warning: [deprecation] minimumSize() in java.awt.Component has been deprecated
Dimension dim = super.minimumSize();
                    ^
./JAPI_Frame.java:29: warning: [deprecation] disable() in java.awt.Component has been deprecated
public void disable()
           ^
./JAPI_Frame.java:33: warning: [deprecation] disable() in java.awt.Component has been deprecated
getComponent(i).disable();
              ^
./JAPI_Frame.java:38: warning: [deprecation] enable() in java.awt.Component has been deprecated
public void enable()
           ^
./JAPI_Frame.java:42: warning: [deprecation] enable() in java.awt.Component has been deprecated
getComponent(i).enable();
              ^
./JAPI_Frame.java:74: warning: [deprecation] getPeer() in java.awt.Component has been deprecated
if(getComponent(i).getPeer() != null)
                 ^
./JAPI_Dialog.java:27: warning: [deprecation] disable() in java.awt.Component has been deprecated
public void disable()
           ^
./JAPI_Dialog.java:30: warning: [deprecation] disable() in java.awt.Component has been deprecated
getComponent(i).disable();
              ^
./JAPI_Dialog.java:33: warning: [deprecation] enable() in java.awt.Component has been deprecated
public void enable()
           ^
./JAPI_Dialog.java:36: warning: [deprecation] enable() in java.awt.Component has been deprecated
getComponent(i).enable();
              ^
./JAPI_Dialog.java:56: warning: [deprecation] getPeer() in java.awt.Component has been deprecated
if(getComponent(i).getPeer() != null)
                 ^
./JAPI_Window.java:14: warning: [deprecation] disable() in java.awt.Component has been deprecated
public void disable()
           ^
./JAPI_Window.java:18: warning: [deprecation] disable() in java.awt.Component has been deprecated
getComponent(i).disable();
              ^
./JAPI_Window.java:21: warning: [deprecation] enable() in java.awt.Component has been deprecated
public void enable()
           ^
./JAPI_Window.java:25: warning: [deprecation] enable() in java.awt.Component has been deprecated
getComponent(i).enable();
              ^
./JAPI_Window.java:46: warning: [deprecation] getPeer() in java.awt.Component has been deprecated
if(getComponent(i).getPeer() != null)
                 ^
./JAPI_Panel.java:17: warning: [deprecation] disable() in java.awt.Component has been deprecated
public void disable()
           ^
./JAPI_Panel.java:21: warning: [deprecation] disable() in java.awt.Component has been deprecated
getComponent(i).disable();
              ^
./JAPI_Panel.java:24: warning: [deprecation] enable() in java.awt.Component has been deprecated
public void enable()
           ^
./JAPI_Panel.java:28: warning: [deprecation] enable() in java.awt.Component has been deprecated
getComponent(i).enable();
              ^
./JAPI_Panel.java:49: warning: [deprecation] getPeer() in java.awt.Component has been deprecated
if(getComponent(i).getPeer() != null)
                 ^
./JAPI_Panel.java:55: warning: [deprecation] size() in java.awt.Component has been deprecated
        Dimension d = size();
                      ^
./JAPI_List.java:38: warning: [deprecation] preferredSize() in java.awt.List has been deprecated
public Dimension preferredSize()
                ^
Note: Some input files additionally use or override a deprecated API.
100 warnings

I created the image from the JAPI.jar then I recompiled the ScriptBasic JAPI extension module. Everything seem to compile fine. This is what I get when I try to run any of the examples.  ???

Code: [Select]
jrs@laptop:~/sb/sb22/jtest$ scriba graphic.bas
Uncaught error fetching image:
java.lang.NullPointerException
at sun.awt.image.URLImageSource.getConnection(URLImageSource.java:115)
at sun.awt.image.URLImageSource.getDecoder(URLImageSource.java:125)
at sun.awt.image.InputStreamImageSource.doFetch(InputStreamImageSource.java:258)
at sun.awt.image.ImageFetcher.fetchloop(ImageFetcher.java:189)
at sun.awt.image.ImageFetcher.run(ImageFetcher.java:153)
« Last Edit: May 20, 2013, 11:49:31 PM by support »

Support

  • Administrator
  • *****
  • Posts: 22
    • View Profile
Re: JAPI - ScriptBasic Java GUI extension module
« Reply #4 on: May 21, 2013, 01:46:51 AM »
Thanks to Google and a post that gave me the clue that the problem might be where the JAR file thinks the two embedded .gif files should be located. Turns out my hunch was correct and I'm not getting the unhandled exception error with image load any longer. The Java runtime seems to load instantly like the Windows version was doing. I still need to deal with the Java deprecated function warnings (building JAR) but at least the Java interface is a decade newer.  ;)

I have attached the latest Ubuntu 12.04 LTS 64 bit version of JAPI. This zip includes the extension module japi.so, the japi.bas include and all the example SB scripts. (with required images)

Linux 64 JAPI Attached  (updated zip 5/21/2013 4pm pst)
« Last Edit: May 21, 2013, 04:18:47 PM by support »

Support

  • Administrator
  • *****
  • Posts: 22
    • View Profile
Re: JAPI - ScriptBasic Java GUI extension module
« Reply #5 on: May 21, 2013, 11:51:28 AM »
I rebuilt the JAPI.jar for Windows using JDK 1.7 and then rebuilt the ScriptBasic japi.dll extension module. Another benefit of this update is that Java is using Windows theming to some degree with AWT which I've only seen with Java Swing. This ended up taking some time so I hope you appreciate the effort. The zip includes everything you need (+ examples and required images) to run JAPI with ScriptBasic on Windows.

Windows 32 JAPI Attached  (updated 5/21/2013 5pm pst)
« Last Edit: May 21, 2013, 05:05:37 PM by support »

Support

  • Administrator
  • *****
  • Posts: 22
    • View Profile
Re: JAPI - ScriptBasic Java GUI extension module
« Reply #6 on: May 22, 2013, 11:08:39 AM »
Good News!

I was able to compile the Swing version of JAPI for Linux which is a big improvement on the visual front. Not all the examples work but most seem to be compatible with the AWT original JAPI.jar. I need to do more testing before trying this on Windows.



















« Last Edit: May 22, 2013, 06:10:18 PM by support »

Support

  • Administrator
  • *****
  • Posts: 22
    • View Profile
Re: JAPI - ScriptBasic Java GUI extension module
« Reply #7 on: May 23, 2013, 12:08:30 AM »
I attached a zip of the ScriptBasic JAPI Swing beta for Linux 64 I'm working on. (and the examples I tested) Scripts with a prefixed single underscore run but are lacking in some way. Scripts with a prefixed of two underscores cause Java runtime errors. All other scripts seem to work. I install Oracle JRE/JDK replacing OpenJDK/IceTea. I seem to be missing the meter/led components as the program just hangs. Please let me know if the JAPI swing version meter and led demos work for you.

Code: [Select]
alert.sb
borderlayout.sb
button.sb
canvas.sb
_choice.sb
__colorpicker.sb
componentlistener.sb
cursor.sb
__dialogmodal.sb
__dialog.sb
digits.sb_hang
__drawables.sb
filedialog.sb
__flowlayout.sb
flowsimple.sb
_focuslistener.sb
__font.sb
frame.sb
graphicbutton.sb
graphiclabel.sb
_graphic.sb
__gridlayout.sb
__image.sb
_insets.sb
keylistener.sb
__label.sb
lines.sb
_listmultiple.sb
_list.sb
mandel1.sb
__mandel2.sb
mandel.sb
__menu.sb
mousebuttons.sb
mouselistener.sb
__panel.sb
__popupmenu.sb
print.sb
radiobutton.sb
_rubberband.sb
_scaledimage.sb
scrollbar.sb
scrollpane.sb
__simple.sb
_text.sb
video.sb
_viewer.sb
vumeter.sb_hang
_windowlistener.sb
window.sb
« Last Edit: May 23, 2013, 12:12:46 AM by support »

Support

  • Administrator
  • *****
  • Posts: 22
    • View Profile
Re: JAPI - ScriptBasic Java GUI extension module
« Reply #8 on: May 23, 2013, 10:22:04 AM »
I rebuilt the JAPI.jar file using swing and created a new japi.dll to put in your SB modules directory. So far all the example programs I tried work great and with a better UI. Let me know how it works for you.

I'm really happy with this version of the JAPI extension module for Windows 32. This is a must have upgrade if you plan on playing with this.

My JAPI issues on Linux may be 64 bit related or the 1.7 JDK under Linux dropped support for legacy AWT deprecated functionality. I have 100 warnings in the Java JAPI.jar build that need to be addressed before moving forward with any enhancements to the library.

The goal is to be able to create UI interfaces like these from the ScriptBasic JAPI extension module. We have a good start in that direction.

I feel comfortable enough with this JAPI Windows release that I'm going to put together a JAPI 2.0 release candidate together with the fixed SB scripts.





If you prefer the traditional Windows XP theme ...





You have to see this live to appreciate it. (animation is GREAT!)



Updated japi.dll (swing enabled extension module) attached
« Last Edit: May 23, 2013, 01:06:22 PM by support »

Support

  • Administrator
  • *****
  • Posts: 22
    • View Profile
Re: JAPI - ScriptBasic Java GUI extension module
« Reply #9 on: May 23, 2013, 09:55:40 PM »
This verifies that the issues I'm having with JAPI 2.0 on Ubuntu 64 are deprecated function related. Nice to see the consistency in UI presentation across platforms.





« Last Edit: May 23, 2013, 10:18:19 PM by support »

Support

  • Administrator
  • *****
  • Posts: 22
    • View Profile
Re: JAPI - ScriptBasic Java GUI extension module
« Reply #10 on: May 24, 2013, 10:38:00 PM »



I ran across a nice Java Look & Feel browser for the swing UI.



It would be nice if this utility would allow setting values rather than just viewing them.