📄 treeselectionmodel.html
字号:
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/swing/tree/TreeSelectionModel.html#getSelectionMode()">getSelectionMode</A></B>()</CODE><BR> Returns the current selection mode, one of <code>SINGLE_TREE_SELECTION</code>, <code>CONTIGUOUS_TREE_SELECTION</code> or <code>DISCONTIGUOUS_TREE_SELECTION</code>.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../../javax/swing/tree/TreePath.html">TreePath</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/swing/tree/TreeSelectionModel.html#getSelectionPath()">getSelectionPath</A></B>()</CODE><BR> Returns the first path in the selection.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../../javax/swing/tree/TreePath.html">TreePath</A>[]</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/swing/tree/TreeSelectionModel.html#getSelectionPaths()">getSelectionPaths</A></B>()</CODE><BR> Returns the paths in the selection.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> int[]</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/swing/tree/TreeSelectionModel.html#getSelectionRows()">getSelectionRows</A></B>()</CODE><BR> Returns all of the currently selected rows.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/swing/tree/TreeSelectionModel.html#isPathSelected(javax.swing.tree.TreePath)">isPathSelected</A></B>(<A HREF="../../../javax/swing/tree/TreePath.html">TreePath</A> path)</CODE><BR> Returns true if the path, <code>path</code>, is in the current selection.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/swing/tree/TreeSelectionModel.html#isRowSelected(int)">isRowSelected</A></B>(int row)</CODE><BR> Returns true if the row identitifed by row is selected.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/swing/tree/TreeSelectionModel.html#isSelectionEmpty()">isSelectionEmpty</A></B>()</CODE><BR> Returns true if the selection is currently empty.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/swing/tree/TreeSelectionModel.html#removePropertyChangeListener(java.beans.PropertyChangeListener)">removePropertyChangeListener</A></B>(<A HREF="../../../java/beans/PropertyChangeListener.html">PropertyChangeListener</A> listener)</CODE><BR> Removes a PropertyChangeListener from the listener list.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/swing/tree/TreeSelectionModel.html#removeSelectionPath(javax.swing.tree.TreePath)">removeSelectionPath</A></B>(<A HREF="../../../javax/swing/tree/TreePath.html">TreePath</A> path)</CODE><BR> Removes path from the selection.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/swing/tree/TreeSelectionModel.html#removeSelectionPaths(javax.swing.tree.TreePath[])">removeSelectionPaths</A></B>(<A HREF="../../../javax/swing/tree/TreePath.html">TreePath</A>[] paths)</CODE><BR> Removes paths from the selection.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/swing/tree/TreeSelectionModel.html#removeTreeSelectionListener(javax.swing.event.TreeSelectionListener)">removeTreeSelectionListener</A></B>(<A HREF="../../../javax/swing/event/TreeSelectionListener.html">TreeSelectionListener</A> x)</CODE><BR> Removes x from the list of listeners that are notified each time the set of selected TreePaths changes.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/swing/tree/TreeSelectionModel.html#resetRowSelection()">resetRowSelection</A></B>()</CODE><BR> Updates this object's mapping from TreePaths to rows.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/swing/tree/TreeSelectionModel.html#setRowMapper(javax.swing.tree.RowMapper)">setRowMapper</A></B>(<A HREF="../../../javax/swing/tree/RowMapper.html">RowMapper</A> newMapper)</CODE><BR> Sets the RowMapper instance.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/swing/tree/TreeSelectionModel.html#setSelectionMode(int)">setSelectionMode</A></B>(int mode)</CODE><BR> Sets the selection model, which must be one of SINGLE_TREE_SELECTION, CONTIGUOUS_TREE_SELECTION or DISCONTIGUOUS_TREE_SELECTION.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/swing/tree/TreeSelectionModel.html#setSelectionPath(javax.swing.tree.TreePath)">setSelectionPath</A></B>(<A HREF="../../../javax/swing/tree/TreePath.html">TreePath</A> path)</CODE><BR> Sets the selection to path.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/swing/tree/TreeSelectionModel.html#setSelectionPaths(javax.swing.tree.TreePath[])">setSelectionPaths</A></B>(<A HREF="../../../javax/swing/tree/TreePath.html">TreePath</A>[] paths)</CODE><BR> Sets the selection to path.</TD></TR></TABLE> <P><!-- ============ FIELD DETAIL =========== --><A NAME="field_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Field Detail</B></FONT></TD></TR></TABLE><A NAME="SINGLE_TREE_SELECTION"><!-- --></A><H3>SINGLE_TREE_SELECTION</H3><PRE>public static final int <B>SINGLE_TREE_SELECTION</B></PRE><DL><DD>Selection can only contain one path at a time.</DL><HR><A NAME="CONTIGUOUS_TREE_SELECTION"><!-- --></A><H3>CONTIGUOUS_TREE_SELECTION</H3><PRE>public static final int <B>CONTIGUOUS_TREE_SELECTION</B></PRE><DL><DD>Selection can only be contiguous. This will only be enforced if a RowMapper instance is provided. That is, if no RowMapper is set this behaves the same as DISCONTIGUOUS_TREE_SELECTION.</DL><HR><A NAME="DISCONTIGUOUS_TREE_SELECTION"><!-- --></A><H3>DISCONTIGUOUS_TREE_SELECTION</H3><PRE>public static final int <B>DISCONTIGUOUS_TREE_SELECTION</B></PRE><DL><DD>Selection can contain any number of items that are not necessarily contiguous.</DL><!-- ========= CONSTRUCTOR DETAIL ======== --><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Method Detail</B></FONT></TD></TR></TABLE><A NAME="setSelectionMode(int)"><!-- --></A><H3>setSelectionMode</H3><PRE>public void <B>setSelectionMode</B>(int mode)</PRE><DL><DD>Sets the selection model, which must be one of SINGLE_TREE_SELECTION, CONTIGUOUS_TREE_SELECTION or DISCONTIGUOUS_TREE_SELECTION. <p> This may change the selection if the current selection is not valid for the new mode. For example, if three TreePaths are selected when the mode is changed to <code>SINGLE_TREE_SELECTION</code>, only one TreePath will remain selected. It is up to the particular implementation to decide what TreePath remains selected.</DL><HR><A NAME="getSelectionMode()"><!-- --></A><H3>getSelectionMode</H3><PRE>public int <B>getSelectionMode</B>()</PRE><DL><DD>Returns the current selection mode, one of <code>SINGLE_TREE_SELECTION</code>, <code>CONTIGUOUS_TREE_SELECTION</code> or <code>DISCONTIGUOUS_TREE_SELECTION</code>.</DL><HR><A NAME="setSelectionPath(javax.swing.tree.TreePath)"><!-- --></A><H3>setSelectionPath</H3><PRE>public void <B>setSelectionPath</B>(<A HREF="../../../javax/swing/tree/TreePath.html">TreePath</A> path)</PRE><DL><DD>Sets the selection to path. If this represents a change, then the TreeSelectionListeners are notified. If <code>path</code> is null, this has the same effect as invoking <code>clearSelection</code>.<DD><DL><DT><B>Parameters:</B><DD><CODE>path</CODE> - new path to select</DL></DD></DL><HR><A NAME="setSelectionPaths(javax.swing.tree.TreePath[])"><!-- --></A><H3>setSelectionPaths</H3><PRE>public void <B>setSelectionPaths</B>(<A HREF="../../../javax/swing/tree/TreePath.html">TreePath</A>[] paths)</PRE><DL><DD>Sets the selection to path. If this represents a change, then the TreeSelectionListeners are notified. If <code>paths</code> is null, this has the same effect as invoking <code>clearSelection</code>.<DD><DL><DT><B>Parameters:</B><DD><CODE>paths</CODE> - new selection</DL></DD></DL><HR><A NAME="addSelectionPath(javax.swing.tree.TreePath)"><!-- --></A><H3>addSelectionPath</H3><PRE>public void <B>addSelectionPath</B>(<A HREF="../../../javax/swing/tree/TreePath.html">TreePath</A> path)</PRE><DL><DD>Adds path to the current selection. If path is not currently in the selection the TreeSelectionListeners are notified. This has no effect if <code>path</code> is null.<DD><DL><DT><B>Parameters:</B><DD><CODE>path</CODE> - the new path to add to the current selection</DL></DD></DL><HR><A NAME="addSelectionPaths(javax.swing.tree.TreePath[])"><!-- --></A><H3>addSelectionPaths</H3><PRE>public void <B>addSelectionPaths</B>(<A HREF="../../../javax/swing/tree/TreePath.html">TreePath</A>[] paths)</PRE><DL><DD>Adds paths to the current selection. If any of the paths in paths are not currently in the selection the TreeSelectionListeners are notified. This has no effect if <code>paths</code> is null.<DD><DL><DT><B>Parameters:</B><DD><CODE>path</CODE> - the new path to add to the current selection</DL></DD></DL><HR><A NAME="removeSelectionPath(javax.swing.tree.TreePath)"><!-- --></A><H3>removeSelectionPath</H3>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -