Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
御承扬
java1
提交
bdba0a27
J
java1
项目概览
御承扬
/
java1
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
java1
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
bdba0a27
编写于
8月 07, 2019
作者:
御
御承扬
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update
上级
a3179db5
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
75 addition
and
15 deletion
+75
-15
.idea/workspace.xml
.idea/workspace.xml
+17
-15
src/高级Swing组件/JFileChooserTest.java
src/高级Swing组件/JFileChooserTest.java
+58
-0
未找到文件。
.idea/workspace.xml
浏览文件 @
bdba0a27
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"ChangeListManager"
>
<list
default=
"true"
id=
"4e65795a-6659-4829-a5e6-120206826e71"
name=
"Default Changelist"
comment=
""
>
<change
afterPath=
"$PROJECT_DIR$/src/高级Swing组件/J
ToolBa
rTest.java"
afterDir=
"false"
/>
<list
default=
"true"
id=
"4e65795a-6659-4829-a5e6-120206826e71"
name=
"Default Changelist"
comment=
"
Update
"
>
<change
afterPath=
"$PROJECT_DIR$/src/高级Swing组件/J
FileChoose
rTest.java"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/.idea/workspace.xml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/.idea/workspace.xml"
afterDir=
"false"
/>
</list>
<list
id=
"cbcb3066-613e-44bd-84c2-b0cf22cc5a78"
name=
"New changelist"
comment=
"New changelist"
/>
...
...
@@ -129,7 +129,7 @@
</list>
</option>
</component>
<component
name=
"RunManager"
selected=
"应用程序.J
ToolBa
rTest"
>
<component
name=
"RunManager"
selected=
"应用程序.J
FileChoose
rTest"
>
<configuration
name=
"CustomMenuTest"
type=
"Application"
factoryName=
"应用程序"
temporary=
"true"
nameIsGenerated=
"true"
>
<option
name=
"MAIN_CLASS_NAME"
value=
"高级Swing组件.CustomMenuTest"
/>
<module
name=
"IDEA_JAVA"
/>
...
...
@@ -143,8 +143,8 @@
<option
name=
"Make"
enabled=
"true"
/>
</method>
</configuration>
<configuration
name=
"J
InternalFrame
Test"
type=
"Application"
factoryName=
"应用程序"
temporary=
"true"
nameIsGenerated=
"true"
>
<option
name=
"MAIN_CLASS_NAME"
value=
"高级Swing组件.J
InternalFrame
Test"
/>
<configuration
name=
"J
FileChooser
Test"
type=
"Application"
factoryName=
"应用程序"
temporary=
"true"
nameIsGenerated=
"true"
>
<option
name=
"MAIN_CLASS_NAME"
value=
"高级Swing组件.J
FileChooser
Test"
/>
<module
name=
"IDEA_JAVA"
/>
<extension
name=
"coverage"
>
<pattern>
...
...
@@ -197,11 +197,11 @@
</configuration>
<recent_temporary>
<list>
<item
itemvalue=
"应用程序.JFileChooserTest"
/>
<item
itemvalue=
"应用程序.JToolBarTest"
/>
<item
itemvalue=
"应用程序.JPopupMenuTest"
/>
<item
itemvalue=
"应用程序.CustomMenuTest"
/>
<item
itemvalue=
"应用程序.JMenuTest"
/>
<item
itemvalue=
"应用程序.JInternalFrameTest"
/>
</list>
</recent_temporary>
</component>
...
...
@@ -308,14 +308,9 @@
<workItem
from=
"1565075431750"
duration=
"1264000"
/>
<workItem
from=
"1565088293627"
duration=
"5369000"
/>
<workItem
from=
"1565139443926"
duration=
"2467000"
/>
<workItem
from=
"1565150573088"
duration=
"2782000"
/>
</task>
<task
id=
"LOCAL-00023"
summary=
"Update"
>
<created>
1561212808183
</created>
<option
name=
"number"
value=
"00023"
/>
<option
name=
"presentableId"
value=
"LOCAL-00023"
/>
<option
name=
"project"
value=
"LOCAL"
/>
<updated>
1561212808184
</updated>
<workItem
from=
"1565150573088"
duration=
"3609000"
/>
<workItem
from=
"1565180378512"
duration=
"46000"
/>
<workItem
from=
"1565180451307"
duration=
"1225000"
/>
</task>
<task
id=
"LOCAL-00024"
summary=
"Update"
>
<created>
1561214317583
</created>
...
...
@@ -653,7 +648,14 @@
<option
name=
"project"
value=
"LOCAL"
/>
<updated>
1565142356877
</updated>
</task>
<option
name=
"localTasksCounter"
value=
"72"
/>
<task
id=
"LOCAL-00072"
summary=
"Update"
>
<created>
1565153575184
</created>
<option
name=
"number"
value=
"00072"
/>
<option
name=
"presentableId"
value=
"LOCAL-00072"
/>
<option
name=
"project"
value=
"LOCAL"
/>
<updated>
1565153575184
</updated>
</task>
<option
name=
"localTasksCounter"
value=
"73"
/>
<servers
/>
</component>
<component
name=
"TodoView"
selected-index=
"3"
>
...
...
src/高级Swing组件/JFileChooserTest.java
0 → 100644
浏览文件 @
bdba0a27
package
高级
Swing
组件
;
// !/usr/bin/env jdk1.8
// encoding:utf-8
//@software:IntelliJ IDEA
//@pack:高级Swing组件
//@user:彭友聪
//@date:2019/08/07
//@time:下午 8:25
//@project:IDEA_JAVA
//@file:JFileChooserTest.java
//Author:御承扬
//email:2923616405@qq.com
import
javax.swing.*
;
import
java.awt.*
;
import
java.awt.event.ActionEvent
;
import
java.awt.event.ActionListener
;
import
java.io.File
;
public
class
JFileChooserTest
extends
JFrame
{
private
JTextField
textField
;
private
JFileChooserTest
()
{
super
();
setTitle
(
"文件选择器对话框示例"
);
setBounds
(
100
,
100
,
600
,
375
);
setDefaultCloseOperation
(
WindowConstants
.
EXIT_ON_CLOSE
);
final
JPanel
panel
=
new
JPanel
(
);
getContentPane
().
add
(
panel
,
BorderLayout
.
NORTH
);
final
JLabel
label
=
new
JLabel
(
"文件:"
);
panel
.
add
(
label
);
textField
=
new
JTextField
(
);
textField
.
setColumns
(
20
);
panel
.
add
(
textField
);
final
JButton
button
=
new
JButton
(
"上传"
);
button
.
addActionListener
(
new
ActionListener
()
{
@Override
public
void
actionPerformed
(
ActionEvent
e
)
{
JFileChooser
fileChooser
=
new
JFileChooser
(
);
// 创建文件选择对话框
int
i
=
fileChooser
.
showOpenDialog
(
getContentPane
()
);
// 显示文件选择对话框
if
(
i
==
JFileChooser
.
APPROVE_OPTION
){
// 判断用户单击的是否为“打开”按钮
File
selectedFile
=
fileChooser
.
getSelectedFile
();
// 获得选中的文件对象
textField
.
setText
(
selectedFile
.
getName
()
);
// 显示选中文件的名称
}
}
}
);
panel
.
add
(
button
);
}
public
static
void
main
(
String
[]
args
)
{
JFileChooserTest
frame
=
new
JFileChooserTest
();
frame
.
setVisible
(
true
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录