Page 1 of 1
GLJPanelViewer does not get key events
Posted: Tue 10. Aug 2010, 19:31
by sechel
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
Re: GLJPanelViewer does not get key events
Posted: Wed 11. Aug 2010, 05:46
by steffen
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.
Re: GLJPanelViewer does not get key events
Posted: Wed 11. Aug 2010, 15:53
by sechel
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