Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (107)
games submitted by our members
Games in WIP (536)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  [Resolved] Problem using GLCanvas with French keyboard  (Read 1405 times)
0 Members and 1 Guest are viewing this topic.
Offline kraft

Junior Newbie





« Posted 2006-09-07 01:20:19 »

Hi there !  Smiley

short story :
I experience some problems using GLCanvas with French keyboard when pressing keys like "é" or "à" : the "pressed" event do not happen.  Huh

full story :
In my example, I made a class called MyListener.
In the "public static void main", I build a frame with a glcanvas inside it.
I set MyListener as the keylistener of the frame and the canvas.
After that, when I press my "é", "è", "ç" or "à" key,
if the frame has the focus (at application start for example), then the pressed, types and released events happen,
but if the canvas has the focus (by clicking on it), then only the type and released events happen.  Sad

Here is the minimal code to reproduce my problem (maybe you will need a french keyboard...)

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
import java.awt.*;
import java.awt.event.*;
import javax.media.opengl.*;
import com.sun.opengl.util.*;

public class MyListener implements
        KeyListener, GLEventListener
{

    public static void main(String[] args)
    {
        Frame frame             = new Frame();
        GLCanvas canvas         = new GLCanvas();
        MyListener mylistener   = new MyListener();
        final Animator animator = new Animator(canvas);
       
        frame.add(canvas);
        frame.setSize(640, 480);        
        frame.addWindowListener(new WindowAdapter()
            {
                public void windowClosing(WindowEvent e)
                {
                    new Thread(new Runnable()
                        {
                            public void run()
                            {
                                animator.stop();
                                System.exit(0);
                            }
                        }
                    ).start();
                }
            }
        );
        frame.setVisible(true);
        frame.addKeyListener(mylistener);
       
        animator.setRunAsFastAsPossible(false);
        animator.start();
       
        canvas.addGLEventListener(mylistener);
        canvas.addKeyListener(mylistener);
    }
   
    // constructor
   public MyListener() {}
   
    // key listener functions
   public void keyReleased(KeyEvent e) { System.out.println(e.toString()); }  
    public void keyPressed(KeyEvent e) { System.out.println(e.toString()); }  
    public void keyTyped(KeyEvent e) { System.out.println(e.toString()); }

    public void init(GLAutoDrawable drawable)
    {
        GL gl = drawable.getGL();
        System.err.println("INIT GL IS: " + gl.getClass().getName());
    }
    public void reshape(GLAutoDrawable drawable, int x, int y, int _width, int _height)
    {
        GL gl = drawable.getGL();        
        System.err.println("GL_VENDOR: " + gl.glGetString(GL.GL_VENDOR));
        System.err.println("GL_RENDERER: " + gl.glGetString(GL.GL_RENDERER));
        System.err.println("GL_VERSION: " + gl.glGetString(GL.GL_VERSION));
    }    
    public void display(GLAutoDrawable drawable) {}
    public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) {}
}


Is this a bug from GLCanvas ? or maybe I made a mistake ...  Undecided


Offline Ken Russell

JGO Coder




Java games rock!


« Reply #1 - Posted 2006-09-07 03:46:47 »

Could you please try using a vanilla AWT Canvas and see whether it has the same problem?

What JDK version are you using? Have you tried the latest 5.0 update release and/or the JDK 6 weekly builds?
Offline kraft

Junior Newbie





« Reply #2 - Posted 2006-09-07 20:41:00 »

Thank you for your answer  Cheesy

First, I add this line to show the JRE version :
1  
System.err.println("Using java version " + System.getProperty("java.version"));  

And it prints (as expected):
1  
Using java version 1.5.0_07

I will give a try to 1.6.0 like you told me. Ihope I will be able to install it  Embarrassed

Second, i thougth that GLCanvas was the AWT Canvas with GL capabilities and GLJPanel the Swing equivalent.
So is there something I missed with the vanilla thing ? Is it an alternate AWT GLCanvas ?

Anyway I tried with GLJPanel and retried with GLCanvas but now :
* even if I do not click on the panel / canvas
* even if there is no panel/canvas at all in the frame,
there is no PRESSED event for "é", "à", etc...  Angry
This is so weird  Huh




Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline kraft

Junior Newbie





« Reply #3 - Posted 2006-09-07 21:06:09 »

I tried about 100 times to launch my original code and the minimal code with ether GLJPanel or GLCanvas.
Some time it gives me the Pressed event and sometimes not.
During those 100 tries,  I tought it works only if I do not move the mouse while launching.
But this is correct for 70% of times only. There must be another reason.
And why only with those french characters "é", "è", "ç" and "à" ?

Still investigating...  Undecided
Offline kraft

Junior Newbie





« Reply #4 - Posted 2006-09-07 22:59:41 »

After hours of investigation, i found this page:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4490692
It seems to be the same problem that I experience.

They fixed the bug in Mustang so I will give it a try.

Good news soon I hope...



Offline kraft

Junior Newbie





« Reply #5 - Posted 2006-09-08 23:39:46 »

Victory !
The problem is fixed in Mustang 1.6.0-beta2 !
Merci Sun  Grin
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

CogWheelz (15 views)
2014-07-30 21:08:39

Riven (21 views)
2014-07-29 18:09:19

Riven (14 views)
2014-07-29 18:08:52

Dwinin (12 views)
2014-07-29 10:59:34

E.R. Fleming (32 views)
2014-07-29 03:07:13

E.R. Fleming (12 views)
2014-07-29 03:06:25

pw (42 views)
2014-07-24 01:59:36

Riven (42 views)
2014-07-23 21:16:32

Riven (30 views)
2014-07-23 21:07:15

Riven (31 views)
2014-07-23 20:56:16
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!