/**
   * Add a word to the cloud.
   *
   * @param word Word to add.
   */
  private void addWord(Word word) {
    if (words.size() >= settings.getInt(WordCloudPreferencePane.MAX_WORDS)) {
      words.poll();
    }

    words.offer(word);
    repaint();
  }
  @Override
  public void settingsChanged(SettingsChangeEvent event) {
    if (WordCloudPreferencePane.MAX_WORDS.equals(event.getKey())) {
      int size = settings.getInt(WordCloudPreferencePane.MAX_WORDS);
      while (words.size() >= size) {
        words.poll();
      }

      repaint();
    }
  }