コード例 #1
0
  private void setupWordSelector() {

    // Have we already created a listmodel for this field?
    wordListModel = wordListModels.get(currentField);
    if (wordListModel != null) {
      wordList.setModel(wordListModel);
    } else {
      wordListModel = new DefaultListModel();
      wordList.setModel(wordListModel);
      wordListModels.put(currentField, wordListModel);
      // wordListModel.addElement(WORD_FIRSTLINE_TEXT);
      Vector<String> items = metaData.getData(Globals.SELECTOR_META_PREFIX + currentField);
      if (items != null) {
        wordSet = new TreeSet<String>(items);
        int index = 0;
        for (String s : wordSet) {
          wordListModel.add(index, s);
          index++;
        }
      }
    }
  }
コード例 #2
0
 private void newWordAction() {
   if ((wordListModel.size() == 0) || !wordListModel.get(0).equals(WORD_FIRSTLINE_TEXT))
     wordListModel.add(0, WORD_FIRSTLINE_TEXT);
   wordList.setSelectedIndex(0);
   wPane.getVerticalScrollBar().setValue(0);
 }