需要文件读取,然后再看看textfield的api
解决方案 »
- 关于io的初学问题
- 求助:在Java中如何判断文档中数据和MySQL表中的数据重复,并删除
- 字符串中去掉空格 输出!
- 100分的问题:如何取当前桌面路径?(针对不同操作系统的)。分不够再加
- 小女子请教各位大虾们,谢谢:)
- 如何输出中国格式的时间?
- 急求一Java代码,请各位帮助。
- 如何用JDBC连oracle数据库!
- ResultSet.getDate("columnname")得到的数据用什么类型的变量接收?
- 新人求指导:我有这样一个需求,我现在是客户端,已经给服务端发了数据,服务端给我返回数据,但是服务端给我返回数据的时候,可能出现网络中断的情况,这样,我拿到的数据
- 求助JFrame中窗体的设置问题
- 关于获得JFrame中JTextField中的内容的一个小问题
TextField t=new TextField(20);
add(t);
}
public static void main(String args[])throws Exception
{FileInputStream f2=new FileInputStream("E:/java/io/test.txt");
f2.read();
f2.close();}
就像这样要在哪里导入才行!~!~
class Test
{
public Test()
{
try
{
DataInputStream din = new DataInputStream(
new FileInputStream("test.txt"));
while(din.available()!=0)
{
System.out.println(din.readLine());
}
}catch(IOException e)
{
e.printStackTrace();
}
}
public static void main(String[] args)
{
Test test = new Test();
}
}
你把System.out.println(din.readLine())改成textfield.append(din.readLine()))就行了啊