Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

JAPI examples 1

Status
Not open for further replies.

ArmenD

Programmer
Feb 3, 2005
101
US
I was wondering if anyone is aware of any JAPI examples other than those found on I find JAPI a great resource but I would like to see some larger examples of GUI's created.
 
if we would like to call a function of type void, how is that expressed in JAPI?

 
Functions of type void are subroutines so just use a call statement. eg
Code:
call j_gettext (obj, str)
Normally what I do is to declare an array of integers with its indices set to the object names and then use that for looking up the objects. It takes longer computationally but it looks a lot neater. I don't quite like the multiple if-then-elses comparing objects. Something like
Code:
! would have been easier if Fortran had consective enums
integer::msOpen, msClose, msQuit, msMax
parameter (msOpen = 1, msClose=2, msQuit = 3, msMax = 4)
integer::mObj(msMax)
...
mObj(msOpen) = j_button (jFrame, 'Open')
...
do
   jObj = j_nextaction ()
   do i = 1, msMax - 1, 1
      if (mObj(i) .eq. jObj) goto 10
   enddo
10 continue
   select case (i)
      case (msOpen)
         ...
      case (msClose)
         ...
      case (msQuit)
         call j_quit ()
         goto 99
      end select
   enddo
99 continue
   stop
 
great.
what is the escape character in JAPI?
I want to output "D" but not sure what escape character to use?
 
fileinput= j_label(frame1,"Enter data input file name or D for direct input: ")

the string in the line above seems too long, how can i split up a string over two lines and concat them together?

how is string concatenation at end of one line done with the beginning of another?
 
i don't understand why the following code doesn't output anything to console

Code:
character inhalt*256
 txt_task   = j_textfield(frame1,20)
...
   call j_gettext(txt_task,inhalt)
   write(*,*) inhalt

I even tried
Code:
character inhalt*256
txt_task   = j_textfield(frame1,20)
10      obj=j_nextaction()
            if(obj .eq. txt_task) then
             call j_gettext(txt_task,inhalt)
             write(*,*) inhalt
            endif
        goto 10
 
why does \ character give errors in g77? anyone know how to get rid of the error below?

Unknown escape sequence `\)' at (^)
MAIN1.F:42:
WRITE(*,'(A\)')' "F", for input from a file-> '
 
In reverse order:
why does \ character give errors in g77? anyone know how to get rid of the error below?
\ is not valid in formats: use / for a newline.

i don't understand why the following code doesn't output anything to console
Does frame1 exist? You need a j_start followed by j_frame. You also need a j_show(frame1) before querying j_nextaction. Without j_show, nothing appears.

the string in the line above seems too long, how can i split up a string over two lines and concat them together?
This is the same as java: try \n for a newline
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top