GLJPanelViewer does not get key events

Found a bug? Post here.
Post Reply
sechel
Posts: 69
Joined: Tue 2. Oct 2007, 09:20

GLJPanelViewer does not get key events

Post by sechel » Tue 10. Aug 2010, 19:31

If I use the JRViewer -vr
with
-Dde.jreality.scene.Viewer=de.jreality.jogl.GLJPanelViewer
the key events seem to get lost. This might be an input focus issue. Even when I click into the viewer panel there are no key events.

sechel

User avatar
steffen
Posts: 186
Joined: Fri 16. Jun 2006, 13:30
Location: TU Berlin
Contact:

Re: GLJPanelViewer does not get key events

Post by steffen » Wed 11. Aug 2010, 05:46

in de.jreality.jogl.Viewer there is some tweaking with the awt events (they are propagated to a JPanel as far as I remember) - probably your problem is related to that. I think it is inside the getComponent-method - at least you should find out from there what happens...

Steffen.

sechel
Posts: 69
Joined: Tue 2. Oct 2007, 09:20

Re: GLJPanelViewer does not get key events

Post by sechel » Wed 11. Aug 2010, 15:53

The problem seems to be solved if I change the MouseListener in the AbstractViewer to be

Code: Select all

MouseListener mouseListener = new MouseListener() {
        public void mouseClicked(MouseEvent e) {
          component.dispatchEvent(e);
        }
        public void mouseEntered(MouseEvent e) {
          component.dispatchEvent(e);
        }
        public void mouseExited(MouseEvent e) {
          component.dispatchEvent(e);
        }
        public void mousePressed(MouseEvent e) {
          component.dispatchEvent(e);
->          ((Component)drawable).requestFocus();
        }
        public void mouseReleased(MouseEvent e) {
          component.dispatchEvent(e);
        }
      };
as suggested here:
http://www.java-forum.org/awt-swing-swt ... swing.html

sechel

Post Reply