public ResizeModelFrame()
  {
    super(Main.mainFrame, "Resize Model", new String[] {"Cancel", "Resize"});
    
    JPanel gridPanel = new JPanel(new GridLayout(3,3));
    gridPanel.setBorder(BorderFactory.createEmptyBorder(20, 0, 10, 0));

    top.setLayout(new GridLayout(2,2));
    top.setBorder(BorderFactory.createTitledBorder("Current Size"));
    
    middle.setBorder(BorderFactory.createTitledBorder("Resize To"));

    group = new ButtonGroup();
    buttons = new AttachSide[3][3];
    
    for (int y = 0; y < 3; ++y)
    {
      for (int x = 0; x < 3; ++x)
      {
        JToggleButton button = new JToggleButton();
        if (icons[y][x] != null) button.setIcon(icons[y][x].icon());
        button.setPreferredSize(new Dimension(40,40));
        button.addActionListener(listener);
        
        group.add(button);
        buttons[y][x] = new AttachSide(button, HorAttach.values()[x], VerAttach.values()[y]);
        
        if (x == 1 && y == 1)
          button.setSelected(true);
        
        gridPanel.add(button);
      }
    }

    labelSize = new JLabel("Model Size");
    labelBounds = new JLabel("Model Bounds");
    
    fieldSize = new JTextField("1x1");
    fieldSize.setHorizontalAlignment(JTextField.CENTER);
    fieldSize.setEditable(false);
    
    fieldBounds = new JTextField("1x1");
    fieldBounds.setHorizontalAlignment(JTextField.CENTER);
    fieldBounds.setEditable(false);
    
    top.add(labelSize);
    top.add(fieldSize);
    top.add(labelBounds);
    top.add(fieldBounds);

    width = new JTextField(4);
    height = new JTextField(4);
    
    JPanel panel1 = new JPanel();
    
    panel1.add(width);
    panel1.add(new JLabel("x"));
    panel1.add(height);
    
    middle.setLayout(new BoxLayout(middle, BoxLayout.PAGE_AXIS));
    middle.add(panel1);
    
    JPanel panel2 = new JPanel(new GridLayout(2,1));
    cropToBounds = new JCheckBox("Crop to bounds");
    keepCentered = new JCheckBox("Keep model centered");
    cropToBounds.setAlignmentX(0.0f);
    keepCentered.setAlignmentX(0.0f);
    cropToBounds.addActionListener(listener);
    keepCentered.addActionListener(listener);
    
    panel2.add(cropToBounds);
    panel2.add(keepCentered);
    
    middle.add(panel2);
    middle.add(gridPanel);
    
    finalizeDialog();
  }