Just to let those of you who tried to help me out with this one, I finely
found the problem, and boy do I feel dumb now : )

I thought I'd post my findings in hopes it may keep someone else from
spending hours fighting the same issue.

My keyListener object is attached to the Canvas3D.....
I was reading/writing files with FileDialog, FileInputStream &
FileOutputStream. And I was closing the streams after they were finished.

Now the embarrassing part...

What was happening was that the file streams were transferring focus to the
Frame object, and there was no returning of the focus to the Canvas3D object
which was the only object with a keyListener.

Simple.... basic Java.... lots of easy ways to correct it if you realize
that's what the problem is.

Anyway, thanks to those of you who offered suggestions, and hopefully by
sharing my embarrassment I'll save someone some frustrating de-bug time.

-----Original Message-----
From: Gary L. Graf [mailto:[EMAIL PROTECTED]]
Sent: Saturday, March 04, 2000 11:14 AM
To: [EMAIL PROTECTED]
Subject: Re: [JAVA3D] Bug? InputStream kills KeyListener


Hi,
  Don't know the rest of the code, but is sounds as if you never closed the
output stream from the keyboard to the file.  If the keyboard output is
intercepted to capture strokes, that may be all it is able to do and j3d
can't
access it.  A thought. - Gary

"Casteel, Don" wrote:

> Strange problem.....
>
> I've got an application that uses keyboard input to construct my geometry
> (long story)
> I'm logging the keystrokes and saving them to a file (using FileDialog),
> when I hit the "S" key....  This is working great so far.....
>
> I open the log file with a file InputStream(using FileDialog) and it plays
> back the keystrokes building the geometry just as it's suppose to. My
> openFile() method println's "complete" as it's last line just as it's
> suppose to.....
>
> Everything looks great, I get no exceptions, and my Canvas3D is still
> functional (MouseRotate etc...)
>
> But KeyListener no longer works after opening my file. I'm println'ing at
> the begining of my KeyPressed method
>
>         public void keyPressed(java.awt.event.KeyEvent e)
>                 {
>                 System.out.println(e);
>                 [....]
>
> That works fine before I open my file......
>
> After opening the file I get nothing from presing a key. Everything works
> just fine before opening a file, and I'm not getting any exceptions !!
>
> Here's my openFile() method, maybe someone will see something I'm
> missing...............
>
>         public void openConstructionFile()
>                 {
>                         System.out.println("openConstructionFile");
>                 fileDialog.setMode(fileDialog.LOAD);
>                 fileDialog.show();
>                 directory = fileDialog.getDirectory();
>                         fileString = fileDialog.getFile();
>                 file = new File(directory, fileString);
>                         System.out.println("file retrieved = " +
> file.getName());
>                 try
>                         {
>                         FileInputStream inputStream = new
> FileInputStream(file);
>                         System.out.println("File Input Stream
Initialized");
>                         boolean eof = false;
>
>                         while(!eof)
>                                 {
>                                 int thisCommand = inputStream.read();
>                                 if(thisCommand != -1)
>                                         {
>                                         itterate(thisCommand);
>                                         }
>                                 else
>                                         {
>                                         eof = true;
>                                         };
>                                 };
>                         inputStream.close();
>                         }
>                 catch (Exception e){System.out.println(e);};
>                     System.out.println("openConstructionFile COMPLETE");
>                 };
>
> Thanks in advance for any help!
> Don Casteel
>
> Manufacturing Engineer
> TEXTRON Automotive Company -- Athens Operations
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>         Voice:  (423)744-1109
>         Fax:    (423)744-1112
>         Pager:  (423)744-1129  -- 109
>                 Internet:       [EMAIL PROTECTED]
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>
===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff JAVA3D-INTEREST".  For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to