예제 #1
0
  public FlowQuad(String title) {
    super(title);
    JPanel contentPanel = new JPanel(new BorderLayout());

    VectorField field = new VectorField();

    // The interaction control panel is a separate window
    contentPanel.add(field, BorderLayout.CENTER);
    GUIPanel control = new GUIPanel(field);
    control.setLocation(700, 0);
    control.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    this.add(contentPanel);

    // The initial window size is good for a square vector field with sides
    // that are a power of 2, plus some extra in x and y (8 and 30) that
    // appear to be about right for window pieces outside the draw area.
    this.setSize(new Dimension(768 + 8, 768 + 30));
    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    //  make both windows visible
    this.setVisible(true);
    control.setVisible(true);
  }