Пример #1
0
 /**
  * 入力の制限されたテキストフィールドを返します.
  *
  * @return
  * @throws IllegalArgumentException {@link FileNameEditor#createTreeCellEditorForText()
  *     }で作成されたセルエディタの{@link DefaultCellEditor#getComponent() }が{@link JTextComponent}でないとき
  */
 @Override
 protected final TreeCellEditor createTreeCellEditor() {
   DefaultCellEditor cellEditor = createTreeCellEditorForText();
   if (!(cellEditor.getComponent() instanceof JTextComponent)) {
     throw new IllegalStateException();
   }
   JTextComponent editor = (JTextComponent) cellEditor.getComponent();
   String value = editor.getText();
   editor.setDocument(new FileNameDocument());
   editor.setText(value);
   return cellEditor;
 }
 @Override
 public boolean stopCellEditing() {
   try {
     return myProxiedEditor.stopCellEditing();
   } catch (ValidationException e) {
     myProxiedEditor
         .getComponent()
         .setBackground(TreeTableCellEditorImpl.INVALID_VALUE_BACKGROUND);
     return false;
   }
 }