Example #1
0
  public Mesh() {
    super("Mesh");
    this.setLayout(new GridLayout());
    this.setSize(1000, 1000);

    this.add((m = new MeshCanvas(this)));
    m.setSize(this.getSize());

    this.addWindowListener(
        new WindowAdapter() {
          @Override
          public void windowClosing(WindowEvent ev) {
            System.exit(0);
          }
        });

    new SetSpaceWindow(m).setVisible(true);
  }
Example #2
0
  public SetSpaceWindow(MeshCanvas obj) {
    super("Space between lines");
    this.setSize(250, 70);
    this.setLayout(new BorderLayout());

    t = new TextField();
    this.add(t, BorderLayout.NORTH);

    t.addActionListener(
        (ActionEvent e) -> {
          int i = 0;
          try {
            i = Integer.valueOf(t.getText());
          } catch (java.lang.NumberFormatException ex) {
            t.setText(null);
          }
          if (i > 0) obj.setSpace(i);
        });
  }