This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 123733

Summary: JComponent->Scene resolver
Product: platform Reporter: David Kaspar <dkaspar>
Component: GraphAssignee: issues@platform <issues>
Status: NEW ---    
Severity: blocker    
Priority: P3    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:

Description David Kaspar 2007-12-10 09:54:51 UTC
SceneSupport.getScene(JComponent):Scene method should be added to obtain a scene instance from a JComponent that
represents a scene main or side view.

As a workaround, please, add following code into SceneSupport file in "widget" package manually:
public class SceneSupport {
  public static Scene getSceneForComponent (Component component) {
    if (component instanceof SceneComponent) {
      return ((SceneComponent) component).getScene ();
    return null;
  }
}
Also as a temporary workaround you may use java-reflection:
        JComponent view = ...;// scene.createView ();
        Field field = view.getClass ().getDeclaredField ("scene");
        field.setAccessible (true);
        System.out.println ("field.get (view) = " + field.get (view));