内容发布更新时间 : 2024/11/6 9:25:43星期一 下面是文章的全部内容请认真阅读。
return; }
if(strCmd.equals(\查找\ { findD.setVisible(true); }
if(strCmd.equals(\替换\ {
findD.setVisible(true); }
if(strCmd.equals(\插入时间\ {
text.setText(text.getText()+date); }
if(strCmd.equals(\确定\ {
String s1=\ int s;
s1=c1.getSelectedItem(); Str1=s1;
System.out.print(s1); s2=c2.getSelectedItem(); if(s2.equals(\粗体\
21
s=1;
else if(s2.equals(\斜体\ s=2;
else if(s2.equals(\粗体与斜体\ s=3; else s=0; Str2=s2;
s3=c3.getSelectedItem();
text.setFont(new Font(s1,s,Integer.parseInt(s3))); Str3=s3;
d.setVisible(false); }
if(strCmd.equals(\取消\ {
d.setVisible(false); }
if(strCmd.equals(\关于\ {
About.setVisible(true); }
if(strCmd.equals(\自动换行\
22
{
}
text.setLineWrap(true);
}
public void openFile() throws IOException {
String str1=\ int n=0; Color c;
FileDialog fd=new FileDialog(this,\打开对话框\ fd.setVisible(true);
File file=new File(fd.getDirectory()+fd.getFile()); str1=(fd.getFile()).substring(0,(fd.getFile()).length()-4); File fStyle=new File(fd.getDirectory()+str1+\ FileReader fileReader=new FileReader(fStyle);
BufferedReader br=new BufferedReader(fileReader,4096); while((str2=br.readLine())!=null) {
string+=str2;
}
br.close();
23
System.out.println(string);
StringTokenizer str3=new StringTokenizer(string,\ String []str4=new String[6]; while(str3.hasMoreTokens()) {
str4[n]=str3.nextToken(); n++; }
System.out.print(str4[0]); Str1=str4[0]; Str2=str4[1]; Str3=str4[2];
Red=Integer.parseInt(str4[3]); Green=Integer.parseInt(str4[4]); Blue=Integer.parseInt(str4[5]); c=new Color(Red,Green,Blue); text.setForeground(c); if(Str2.equals(\粗体\ {
temp=1; }
if(Str2.equals(\斜体\
24
{
temp=2; }
if(Str2.equals(\粗体与斜体\ {
temp=3; }
if(Str2.equals(\普通\ {
temp=0; }
FileReader fr=new FileReader(file);
BufferedReader bufr=new BufferedReader(fr,4096); text.setText(\ String texts=\
while((s=bufr.readLine())!=null) {
text.setFont(new Font(Str1,temp,Integer.parseInt(Str3))); texts+=s+\ }
text.setText(texts); bufr.close();
25