public void update(Pattern p)
  {
    patternString.getDocument().removeDocumentListener(patternStringListener);
    name.getDocument().removeDocumentListener(nameListener);
    author.getDocument().removeDocumentListener(authorListener);
    width.removeChangeListener(widthListener);
    height.removeChangeListener(heightListener);
    startX.removeChangeListener(startXListener);
    startY.removeChangeListener(startYListener);
    rows.getDocument().removeDocumentListener(rowsListener);

    if (!p.getString().equals(patternString.getText())) patternString.setText(p.getString());
    if (!p.getName().equals(name.getText())) name.setText(p.getName());
    if (!p.getAuthor().equals(author.getText())) author.setText(p.getAuthor());
    if (p.getWidth() != (Integer)width.getValue()) width.setValue(p.getWidth());
    if (p.getHeight() != (Integer)height.getValue()) height.setValue(p.getHeight());
    if (p.getStartCol() != (Integer)startX.getValue()) startX.setValue(p.getStartCol());
    if (p.getStartRow() != (Integer)startY.getValue()) startY.setValue(p.getStartRow());
    if (!p.getCells().equals(rows.getText())) rows.setText(p.getCells());

    patternString.getDocument().addDocumentListener(patternStringListener);
    name.getDocument().addDocumentListener(nameListener);
    author.getDocument().addDocumentListener(authorListener);
    width.addChangeListener(widthListener);
    height.addChangeListener(heightListener);
    startX.addChangeListener(startXListener);
    startY.addChangeListener(startYListener);
    rows.getDocument().addDocumentListener(rowsListener);
  }