The Keyboard input is logged as integers (0,1, or 2... for forward, right, or
left) into an int[] array during construction, not to the file. The file is only
written when a save command is called, and the save command closes the output
stream. Everything continues to function after a save, it only locks up the
keyListener after the openFile() method.
The openFile() method plays back keystrokes by reading the integers one at a time
and sending them on to the construction method the same way the keyListener does.
The funny thing is that the openFile() method works great and plays back the log
correctly, it even completes without any exceptions.
The iterate() method simply takes a single int argument and processes it to create
geometry.
Still perplexed... : )
Gary L. Graf wrote:
> 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".