Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
38 lines (27 loc) · 849 Bytes

File metadata and controls

38 lines (27 loc) · 849 Bytes
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package com.server.util;
import java.awt.FileDialog;
import javax.swing.JFrame;
public class SendFile extends JFrame{
public static String name = null;
private static final long serialVersionUID = 1L;
public static String fileName = null;
// 选择打开文件
public String getFile() {
//打开一个FileDialog,设置标题和模式(读取文件)
FileDialog fd = new FileDialog(this, "请选择要传给zpc的文件", FileDialog.LOAD);
//设置打开对话框的根目录
fd.setDirectory("C:\\");
fd.setVisible(true);
/*
* 当用户选择了取消按钮,则返回null
*/
if (fd.getFile() != null) {
//获取文件的全文件名
fileName = fd.getDirectory()+fd.getFile();
name = fd.getFile();
System.out.println("已选择打开 " + fileName);
}
//返回文件全路径
return fileName;
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.