Re: A plug-in for creating a 3D video

by Puybaret » Wed Mar 10, 2010 7:44 am

a) If you want to change the location of the message dialog box, use the following statements:

Code: Select all

JOptionPane optionPane = new JOptionPane("Message");
JDialog dialog = optionPane.createDialog(JOptionPane.getRootFrame(), "Titre");
// Change location
dialog.setLocation(10, 10);
dialog.setVisible(true);    
dialog.dispose();
b) You're right, displaying a message to wait for the end of each move in the 3D view is probably not the best solution. [;)]
Miserably, the solution is not straightforward. The best solution would be to wait for an event that tells you that a move of the camera is finished in the 3D view, but this would oblige you to create and display a 3D view that would use the canvas3DPostRendered method I added for Canvas3D instances (see line 244 in HomeComponent for a real example).
If you capture images with Robot class (as I suppose you do), a simpler solution might be to include your calls to createScreenCapture in EventQueue invokeLater or invokeAndWait calls (the choice depends on the thread in which you run your video program).

Code: Select all

final Robot robot = new Robot();
EventQueue.invokeLater(new Runnable() {
    public void run() {
      robot.createScreenCapture(...);
    } 
  });
c) I don't see any error in your code. [:(]
It looks almost the same as the one I used in VideoPanel.PhotoImageGenerator class. What exceptions do you get? Do you use multithreading?