📄 fileselectframe.java~5~
字号:
package mydownloader.ui;
import java.awt.*;
import javax.swing.*;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2009</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class FileSelectFrame extends JFrame {
AddTaskFrame frame;
public FileSelectFrame() {
try {
jbInit();
} catch (Exception exception) {
exception.printStackTrace();
}
}
public FileSelectFrame(AddTaskFrame frame) {
try {
this.frame = frame;
jbInit();
} catch (Exception exception) {
exception.printStackTrace();
}
}
private void jbInit() throws Exception {
getContentPane().setLayout(null);
this.setTitle("MyDownloader-选择文件");
this.setSize(550,350);
this.setLocation(300,200);
this.setResizable(false);
this.jFileChooser1.setFileSelectionMode(jFileChooser1.DIRECTORIES_ONLY);
jFileChooser1.setBounds(new Rectangle( -2, 0, 500, 300));
jFileChooser1.addActionListener(new
FileSelectFrame_jFileChooser1_actionAdapter(this));
this.getContentPane().add(jFileChooser1);
}
JFileChooser jFileChooser1 = new JFileChooser();
public void jFileChooser1_actionPerformed(ActionEvent e) {
String path = this.jFileChooser1.getSelectedFile().getAbsolutePath();
this.frame.setFilePath(path);
this.dispose();
}
}
class FileSelectFrame_jFileChooser1_actionAdapter implements ActionListener {
private FileSelectFrame adaptee;
FileSelectFrame_jFileChooser1_actionAdapter(FileSelectFrame adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jFileChooser1_actionPerformed(e);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -