<commit_before>package vtk;
import javax.swing.Timer;
import java.awt.*;
import java.awt.event.*;

public class vtkCanvas extends vtkPanel implements MouseListener, MouseMotionListener, KeyListener
{
  protected vtkGenericRenderWindowInteractor iren = new vtkGenericRenderWindowInteractor();
  protected Timer timer = new Timer(10, new DelayAction());
  protected int ctrlPressed = 0;
  protected int shiftPressed = 0;
  protected vtkPlaneWidget pw = new vtkPlaneWidget();
  protected vtkBoxWidget bw = new vtkBoxWidget();

  public vtkGenericRenderWindowInteractor GetRenderWindowInteractor () { return iren; }
  
  static { 
    // load up hybrid for 3d widgets
    System.loadLibrary("vtkHybridJava"); 
  }

  public vtkCanvas()
  {
    super();
//     super.setSize(500,500);
//     rw.SetSize(500,500);
    iren.SetRenderWindow(rw);
    iren.AddObserver("CreateTimerEvent", this, "StartTimer");
    iren.AddObserver("DestroyTimerEvent", this, "DestroyTimer");
    iren.SetSize(200, 200);
    iren.ConfigureEvent();
    pw.AddObserver("EnableEvent", this, "BeginPlaneInteraction");
    bw.AddObserver("EnableEvent", this, "BeginBoxInteraction");
    pw.SetKeyPressActivationValue('l');
    bw.SetKeyPressActivationValue('b');
    pw.SetInteractor(iren);
    bw.SetInteractor(iren);

    addComponentListener(new ComponentAdapter()
      {
        public void componentResized(ComponentEvent event)
        {
          // The Canvas is being resized, get the new size
          int width = getWidth();
          int height = getHeight();
          setSize(width, height);
        }
      });

    ren.SetBackground(0.0, 0.0, 0.0);
  }

  public void StartTimer() {
    if (timer.isRunning())
      timer.stop();
    
    timer.setRepeats(false);<commit_msg>ERR don't pass out renderWindowInteractor - too dangerous and causes problems with mutex locking.  should subclass vtkCanvas instead - see ImagePlaneWidget.java<commit_after>package vtk;
import javax.swing.Timer;
import java.awt.*;
import java.awt.event.*;

public class vtkCanvas extends vtkPanel implements MouseListener, MouseMotionListener, KeyListener
{
  protected vtkGenericRenderWindowInteractor iren = new vtkGenericRenderWindowInteractor();
  protected Timer timer = new Timer(10, new DelayAction());
  protected int ctrlPressed = 0;
  protected int shiftPressed = 0;
  protected vtkPlaneWidget pw = new vtkPlaneWidget();
  protected vtkBoxWidget bw = new vtkBoxWidget();
  
  static { 
    // load up hybrid for 3d widgets
    System.loadLibrary("vtkHybridJava"); 
  }

  public vtkCanvas()
  {
    super();
    iren.SetRenderWindow(rw);
    iren.AddObserver("CreateTimerEvent", this, "StartTimer");
    iren.AddObserver("DestroyTimerEvent", this, "DestroyTimer");
    iren.SetSize(200, 200);
    iren.ConfigureEvent();
    pw.AddObserver("EnableEvent", this, "BeginPlaneInteraction");
    bw.AddObserver("EnableEvent", this, "BeginBoxInteraction");
    pw.SetKeyPressActivationValue('l');
    bw.SetKeyPressActivationValue('b');
    pw.SetInteractor(iren);
    bw.SetInteractor(iren);

    addComponentListener(new ComponentAdapter()
      {
        public void componentResized(ComponentEvent event)
        {
          // The Canvas is being resized, get the new size
          int width = getWidth();
          int height = getHeight();
          setSize(width, height);
        }
      });

    ren.SetBackground(0.0, 0.0, 0.0);
  }

  public void StartTimer() {
    if (timer.isRunning())
      timer.stop();
    
    timer.setRepeats(false);
{'fraction_non_alphanumeric': 0.11082693947144075, 'fraction_numerical': 0.013071895424836602, 'mean_word_length': 3.6254927726675428, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3807906', 'n_tokens_mistral': 1111, 'n_tokens_neox': 1042, 'n_words': 246}