JavaTM Platform
Standard Ed. 6

javax.swing.plaf.basic
类 BasicFileChooserUI

java.lang.Object
  继承者 javax.swing.plaf.ComponentUI
      继承者 javax.swing.plaf.FileChooserUI
          继承者 javax.swing.plaf.basic.BasicFileChooserUI
直接已知子类:
MetalFileChooserUI

public class BasicFileChooserUI
     
extends FileChooserUI

FileChooser 的基本 L&F 实现。


嵌套类摘要
protected  class BasicFileChooserUI.AcceptAllFileFilter
           
protected  class BasicFileChooserUI.ApproveSelectionAction
          响应 Open 或 Save 请求
protected  class BasicFileChooserUI.BasicFileView
           
protected  class BasicFileChooserUI.CancelSelectionAction
          响应取消请求。
protected  class BasicFileChooserUI.ChangeToParentDirectoryAction
           
protected  class BasicFileChooserUI.DoubleClickListener
           
protected  class BasicFileChooserUI.GoHomeAction
          基于“Home”键事件或等效事件的动作。
protected  class BasicFileChooserUI.NewFolderAction
          创建新文件夹。
protected  class BasicFileChooserUI.SelectionListener
           
protected  class BasicFileChooserUI.UpdateAction
          重新扫描当前目录中的文件。
 
字段摘要
protected  int cancelButtonMnemonic
           
protected  String cancelButtonText
           
protected  String cancelButtonToolTipText
           
protected  Icon computerIcon
           
protected  Icon detailsViewIcon
           
protected  Icon directoryIcon
           
protected  int directoryOpenButtonMnemonic
          选择了目录且当前选择模式是 FILES_ONLY 时用于确认按钮的助记符键代码。
protected  String directoryOpenButtonText
          选择了目录且当前选择模式是 FILES_ONLY 时在确认按钮上显示的标签文本。
protected  String directoryOpenButtonToolTipText
          选择了目录且当前选择模式是 FILES_ONLY 时在确认按钮上显示的工具提示文本。
protected  Icon fileIcon
           
protected  Icon floppyDriveIcon
           
protected  Icon hardDriveIcon
           
protected  int helpButtonMnemonic
           
protected  String helpButtonText
           
protected  String helpButtonToolTipText
           
protected  Icon homeFolderIcon
           
protected  Icon listViewIcon
           
protected  Icon newFolderIcon
           
protected  int openButtonMnemonic
           
protected  String openButtonText
           
protected  String openButtonToolTipText
           
protected  int saveButtonMnemonic
           
protected  String saveButtonText
           
protected  String saveButtonToolTipText
           
protected  int updateButtonMnemonic
           
protected  String updateButtonText
           
protected  String updateButtonToolTipText
           
protected  Icon upFolderIcon
           
 
构造方法摘要
BasicFileChooserUI(JFileChooser b)
           
 
方法摘要
 void clearIconCache()
           
protected  MouseListener createDoubleClickListener(JFileChooser fc, JList list)
           
 ListSelectionListener createListSelectionListener(JFileChooser fc)
           
protected  void createModel()
           
 PropertyChangeListener createPropertyChangeListener(JFileChooser fc)
           
 void ensureFileIsVisible(JFileChooser fc, File f)
           
 FileFilter getAcceptAllFileFilter(JFileChooser fc)
          返回默认接受所有文件过滤器
 JPanel getAccessoryPanel()
           
protected  JButton getApproveButton(JFileChooser fc)
           
 int getApproveButtonMnemonic(JFileChooser fc)
           
 String getApproveButtonText(JFileChooser fc)
           
 String getApproveButtonToolTipText(JFileChooser fc)
           
 Action getApproveSelectionAction()
           
 Action getCancelSelectionAction()
           
 Action getChangeToParentDirectoryAction()
           
 String getDialogTitle(JFileChooser fc)
          返回此对话框的标题
protected  File getDirectory()
          记忆当前在 UI 中选择的目录的属性。
 String getDirectoryName()
           
 JFileChooser getFileChooser()
           
 String getFileName()
           
 FileView getFileView(JFileChooser fc)
           
 Action getGoHomeAction()
           
 BasicDirectoryModel getModel()
           
 Action getNewFolderAction()
           
 Action getUpdateAction()
           
 void installComponents(JFileChooser fc)
           
protected  void installDefaults(JFileChooser fc)
           
protected  void installIcons(JFileChooser fc)
           
protected  void installListeners(JFileChooser fc)
           
protected  void installStrings(JFileChooser fc)
           
 void installUI(JComponent c)
          配置指定组件,使其适合外观。
protected  boolean isDirectorySelected()
          记忆当前是否在 UI 中选择了目录的属性。
 void rescanCurrentDirectory(JFileChooser fc)
           
protected  void setDirectory(File f)
          记忆当前在 UI 中选择的目录的属性。
 void setDirectoryName(String dirname)
           
protected  void setDirectorySelected(boolean b)
          记忆当前是否在 UI 中选择了目录的属性。
 void setFileName(String filename)
           
 void uninstallComponents(JFileChooser fc)
           
protected  void uninstallDefaults(JFileChooser fc)
           
protected  void uninstallIcons(JFileChooser fc)
           
protected  void uninstallListeners(JFileChooser fc)
           
protected  void uninstallStrings(JFileChooser fc)
           
 void uninstallUI(JComponent c)
          在 installUI 期间,在指定组件上反向执行的配置操作。
 
从类 javax.swing.plaf.ComponentUI 继承的方法
contains, createUI, getAccessibleChild, getAccessibleChildrenCount, getBaseline, getBaselineResizeBehavior, getMaximumSize, getMinimumSize, getPreferredSize, paint, update
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

字段详细信息

directoryIcon

protected Icon directoryIcon

fileIcon

protected Icon fileIcon

computerIcon

protected Icon computerIcon

hardDriveIcon

protected Icon hardDriveIcon

floppyDriveIcon

protected Icon floppyDriveIcon

newFolderIcon

protected Icon newFolderIcon

upFolderIcon

protected Icon upFolderIcon

homeFolderIcon

protected Icon homeFolderIcon

listViewIcon

protected Icon listViewIcon

detailsViewIcon

protected Icon detailsViewIcon

saveButtonMnemonic

protected int saveButtonMnemonic

openButtonMnemonic

protected int openButtonMnemonic

cancelButtonMnemonic

protected int cancelButtonMnemonic

updateButtonMnemonic

protected int updateButtonMnemonic

helpButtonMnemonic

protected int helpButtonMnemonic

directoryOpenButtonMnemonic

protected int directoryOpenButtonMnemonic
选择了目录且当前选择模式是 FILES_ONLY 时用于确认按钮的助记符键代码。

从以下版本开始:
1.4

saveButtonText

protected String saveButtonText

openButtonText

protected String openButtonText

cancelButtonText

protected String cancelButtonText

updateButtonText

protected String updateButtonText

helpButtonText

protected String helpButtonText

directoryOpenButtonText

protected String directoryOpenButtonText
选择了目录且当前选择模式是 FILES_ONLY 时在确认按钮上显示的标签文本。

从以下版本开始:
1.4

saveButtonToolTipText

protected String saveButtonToolTipText

openButtonToolTipText

protected String openButtonToolTipText

cancelButtonToolTipText

protected String cancelButtonToolTipText

updateButtonToolTipText

protected String updateButtonToolTipText

helpButtonToolTipText

protected String helpButtonToolTipText

directoryOpenButtonToolTipText

protected String directoryOpenButtonToolTipText
选择了目录且当前选择模式是 FILES_ONLY 时在确认按钮上显示的工具提示文本。

从以下版本开始:
1.4
构造方法详细信息

BasicFileChooserUI

public BasicFileChooserUI(JFileChooser b)
方法详细信息

installUI

public void installUI(JComponent c)
从类 ComponentUI 复制的描述
配置指定组件,使其适合外观。当 ComponentUI 实例将作为 UI 委托安装在指定组件上时,可调用此方法。此方法应该为外观完整地配置组件,包括以下方面:
  1. 在组件上安装用于颜色、字体、边框、图标、不透明性等方面的所有默认属性值。只要有可能,就 应该重写由客户端程序初始化的属性值。
  2. 如有必要,可在组件上安装一个 LayoutManager
  3. 将所需的所有子组件创建/添加到组件中。
  4. 在组件上创建/安装事件侦听器。
  5. 为了检测和适当响应组件属性更改,可在组件上创建/安装一个 PropertyChangeListener
  6. 在组件上安装键盘 UI(助记符、遍历等等)。
  7. 初始化任何适当的实例数据。

覆盖:
ComponentUI 中的 installUI
参数:
c - 将安装此 UI 委托的组件
另请参见:
ComponentUI.uninstallUI(javax.swing.JComponent), JComponent.setUI(javax.swing.plaf.ComponentUI), JComponent.updateUI()

uninstallUI

public void uninstallUI(JComponent c)
从类 ComponentUI 复制的描述
installUI 期间,在指定组件上反向执行的配置操作。当此 UIComponent 实例将作为 UI 委托从指定组件上移除时,可调用此方法。此方法应该取消在 installUI 中执行的配置操作,非常小心地使 JComponent 实例处于某种洁净状态(没有额外的侦听器、没有特定于外观的属性对象等等)。配置内容应该包括以下方面:
  1. 从组件中移除所有 UI 设置的边框。
  2. 从组件上移除所有 UI 设置的布局管理器。
  3. 从组件中移除所有 UI 添加的子组件。
  4. 从组件中移除所有 UI 添加的事件/属性侦听器。
  5. 从组件中移除所有 UI 安装的键盘 UI。
  6. 使所有已分配的实例数据对象无效,从而允许进行 GC 操作。

覆盖:
ComponentUI 中的 uninstallUI
参数:
c - 从中移除此 UI 委托的组件;此参数常被忽略,但如果 UI 对象是无状态的并由多个组件共享,则可以使用该参数
另请参见:
ComponentUI.installUI(javax.swing.JComponent), JComponent.updateUI()

installComponents

public void installComponents(JFileChooser fc)

uninstallComponents

public void uninstallComponents(JFileChooser fc)

installListeners

protected void installListeners(JFileChooser fc)

uninstallListeners

protected void uninstallListeners(JFileChooser fc)

installDefaults

protected void installDefaults(JFileChooser fc)

installIcons

protected void installIcons(JFileChooser fc)

installStrings

protected void installStrings(JFileChooser fc)

uninstallDefaults

protected void uninstallDefaults(JFileChooser fc)

uninstallIcons

protected void uninstallIcons(JFileChooser fc)

uninstallStrings

protected void uninstallStrings(JFileChooser fc)

createModel

protected void createModel()

getModel

public BasicDirectoryModel getModel()

createPropertyChangeListener

public PropertyChangeListener createPropertyChangeListener(JFileChooser fc)

getFileName

public String getFileName()

getDirectoryName

public String getDirectoryName()

setFileName

public void setFileName(String filename)

setDirectoryName

public void setDirectoryName(String dirname)

rescanCurrentDirectory

public void rescanCurrentDirectory(JFileChooser fc)
指定者:
FileChooserUI 中的 rescanCurrentDirectory

ensureFileIsVisible

public void ensureFileIsVisible(JFileChooser fc,
                                File f)
指定者:
FileChooserUI 中的 ensureFileIsVisible

getFileChooser

public JFileChooser getFileChooser()

getAccessoryPanel

public JPanel getAccessoryPanel()

getApproveButton

protected JButton getApproveButton(JFileChooser fc)

getApproveButtonToolTipText

public String getApproveButtonToolTipText(JFileChooser fc)

clearIconCache

public void clearIconCache()

createDoubleClickListener

protected MouseListener createDoubleClickListener(JFileChooser fc,
                                                  JList list)

createListSelectionListener

public ListSelectionListener createListSelectionListener(JFileChooser fc)

isDirectorySelected

protected boolean isDirectorySelected()
记忆当前是否在 UI 中选择了目录的属性。

返回:
当且仅当当前选择了目录时,返回 true
从以下版本开始:
1.4

setDirectorySelected

protected void setDirectorySelected(boolean b)
记忆当前是否在 UI 中选择了目录的属性。通常由 UI 在选择事件上调用。

参数:
b - 当前是否选择了目录。
从以下版本开始:
1.4

getDirectory

protected File getDirectory()
记忆当前在 UI 中选择的目录的属性。

返回:
directory 属性的值
从以下版本开始:
1.4
另请参见:
setDirectory(java.io.File)

setDirectory

protected void setDirectory(File f)
记忆当前在 UI 中选择的目录的属性。通常由 UI 在选择事件上调用。

参数:
f - 表示当前选择的目录的 File 对象
从以下版本开始:
1.4

getAcceptAllFileFilter

public FileFilter getAcceptAllFileFilter(JFileChooser fc)
返回默认接受所有文件过滤器

指定者:
FileChooserUI 中的 getAcceptAllFileFilter

getFileView

public FileView getFileView(JFileChooser fc)
指定者:
FileChooserUI 中的 getFileView

getDialogTitle

public String getDialogTitle(JFileChooser fc)
返回此对话框的标题

指定者:
FileChooserUI 中的 getDialogTitle

getApproveButtonMnemonic

public int getApproveButtonMnemonic(JFileChooser fc)

getApproveButtonText

public String getApproveButtonText(JFileChooser fc)
指定者:
FileChooserUI 中的 getApproveButtonText

getNewFolderAction

public Action getNewFolderAction()

getGoHomeAction

public Action getGoHomeAction()

getChangeToParentDirectoryAction

public Action getChangeToParentDirectoryAction()

getApproveSelectionAction

public Action getApproveSelectionAction()

getCancelSelectionAction

public Action getCancelSelectionAction()

getUpdateAction

public Action getUpdateAction()

JavaTM Platform
Standard Ed. 6

提交错误或意见
有关更多的 API 参考资料和开发人员文档,请参阅 Java SE 开发人员文档。该文档包含更详细的、面向开发人员的描述,以及总体概述、术语定义、使用技巧和工作代码示例。

版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策