Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qq_51543278
FTPsystem
提交
07d4547a
F
FTPsystem
项目概览
qq_51543278
/
FTPsystem
通知
13
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
3
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
12
Wiki
分析
仓库
DevOps
项目成员
Pages
F
FTPsystem
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
3
Issue
3
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
12
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
07d4547a
编写于
11月 22, 2022
作者:
weixin_50772964
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update UI.java
上级
6c48b0a8
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
47 addition
and
20 deletion
+47
-20
src/ftp/UI.java
src/ftp/UI.java
+47
-20
未找到文件。
src/ftp/UI.java
浏览文件 @
07d4547a
package
ftp
;
import
org.apache.commons.net.ftp.FTPClient
;
import
javax.swing.*
;
import
java.awt.*
;
import
java.awt.event.ActionEvent
;
...
...
@@ -31,6 +29,7 @@ public class UI extends JFrame {
JScrollPane
jScrollPane
=
new
JScrollPane
();
TaskList
t
=
new
TaskList
();
listPanel
listpanel
=
new
listPanel
(
t
);
public
UI
(){
setTitle
(
"ftp软件"
);
...
...
@@ -38,7 +37,7 @@ public class UI extends JFrame {
setLayout
(
null
);
setBounds
(
0
,
0
,
1200
,
90
0
);
setBounds
(
0
,
0
,
1200
,
87
0
);
jTextArea
.
setEditable
(
false
);
jScrollPane
.
setVerticalScrollBarPolicy
(
JScrollPane
.
VERTICAL_SCROLLBAR_AS_NEEDED
);
jScrollPane
.
setViewportView
(
jTextArea
);
...
...
@@ -65,13 +64,14 @@ public class UI extends JFrame {
jPasswordField
.
setBounds
(
610
,
20
,
130
,
20
);
jButton1
.
setBounds
(
750
,
20
,
60
,
20
);
jButton2
.
setBounds
(
820
,
20
,
100
,
20
);
jButton3
.
setBounds
(
170
,
2
9
0
,
90
,
40
);
jButton4
.
setBounds
(
750
,
2
9
0
,
90
,
40
);
localpanel
.
setBounds
(
30
,
3
30
,
450
,
30
0
);
ftpPanel
.
setBounds
(
500
,
3
30
,
450
,
30
0
);
jButton5
.
setBounds
(
650
,
2
9
0
,
90
,
40
);
jButton6
.
setBounds
(
850
,
2
9
0
,
90
,
40
);
jButton3
.
setBounds
(
170
,
2
7
0
,
90
,
40
);
jButton4
.
setBounds
(
750
,
2
7
0
,
90
,
40
);
localpanel
.
setBounds
(
30
,
3
10
,
450
,
25
0
);
ftpPanel
.
setBounds
(
500
,
3
10
,
450
,
25
0
);
jButton5
.
setBounds
(
650
,
2
7
0
,
90
,
40
);
jButton6
.
setBounds
(
850
,
2
7
0
,
90
,
40
);
jScrollPane
.
setBounds
(
30
,
50
,
800
,
200
);
listpanel
.
setBounds
(
30
,
560
,
800
,
210
);
...
...
@@ -92,6 +92,7 @@ public class UI extends JFrame {
c
.
add
(
jButton6
);
c
.
add
(
localpanel
);
c
.
add
(
ftpPanel
);
c
.
add
(
listpanel
);
//c.add(jTextArea);
c
.
add
(
jScrollPane
);
...
...
@@ -102,12 +103,32 @@ public class UI extends JFrame {
}
/*@Override
public void actionPerformed(ActionEvent e) {
if (e.getActionCommand() == "连接") {
if(jTextField1.getText()==null||jTextField2.getText()==""||jTextField3.getText()==""||jPasswordField.getText()==""){
JOptionPane .showMessageDialog(null,"输入不能为空","",JOptionPane.PLAIN_MESSAGE);
}
else{
//建立连接的代码
}
} else if (e.getActionCommand() == "断开连接") {//如果事件源是 jbClear,那么清除文本框的文字
//断开连接的代码
}
}*/
class
jButton1event
implements
ActionListener
{
@Override
public
void
actionPerformed
(
ActionEvent
e
)
{
String
password
=
new
String
(
jPasswordField
.
getPassword
());
if
(
jTextField1
.
getText
().
trim
().
equals
(
""
)||
jTextField2
.
getText
().
trim
().
equals
(
""
)||
jTextField3
.
getText
().
trim
().
equals
(
""
)||
password
.
trim
().
equals
(
""
)){
/*
if(jTextField1.getText().trim().equals("")||jTextField2.getText().trim().equals("")||jTextField3.getText().trim().equals("")||password.trim().equals("")){
JOptionPane.showMessageDialog(null,"输入不能为空","",JOptionPane.PLAIN_MESSAGE);
...
...
@@ -117,7 +138,7 @@ public class UI extends JFrame {
if(jTextField1.getText().trim().equals("43.139.43.93")){
if(jTextField2.getText().trim().equals("21")){
if(jTextField3.getText().trim().equals("1")){
if
(
password
.
trim
().
equals
(
"Qaz112"
)
){
if(password.trim().equals("Qaz112")){
FTPClient ftpClient=ftp.Connect.connectFtpServer("43.139.43.93",21,"1","Qaz112","GBK");
Global.setFTPClient(ftpClient);
if(ftpClient.isConnected()){
...
...
@@ -146,6 +167,17 @@ public class UI extends JFrame {
jTextArea.append("\n");
number++;
}
}*/
if
(
ftp
.
Connect
.
isConnected
(
ftpClient
)){
jTextArea
.
append
(
number
+
".连接成功"
);
ftpPanel
.
initx
();
jTextArea
.
append
(
"\n"
);
number
++;
}
else
{
jTextArea
.
append
(
number
+
".连接失败"
);
ftpPanel
.
initx
();
jTextArea
.
append
(
"\n"
);
number
++;
}
}
}
...
...
@@ -197,20 +229,13 @@ public class UI extends JFrame {
@Override
public
void
actionPerformed
(
ActionEvent
e
)
{
if
(
localpanel
.
getindex
()==-
1
){
jTextArea
.
append
(
number
+
".请选择文件"
);
jTextArea
.
append
(
"\n"
);
number
++;
}
else
{
String
filepath
=
new
String
();
filepath
=
localpanel
.
getCurrentPath
()+
"\\"
+
localpanel
.
getfile1
();
System
.
out
.
println
(
filepath
);
t
.
newDownload
(
ftpPanel
.
getfile1
(),
localpanel
.
getCurrentPath
(),
ftpClient
);
listpanel
.
refresh
();
//文件路径为filepath,剩下的代码为下载操作。
jTextArea
.
append
(
number
+
".下载成功"
);
jTextArea
.
append
(
"\n"
);
number
++;
}
}
}
...
...
@@ -229,6 +254,7 @@ public class UI extends JFrame {
System
.
out
.
println
(
filepath
);
t
.
newUpload
(
ftpClient
,
filepath
);
//文件路径为filepath,剩下的代码为上传操作。
listpanel
.
refresh
();
jTextArea
.
append
(
number
+
"."
);
jTextArea
.
append
(
"\n"
);
number
++;
...
...
@@ -243,3 +269,4 @@ public class UI extends JFrame {
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录