public static final class JTree.DropLocation extends TransferHandler.DropLocation
TransferHandler.DropLocation表示用于一个放置位置
JTree 。
JTree.getDropLocation()
| Modifier and Type | Method and Description |
|---|---|
int |
getChildIndex()
返回相对于由
getPath()返回的路径插入数据的索引。
|
TreePath |
getPath()
返回放置在树中的数据的路径。
|
String |
toString()
返回此放置位置的字符串表示形式。
|
getDropPointpublic int getChildIndex()
getPath()返回的路径插入的丢弃数据的索引。
对于放置模式DropMode.USE_SELECTION和DropMode.ON ,该索引不重要(并且它将始终为-1 ),因为唯一有趣的数据是发生丢弃操作的路径。
对于丢弃模式DropMode.INSERT ,该索引指示将数据插入由getPath()的父路径的getPath() 。 -1表示下降发生在-1身上,大多数情况下应该被视为插入到父项的子列表的开头或结尾。
对于DropMode.ON_OR_INSERT ,如果在路径本身发生了丢弃,则该值将是如上所述的插入索引,或-1 。
getPath()
public TreePath getPath()
该值的解释取决于组件上设置的放置模式。 如果丢弃模式是DropMode.USE_SELECTION或DropMode.ON ,则返回值是数据已被(或将被)丢弃的树中的路径。 null表示下降是在空的空间,不与特定路径相关联。
如果丢弃模式为DropMode.INSERT ,则返回值是指应成为新数据的父节点的路径,在这种情况下, getChildIndex()指示应将新项目插入该父路径的位置。 null路径指示没有确定父路径,这可能由于多种原因:
null案件。
如果丢弃模式是DropMode.ON_OR_INSERT , getChildIndex可以使用getChildIndex来确定丢弃是否位于路径本身( -1 ) DropMode.ON_OR_INSERT ,也可以用于确定其应该插入路径的索引( -1以外的-1 )。
getChildIndex()
public String toString()
toString在类
TransferHandler.DropLocation
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.