Skip to content

Instantly share code, notes, and snippets.

@bluepapa32
Created January 7, 2010 12:30
Show Gist options
  • Save bluepapa32/271205 to your computer and use it in GitHub Desktop.
Save bluepapa32/271205 to your computer and use it in GitHub Desktop.
Node から JComponent 取得
import javafx.scene.Node;
import javafx.reflect.FXLocal;
// com.sun.javafx.tk.swing.SwingScene$SwingScenePanel
function getPanel(node: Node) {
var context = FXLocal.getContext();
// SGNode
var nodeClass = context.makeClassRef(node.getClass());
var impl_getPGNode = nodeClass.getFunction("impl_getPGNode");
var sgNode = impl_getPGNode.invoke(context.mirrorOf(node)) as FXLocal.ObjectValue;
// Panel
var panel = sgNode.getClassType().getFunction("getPanel").invoke(sgNode);
return (panel as FXLocal.ObjectValue).asObject();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment