hmm.... no idea... would be interesting what "itterate" does. how do you
feed the input data to the system, that is: how do you "play back" key
events? perhaps it has something to do with it.

btw, you should use a BufferedInputStream, will speed things up factor 100.

-- julian

-----Original Message-----
From: Discussion list for Java 3D API
[mailto:[EMAIL PROTECTED]]On Behalf Of Casteel, Don
Sent: Friday, March 03, 2000 8:31 PM
To: [EMAIL PROTECTED]
Subject: [JAVA3D] Bug? InputStream kills KeyListener


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".

Reply via email to