Exception during taking screenshot

Hi all,

I've imported my ".obj" (the same problem with a ".jme" file) file in canvas.

When i call the screenshot with

It's because your action is being handled in a separate thread.  Taking a screenshot needs to be done in the OpenGL thread.  You can do this by Using Callable and the GameTaskQueueManager.  Here's a sample helper class i wrote that you might use in place of ActionListener for things like this:

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.concurrent.Callable;
import java.util.logging.Level;

import java.util.logging.Logger;
import com.jme.util.GameTaskQueue;
import com.jme.util.GameTaskQueueManager;

public abstract class ErrorCatchingGLActionListener implements ActionListener {
    private static final Logger logger = Logger

    public final void actionPerformed(final ActionEvent e) {
        Callable<?> exe = new Callable() {
            public Object call() {
                try {
                } catch (Exception ex) {
                            "Swing Action Error Caught!", ex);
                return null;

     * Do the actual action.
     * @param e
     *            the event param from actionPerformed.
    public abstract void doGLAction(ActionEvent e);


You can use it like this:

myButton.addActionListener(new ErrorCatchingGLActionListener() {
    public void doGLAction(ActionEvent arg0) {
        // do some thing in here that you expect to require the gl thread.

You can do similar things extending DocumentListener,ChangleListener, MouseListener, etc.


Tks… it's work fine!!!  :smiley: