| 49 | } |
| 50 | |
| 51 | protected void Initialize() { |
| 52 | iren.SetRenderWindow(rw); |
| 53 | iren.TimerEventResetsTimerOff(); |
| 54 | iren.AddObserver("CreateTimerEvent", this, "StartTimer"); |
| 55 | iren.AddObserver("DestroyTimerEvent", this, "DestroyTimer"); |
| 56 | iren.SetSize(200, 200); |
| 57 | iren.ConfigureEvent(); |
| 58 | pw.AddObserver("EnableEvent", this, "BeginPlaneInteraction"); |
| 59 | bw.AddObserver("EnableEvent", this, "BeginBoxInteraction"); |
| 60 | pw.SetKeyPressActivationValue('l'); |
| 61 | bw.SetKeyPressActivationValue('b'); |
| 62 | pw.SetInteractor(iren); |
| 63 | bw.SetInteractor(iren); |
| 64 | |
| 65 | addComponentListener(new ComponentAdapter() { |
| 66 | public void componentResized(ComponentEvent event) { |
| 67 | // The Canvas is being resized, get the new size |
| 68 | int width = getWidth(); |
| 69 | int height = getHeight(); |
| 70 | setSize(width, height); |
| 71 | } |
| 72 | }); |
| 73 | |
| 74 | ren.SetBackground(0.0, 0.0, 0.0); |
| 75 | |
| 76 | // Setup same interactor style than vtkPanel |
| 77 | vtkInteractorStyleTrackballCamera style = new vtkInteractorStyleTrackballCamera(); |
| 78 | iren.SetInteractorStyle(style); |
| 79 | } |
| 80 | |
| 81 | public void StartTimer() { |
| 82 | if (timer.isRunning()) |