本文整理汇总了Java中java.awt.peer.FileDialogPeer.setFile方法的典型用法代码示例。如果您正苦于以下问题:Java FileDialogPeer.setFile方法的具体用法?Java FileDialogPeer.setFile怎么用?Java FileDialogPeer.setFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.peer.FileDialogPeer
的用法示例。
在下文中一共展示了FileDialogPeer.setFile方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setFile
import java.awt.peer.FileDialogPeer; //导入方法依赖的package包/类
/**
* Sets the selected file for this dialog.
*
* @param file The selected file for this dialog.
*/
public synchronized void
setFile(String file)
{
if ("".equals(file))
this.file = null;
else
this.file = file;
if (peer != null)
{
FileDialogPeer f = (FileDialogPeer) peer;
f.setFile (file);
}
}
示例2: setFile
import java.awt.peer.FileDialogPeer; //导入方法依赖的package包/类
/**
* Sets the selected file for this dialog.
*
* @param file The selected file for this dialog.
*/
public synchronized void
setFile(String file)
{
if ("".equals(file))
this.file = null;
else
this.file = file;
if (peer != null)
{
FileDialogPeer f = (FileDialogPeer) peer;
f.setFile (file);
}
}
示例3: setFile
import java.awt.peer.FileDialogPeer; //导入方法依赖的package包/类
/**
* Sets the selected file for this file dialog window to be the
* specified file. This file becomes the default file if it is set
* before the file dialog window is first shown.
* <p>
* When the dialog is shown, the specified file is selected. The kind of
* selection depends on the file existence, the dialog type, and the native
* platform. E.g., the file could be highlighted in the file list, or a
* file name editbox could be populated with the file name.
* <p>
* This method accepts either a full file path, or a file name with an
* extension if used together with the {@code setDirectory} method.
* <p>
* Specifying "" as the file is exactly equivalent to specifying
* {@code null} as the file.
*
* @param file the file being set
* @see #getFile
* @see #getFiles
*/
public void setFile(String file) {
this.file = (file != null && file.equals("")) ? null : file;
FileDialogPeer peer = (FileDialogPeer)this.peer;
if (peer != null) {
peer.setFile(this.file);
}
}
示例4: setFile
import java.awt.peer.FileDialogPeer; //导入方法依赖的package包/类
/**
* Sets the selected file for this file dialog window to be the
* specified file. This file becomes the default file if it is set
* before the file dialog window is first shown.
* <p>
* Specifying "" as the file is exactly equivalent to specifying
* <code>null</code>
* as the file.
*
* @param file the file being set
* @see java.awt.FileDialog#getFile
*/
public void setFile(String file) {
this.file = (file != null && file.equals("")) ? null : file;
FileDialogPeer peer = (FileDialogPeer)this.peer;
if (peer != null) {
peer.setFile(this.file);
}
}
示例5: setFile
import java.awt.peer.FileDialogPeer; //导入方法依赖的package包/类
/**
* Sets the selected file for this file dialog window to be the
* specified file. This file becomes the default file if it is set
* before the file dialog window is first shown.
* <p>
* Specifying "" as the file is exactly equivalent to specifying
* <code>null</code>
* as the file.
*
* @param file the file being set
* @see #getFile
* @see #getFiles
*/
public void setFile(String file) {
this.file = (file != null && file.equals("")) ? null : file;
FileDialogPeer peer = (FileDialogPeer)this.peer;
if (peer != null) {
peer.setFile(this.file);
}
}