📄 fileopen.java
字号:
package ding;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.io.File;
/**
* <p>Title: 门电路画图器</p>
* <p>Description: www.1shu.net</p>
* <p>Copyright: Copyright (c) 2003</p>
* <p>Company: EyeSome</p>
* @author ES
* @version 1.0
*/
public class fileOpen
extends JDialog {
JPanel panel1 = new JPanel();
BorderLayout borderLayout1 = new BorderLayout();
JFileChooser jFileChooser1 = new JFileChooser();
mainFrame mFrame;
Font tmpF = new Font("Dialog", Font.PLAIN, 14);
public fileOpen(mainFrame frame, String title, boolean modal) {
super(frame, title, modal);
mFrame = frame;
try {
jbInit();
pack();
}
catch (Exception ex) {
ex.printStackTrace();
}
}
public fileOpen() {
this(null, "", false);
}
private void jbInit() throws Exception {
panel1.setLayout(borderLayout1);
jFileChooser1.addActionListener(new fileOpen_jFileChooser1_actionAdapter(this));
this.getContentPane().add(panel1, BorderLayout.CENTER);
panel1.add(jFileChooser1, BorderLayout.WEST);
}
void jFileChooser1_actionPerformed(ActionEvent e) {
//int retval = jFileChooser1.showDialog(mFrame, null);
//if (retval == JFileChooser.APPROVE_OPTION) {
//File theFile = jFileChooser1.getSelectedFile();
/*if (theFile != null) {
if (theFile.isDirectory()) {
System.out.println("请选择一个文件~~");
}
else {
System.out.println("You chose this file: " + theFile.getPath());
}
}*/
//}
}
}
class fileOpen_jFileChooser1_actionAdapter
implements ActionListener {
fileOpen adaptee;
fileOpen_jFileChooser1_actionAdapter(fileOpen adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jFileChooser1_actionPerformed(e);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -