java做了一个程序,FileReader()不能识别JButton读取的路径
JButton按钮读取的路径是C:\Users\wan\Documents\sample.conf,但是FileReader()必须要C://Users//wan//Do...
JButton按钮读取的路径是C:\Users\wan\Documents\sample.conf,但是FileReader()必须要C://Users//wan//Documents//sample.conf
public class TestFile {
public static String readFile() throws Exception {
Testpanel r = new Testpanel();
String path2 = r.getPath2();
File file = new File(path2);
BufferedReader br = new BufferedReader(new FileReader(file));
}
if (e1.getSource() == btnSelect2) {
int intRetVal = fc2.showOpenDialog(this);
if (intRetVal == JFileChooser.APPROVE_OPTION) {
txtfile2.setText(fc2.getSelectedFile().getPath());
} 展开
public class TestFile {
public static String readFile() throws Exception {
Testpanel r = new Testpanel();
String path2 = r.getPath2();
File file = new File(path2);
BufferedReader br = new BufferedReader(new FileReader(file));
}
if (e1.getSource() == btnSelect2) {
int intRetVal = fc2.showOpenDialog(this);
if (intRetVal == JFileChooser.APPROVE_OPTION) {
txtfile2.setText(fc2.getSelectedFile().getPath());
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询