185 lines
11 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<div class="header">
<div class="subTitle">
javax.swing.filechooser
</div>
<h2 class="title" title="Class FileView">Class FileView</h2>
</div><div class="contentContainer">
<ul class="inheritance">
<li><a href="../../../java/lang/Object.html" title="class in java.lang">java.lang.Object</a></li>
<li>
<ul class="inheritance">
<li>javax.swing.filechooser.FileView</li>
</ul> </li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>
已知直接子类:
</dt>
<dd>
<span><a href="../../../javax/swing/plaf/basic/BasicFileChooserUI.BasicFileView.html" title="javax.swing.plaf.basic中的类">BasicFileChooserUI.BasicFileView</a></span>
</dd>
</dl>
<hr/> <br/> <pre>public abstract class <span class="typeNameLabel">FileView</span>
extends <a href="../../../java/lang/Object.html" title="class in java.lang">Object</a></pre>
<div class="block">
<span><code>FileView</code>定义了一个抽象类可以实现为文件选择器提供File的UI <code>File</code></span>
<span>每个LF <code>JFileChooserUI</code>对象实现此类来传回正确的图标并对该LF特定的类型描述。</span>
<span>例如Microsoft Windows LF返回用于目录和通用文件的通用Windows图标。</span>
<span>此外,您可能希望提供您自己的<code>FileView</code> <code>JFileChooser</code>以返回不同的图标或附加信息使用<a href="../../../javax/swing/JFileChooser.html#setFileView-javax.swing.filechooser.FileView-"><code>JFileChooser.setFileView(javax.swing.filechooser.FileView)</code></a></span>
<p> <span><code>JFileChooser</code>首先看看是否有一个用户定义<code>FileView</code> ,如果有的话,它从那里获取类型信息。</span> <span>如果<code>FileView</code>为任何方法返回<code>null</code> ,则<code>JFileChooser</code>然后使用LF特定视图来获取信息。</span> <span>因此,举例来说,如果你提供了一个<code>FileView</code>类返回<code>Icon</code>为JPG文件并返回<code>null</code>图标所有其他文件该UI的<code>FileView</code>将为其他所有文件提供默认图标。</span> </p>
<p> <span>有关简单文件视图的示例实现,请参阅<code><i>yourJDK</i>/demo/jfc/FileChooserDemo/ExampleFileView.java</code></span> <span>有关更多信息和示例,请参阅<a href="http://docs.oracle.com/javase/tutorial/uiswing/components/filechooser.html">How to Use File Choosers</a> <em>“Java教程</em> ”中<em></em>一节。</span> </p>
</div>
<dl>
<dt>
<span class="seeLabel">另请参见:</span>
</dt>
<dd>
<span><a href="../../../javax/swing/JFileChooser.html" title="javax.swing中的类"><code>JFileChooser</code></a></span>
</dd>
</dl> </li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.summary">
<!-- --> </a> <h3>构造方法摘要</h3>
<table border="0" cellpadding="3" cellspacing="0" class="memberSummary" summary="Constructor Summary table, listing constructors, and an explanation">
<caption>
<span>构造方法</span>
<span class="tabEnd"> </span>
</caption>
<tbody>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../javax/swing/filechooser/FileView.html#FileView--">FileView</a></span>()</code> </td>
</tr>
</tbody>
</table> </li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- --> </a> <h3>方法摘要</h3>
<table border="0" cellpadding="3" cellspacing="0" class="memberSummary" summary="Method Summary table, listing methods, and an explanation">
<caption>
<span class="activeTableTab" id="t0"><span>所有方法</span><span class="tabEnd"> </span></span>
<span class="tableTab" id="t2"><span><a href="javascript:show(2);">接口方法</a></span><span class="tabEnd"> </span></span>
<span class="tableTab" id="t4"><span><a href="javascript:show(8);">具体的方法</a></span><span class="tabEnd"> </span></span>
</caption>
<tbody>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor" id="i0">
<td class="colFirst"><code><a href="../../../java/lang/String.html" title="class in java.lang">String</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../javax/swing/filechooser/FileView.html#getDescription-java.io.File-">getDescription</a></span>(<a href="../../../java/io/File.html" title="class in java.io">File</a> f)</code>
<div class="block">
该文件的人类可读描述。
</div> </td>
</tr>
<tr class="rowColor" id="i1">
<td class="colFirst"><code><a href="../../../javax/swing/Icon.html" title="interface in javax.swing">Icon</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../javax/swing/filechooser/FileView.html#getIcon-java.io.File-">getIcon</a></span>(<a href="../../../java/io/File.html" title="class in java.io">File</a> f)</code>
<div class="block">
在JFileChooser中代表此文件的
<code>JFileChooser</code>
</div> </td>
</tr>
<tr class="altColor" id="i2">
<td class="colFirst"><code><a href="../../../java/lang/String.html" title="class in java.lang">String</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../javax/swing/filechooser/FileView.html#getName-java.io.File-">getName</a></span>(<a href="../../../java/io/File.html" title="class in java.io">File</a> f)</code>
<div class="block">
文件的名称。
</div> </td>
</tr>
<tr class="rowColor" id="i3">
<td class="colFirst"><code><a href="../../../java/lang/String.html" title="class in java.lang">String</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../javax/swing/filechooser/FileView.html#getTypeDescription-java.io.File-">getTypeDescription</a></span>(<a href="../../../java/io/File.html" title="class in java.io">File</a> f)</code>
<div class="block">
对文件类型的可读描述。
</div> </td>
</tr>
<tr class="altColor" id="i4">
<td class="colFirst"><code><a href="../../../java/lang/Boolean.html" title="class in java.lang">Boolean</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../javax/swing/filechooser/FileView.html#isTraversable-java.io.File-">isTraversable</a></span>(<a href="../../../java/io/File.html" title="class in java.io">File</a> f)</code>
<div class="block">
该目录是否可遍历。
</div> </td>
</tr>
</tbody>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.java.lang.Object">
<!-- --> </a> <h3>Methods inherited from class java.lang.<a href="../../../java/lang/Object.html" title="class in java.lang">Object</a></h3> <code><a href="../../../java/lang/Object.html#clone--">clone</a>, <a href="../../../java/lang/Object.html#equals-java.lang.Object-">equals</a>, <a href="../../../java/lang/Object.html#finalize--">finalize</a>, <a href="../../../java/lang/Object.html#getClass--">getClass</a>, <a href="../../../java/lang/Object.html#hashCode--">hashCode</a>, <a href="../../../java/lang/Object.html#notify--">notify</a>, <a href="../../../java/lang/Object.html#notifyAll--">notifyAll</a>, <a href="../../../java/lang/Object.html#toString--">toString</a>, <a href="../../../java/lang/Object.html#wait--">wait</a>, <a href="../../../java/lang/Object.html#wait-long-">wait</a>, <a href="../../../java/lang/Object.html#wait-long-int-">wait</a></code></li>
</ul> </li>
</ul> </li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.detail">
<!-- --> </a> <h3>构造方法详细信息</h3> <a name="FileView--">
<!-- --> </a>
<ul class="blockListLast">
<li class="blockList"> <h4>FileView</h4> <pre>public FileView()</pre> </li>
</ul> </li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- --> </a> <h3>方法详细信息</h3> <a name="getName-java.io.File-">
<!-- --> </a>
<ul class="blockList">
<li class="blockList"> <h4>getName</h4> <pre>public <a href="../../../java/lang/String.html" title="class in java.lang">String</a> getName(<a href="../../../java/io/File.html" title="class in java.io">File</a> f)</pre>
<div class="block">
<span>文件的名称。</span>
<span>通常这将是简单的<code>f.getName()</code></span>
</div> </li>
</ul> <a name="getDescription-java.io.File-">
<!-- --> </a>
<ul class="blockList">
<li class="blockList"> <h4>getDescription</h4> <pre>public <a href="../../../java/lang/String.html" title="class in java.lang">String</a> getDescription(<a href="../../../java/io/File.html" title="class in java.io">File</a> f)</pre>
<div class="block">
<span>该文件的人类可读描述。</span>
<span>例如,名为<i>jag.jpg</i>的文件可能有一个描述“James Gosling的脸的JPEG图像文件”。</span>
</div> </li>
</ul> <a name="getTypeDescription-java.io.File-">
<!-- --> </a>
<ul class="blockList">
<li class="blockList"> <h4>getTypeDescription</h4> <pre>public <a href="../../../java/lang/String.html" title="class in java.lang">String</a> getTypeDescription(<a href="../../../java/io/File.html" title="class in java.io">File</a> f)</pre>
<div class="block">
<span>对文件类型的可读描述。</span>
<span>例如, <code>jpg</code>文件可能具有以下类型描述“JPEG压缩映像文件”</span>
</div> </li>
</ul> <a name="getIcon-java.io.File-">
<!-- --> </a>
<ul class="blockList">
<li class="blockList"> <h4>getIcon</h4> <pre>public <a href="../../../javax/swing/Icon.html" title="interface in javax.swing">Icon</a> getIcon(<a href="../../../java/io/File.html" title="class in java.io">File</a> f)</pre>
<div class="block">
在JFileChooser中代表此文件的
<code>JFileChooser</code>
</div> </li>
</ul> <a name="isTraversable-java.io.File-">
<!-- --> </a>
<ul class="blockListLast">
<li class="blockList"> <h4>isTraversable</h4> <pre>public <a href="../../../java/lang/Boolean.html" title="class in java.lang">Boolean</a> isTraversable(<a href="../../../java/io/File.html" title="class in java.io">File</a> f)</pre>
<div class="block">
Whether the directory is traversable or not. This might be useful, for example, if you want a directory to represent a compound document and don't want the user to descend into it.
</div> </li>
</ul> </li>
</ul> </li>
</ul>
</div>
</div>