java记事本时间代码 java记事本代码运行( 七 )


fd.setVisible(true);FileInputStream fis=new FileInputStream(fd.getDirectory()+fd.getFile());
ta.setText("");
int n=0;
while((n=fis.read())!=-1)
ta.append(""+(char)n);
fis.close();
}
public void saveText() throws IOException
{
FileDialog fd=new FileDialog(this,"打开文件对话框",FileDialog.SAVE);
fd.setVisible(true);
FileOutputStream out=new FileOutputStream(fd.getDirectory()+fd.getFile()+".txt");
String str=ta.getText();
String str1=ta.getText();
for(int n=0;nstr.length();n++)
out.write((byte)str.charAt(n));
out.close();
}
public static void main(String[] args)
{
Editor f=new Editor(" 记事本程序");
//添加时间代码
Date date=new Date();
System.out.print(date);
/*Calendar now=Calendar.getInstance();
int year=now.get(Calendar.YEAR);
int month=now.get(Calendar.MONTH)+1;
int day=now.get(Calendar.DATE);
System.out.print(year+"年"+month+"月"+day+"日");
int week=now.get(Calendar.DAY_OF_WEEK);
String str="日一二三四五六";//星期1-7
int i=2*(week-1);
System.out.println("星期"+str.substring(i,i+2));//对应中文的下标*/
}
class dialog extends Dialog
{
public dialog()
{
super(dialog, "字体设置");
class Mycanvas extends Canvas
{
Toolkit tk;
Image img;
Mycanvas()
{
setSize(440,138);
tk=getToolkit();
img=tk.getImage("photo.jpg");
}
public void paint(Graphics g)
{
g.drawImage(img,5,120,440,138,this);
}
}
}
}
}
【java记事本时间代码 java记事本代码运行】java记事本时间代码的介绍就聊到这里吧 , 感谢你花时间阅读本站内容,更多关于java记事本代码运行、java记事本时间代码的信息别忘了在本站进行查找喔 。

推荐阅读