requestFocus() out of PSurface, key events firing in FX

This commit is contained in:
Ben Fry
2015-05-16 23:25:40 -04:00
parent f49970ef43
commit b9f7857f57
4 changed files with 11 additions and 10 deletions
+3 -3
View File
@@ -108,9 +108,9 @@ public interface PSurface {
public void setFrameRate(float fps);
// called on the first frame so that the now-visible drawing surface can
// receive key and mouse events
public void requestFocus();
// // called on the first frame so that the now-visible drawing surface can
// // receive key and mouse events
// public void requestFocus();
// // finish rendering to the screen (called by PApplet)
// public void blit();
+1 -1
View File
@@ -111,7 +111,7 @@ public class PSurfaceAWT extends PSurfaceNone {
* invokeLater() happens in here rather than requiring the caller to wrap it.
*/
@Override
public void requestFocus() {
void requestFocus() {
// for 2.0a6, moving this request to the EDT
EventQueue.invokeLater(new Runnable() {
public void run() {
+6 -5
View File
@@ -115,6 +115,7 @@ public class PSurfaceFX implements PSurface {
EventHandler<KeyEvent> keyHandler = new EventHandler<KeyEvent>() {
public void handle(KeyEvent e) {
System.out.println(e);
fxKeyEvent(e);
}
};
@@ -231,6 +232,7 @@ public class PSurfaceFX implements PSurface {
Platform.runLater(new Runnable() {
public void run() {
stage.show();
canvas.requestFocus();
}
});
}
@@ -408,11 +410,10 @@ public class PSurfaceFX implements PSurface {
}
@Override
public void requestFocus() {
// TODO Auto-generated method stub
}
// @Override
// public void requestFocus() {
// canvas.requestFocus();
// }
public void setCursor(int kind) {
+1 -1
View File
@@ -141,7 +141,7 @@ public class PSurfaceNone implements PSurface {
}
public void requestFocus() {
void requestFocus() {
// TODO Auto-generated method stub
}