AwtPanel debug info

Hello,
I’ve just switched from JmeCanvasContext to AwtPanelsContext, but i immediately noticed, that the debug info ( fps and staview) has disapperad and I can’t fugure out how to enable it again.
Test case :
Debug info normally shows when extending from SimpleAplication.
[java]package tests.awt;

import com.jme3.app.SimpleApplication;
import com.jme3.system.AppSettings;
import com.jme3.system.awt.AwtPanel;
import com.jme3.system.awt.AwtPanelsContext;
import com.jme3.system.awt.PaintMode;

import javax.swing.;
import java.awt.
;

public class TestAwt {

private AwtPanel panel;

class App extends SimpleApplication {
    @Override
    public void simpleInitApp() {
        panel.attachTo(false, viewPort);
        guiViewPort.setClearFlags(true, true, true);
        setDisplayStatView(true);
        setDisplayFps(true);
    }
}

void run() {
    final App app = new App();
    app.setShowSettings(false);
    AppSettings settings = new AppSettings(true);
    settings.setCustomRenderer(AwtPanelsContext.class);
    settings.setFrameRate(60);
    app.setSettings(settings);
    app.start();

    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            final AwtPanelsContext ctx = (AwtPanelsContext) app.getContext();
            panel = ctx.createPanel(PaintMode.Accelerated);
            panel.setPreferredSize(new Dimension(400, 300));
            ctx.setInputSource(panel);


        }
    });

    JFrame frame = new JFrame("Render Display " );
    frame.getContentPane().setLayout(new BorderLayout());
    frame.getContentPane().add(panel, BorderLayout.CENTER);
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

    frame.pack();
    frame.setVisible(true);
}

public static void main(String... args) {
    new TestAwt().run();
}

}
[/java]

Thanks for any help :slight_smile:

Well I had to solve this myself.

The only reason to use AwtPanel was that I was unable to type text into textfields, and textareas.
Found this topic: http://hub.jmonkeyengine.org/forum/topic/swing-canvas-and-events/ , so decided to use awtpanel.

First of all, stats disappeared and what was evene worse the FPS dropped from ~750 to about 70, so 90% decrease, which is totally unaceptable. So bye-bye awt panel and tracking of the focus issue has began.

I 've been using JME for quite a while, and remember using JmeCanvasContext with no problem some time ago.
So digging in svn for changes in core classes didn’t help, using old nightly builds didn’t help either.
Tracing the problem all the way down lead me to lwjgl natives.
Using the old natives still didn’t work in the new project.

However the old project seemed to run the test case with no problem. The only difference was java7 vs java6 jre.
Switching to java6 fixed the problem, but still wasn’t the kind of solution I was looking for.

Now armed with the knowledge that this is not an isssue jme is resposible for, I’ve eventually stumbled across this thread on the lwjgl board.
http://lwjgl.org/forum/index.php/topic,4217.15.html

Both the 32bit and the 64bit dlls linked there are fixed and perfectly resolve this problem with java7.

3 Likes

Nice detective work :slight_smile:

Does that mean that when we pick up the new LWJGL for the mac etc fixes then we should get this fix too?

+1 for digging out the answer yourself, we need more monkeys like you =)