@Override
  protected void buttonClicked(JButton button)
  {
    if (button == cancel)
    {
      ResizeModelFrame.this.setVisible(false);
      buttons[1][1].button.setSelected(true);
    }
    else if (button == execute)
    {
      int nw = 0, nh = 0;
      
      try
      {
        nw = Integer.parseInt(width.getText());
        nh = Integer.parseInt(height.getText());
      }
      catch (NumberFormatException ee)
      {
        Dialogs.showErrorDialog(ResizeModelFrame.this, "Error", "Please insert a valid number!");
        return;
      }
      
      VerAttach va = VerAttach.NONE;
      HorAttach ha = HorAttach.NONE;
      
      for (int y = 0; y < 3; ++y)
        for (int x = 0; x < 3; ++x)
          if (buttons[y][x].button.isSelected())
          {
            va = buttons[y][x].ver;
            ha = buttons[y][x].hor;
          }
      
      if (new ModelOperations.Resize(model, bounds, nw, nh, va, ha, keepCentered.isSelected()).execute())
        Dialogs.showErrorDialog(ResizeModelFrame.this, "Error", "Final size must be at least equal to model bounds!");
      else
      {
        Main.sketch.redraw();
        ResizeModelFrame.this.setVisible(false);
      }
    }
  }