亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? 第二十章例子.txt

?? java examples,very useful
?? TXT
?? 第 1 頁 / 共 2 頁
字號(hào):
20-例子1
import java.io.*;
class Example20_1
{ public static void main(String args[])
  { int b;
  byte buffer[]=new byte[2500];
  try{ FileInputStream readfile=new FileInputStream("Example211.java");
       b=readfile.read(buffer,0,2500);
       try { String str=new String(buffer,0,b,"Default");
             System.out.println(str);
           }        
       catch(UnsupportedEncodingException e)
           { System.out.println(" the encoding was not found:"+e);
           }
     }
   catch(IOException e)
     {System.out.println("File read Error ");
     }
  }
}



20-例子2
import java.io.*;import java.awt.*;import java.awt.event.*;
class Example20_2
{  static Frame f;
   public static void main(String args[])
  { int b,j=10; TextArea text;
    byte tom[]=new byte[2500];f=new Frame();
    f.setSize(100,100);text=new TextArea(30,60);
    f.setVisible(true);f.add(text); f.pack();
    f.addWindowListener(new WindowAdapter()
      { public void windowClosing(WindowEvent e)
        {f.setVisible(false);System.exit(0);}
      }); 
   
try{ File f=new File("E:\\dd\\","AA.java");
     FileInputStream readfile=new FileInputStream(f);
         while((b=readfile.read(tom,0,j))!=-1) 
          {String s=new String (tom,0,b);
            System.out.println(s);
            text.append(s); 
          }
         readfile.close();
       }
     catch(IOException e)
       {System.out.println("File read Error ");
       }
  }
}



20-例子3
import java.io.*;
class Example20_3
{ public static void main(String args[])
  { int b;
  byte buffer[]=new byte[100];
  try{System.out.println("輸入一行文本,并存入磁盤:");
      b=System.in.read(buffer);//把從鍵盤敲入的字符存入buffer。
      FileOutputStream whritefile=new FileOutputStream("line.txt");
      whritefile.write(buffer,0,b);// 通過流把 buffer寫入到文件line.txt。
     }
   catch(IOException e)
     {System.out.println("Error ");
     }
  }
}



20-例子4
import java.applet.*;
import  java.io.*;
import java.awt.*;
import java.awt.event.*;
 class EWindow extends Frame implements ActionListener
{ TextArea text; BufferedReader in;  Button button;
  FileReader file;
   EWindow()
   {super("流的讀取");
    text=new TextArea(10,10);text.setBackground(Color.cyan);
try {File f=new File("e:/dd/","E2.html");
     file=new FileReader(f);
         in=new BufferedReader(file);
        }
    catch(FileNotFoundException e){}
    catch(IOException e){}   
    button =new Button("讀取"); 
    button.addActionListener(this);
    setLayout(new BorderLayout());
    setSize(40,40);
    setVisible(true);
    add(text,"Center");add("South",button);
    addWindowListener(new WindowAdapter()
     {public void windowClosing(WindowEvent e)
     {setVisible(false);System.exit(0); }
     });
   } 
public void actionPerformed(ActionEvent e)
  { String s;
    if(e.getSource()==button)
     try{
         while((s=in.readLine())!=null)
         text.append(s+'\n');   
         }
      catch(IOException exp){} 
  }
}
public class Example20_4
{public static void main(String args[])
 {EWindow w=new EWindow();w.pack();
 }
}




20-例子5
import java.applet.*;
import  java.io.*;
import java.awt.*;
import java.awt.event.*;
 class FWindow extends Frame implements ActionListener
{ TextArea text; BufferedWriter out;  Button button;
  FileWriter tofile;
   FWindow()
   {super("流的寫入");
    text=new TextArea(10,10);text.setBackground(Color.cyan);
    try {tofile=new FileWriter("hello.txt");
         out=new BufferedWriter(tofile);
        }
    catch(FileNotFoundException e){}
    catch(IOException e){}   
    button =new Button("寫入"); 
    button.addActionListener(this);
    setLayout(new BorderLayout());
    setSize(60,70);
    setVisible(true);
    add(text,"Center");add("South",button);
    addWindowListener(new WindowAdapter()
     {public void windowClosing(WindowEvent e)
     {setVisible(false);System.exit(0); }
     });
   } 
  
 public void actionPerformed(ActionEvent e)
  { String s;
    if(e.getSource()==button)
     try {
        out.write(text.getText(),0,(text.getText()).length());
        out.flush();
         }
     catch(IOException exp){System.out.println(" have problem");} 
  }
}
public class Example20_5
{public static void main(String args[])
 {FWindow w=new FWindow();w.pack();//用緊湊方式顯示窗口
 }
}



20-例子6
import java.util.*;import java.io.*;
import java.awt.*;import java.awt.event.*;
class EWindow extends Frame implements ItemListener,ActionListener
{ String str[]=new String[7];String s;
  FileReader file;BufferedReader in;  Button button_start;
  Checkbox box[];TextField text_word,text_fenshu;
  int fenshu=0;  CheckboxGroup age=new CheckboxGroup();
   EWindow()
   {super("英語單詞學(xué)習(xí)");
    text_fenshu=new TextField(10);text_word=new TextField(70);
    button_start=new Button("重新練習(xí)");button_start.addActionListener(this);
    try {file=new FileReader("English.txt");
         in=new BufferedReader(file);
        }
    catch(FileNotFoundException e){}
    catch(IOException e){}   
    setBounds(100,100,400,320); setVisible(true);
    setLayout(new GridLayout(5,1));setBackground(Color.pink);
    Panel p1=new Panel(),p2=new Panel(),p3=new Panel() ,p4=new Panel();
    p2.setLayout(new GridLayout(2,1)); p3.setLayout(new GridLayout(5,1)); 
    p1.add(new Label("您的得分:"));p1.add(text_fenshu);
    p2.add(new Label("句子填空:"));p2.add(text_word); 
    p4.add(button_start); box=new Checkbox[6];
    for(int i=0;i<=4;i++)
     {box[i]=new Checkbox(" ",false,age);
      box[i].addItemListener(this);
     } 
    p3.add(new Label("選擇答案:"));
    for(int i=1;i<=4;i++)
     {p3.add(box[i]);}         
     add(p1); add(p2);add(new Label()); add(p3);add(p4);
     addWindowListener(new WindowAdapter()
     {public void windowClosing(WindowEvent e)
     {setVisible(false);System.exit(0); }
     });
     reading();
   } 
public void reading()
 {int i=0; 
  try{ s=in.readLine();
       if(!(s.startsWith("endend")))
       {StringTokenizer tokenizer=new StringTokenizer(s,"#"); 
        while(tokenizer.hasMoreTokens())
         {str[i]=tokenizer.nextToken();i++;
         }
        text_word.setText(str[0]);
        for(int j=1;j<=4;j++)
        {box[j].setLabel(str[j]);
        } 
       }
      else if(s.startsWith("endend"))
       { text_word.setText("學(xué)習(xí)完畢"); 
         for(int j=1;j<=4;j++)
          {box[j].setLabel("end"); in.close();file.close();
          } 
       }
     }
  catch(IOException exp){} 
 }
public void actionPerformed(ActionEvent event)
 {if(event.getSource()==button_start)
   {file=null;in=null;fenshu=0;text_fenshu.setText("得分: "+fenshu);
    try {file=new FileReader("English.txt");
         in=new BufferedReader(file);
        }
    catch(FileNotFoundException e){}
    catch(IOException e){}  
    reading(); 
   }
 }
public void itemStateChanged(ItemEvent e)
 { for(int j=1;j<=4;j++)
   { if(box[j].getLabel().equals(str[5])&&box[j].getState())
      {fenshu++;text_fenshu.setText("得分: "+fenshu);
      }
   }
  reading();
 }
}
public class Example20_6
{public static void main(String args[])
 {EWindow w=new EWindow();w.pack();
 }
}



20-例子7
import java.awt.*;import java.io.*;
import java.awt.event.*;
public class Example20_7
{public static void main(String args[])
 { Frame_FileDialog f=new Frame_FileDialog(); }
}
class  Frame_FileDialog extends Frame implements ActionListener
{ FileDialog filedialog_save,filedialog_load;//聲明2個(gè)文件對(duì)話框
  MenuBar menubar;Menu menu;MenuItem item1,item2;TextArea text;
  BufferedReader in;  
  FileReader file_reader;
  BufferedWriter out; 
  FileWriter tofile;
  Frame_FileDialog()
 {  super("帶文件對(duì)話框的窗口");     
    setSize(60,70);               
    setVisible(true);    
    menubar=new MenuBar();   
    menu=new Menu("文件"); 
    item1=new MenuItem("打開文件");
    item2=new MenuItem("保存文件"); 
    item1.addActionListener(this); 
    item2.addActionListener(this);
    menu.add(item1);
    menu.add(item2); 
    menubar.add(menu);  
    setMenuBar(menubar);        
    //下面創(chuàng)建1個(gè)依賴于該窗口的保存文件對(duì)話框
    filedialog_save=new FileDialog(this,"保存文件話框",FileDialog.SAVE);
    filedialog_save.setVisible(false);
    //再創(chuàng)建1個(gè)依賴于該窗口的打開文件對(duì)話框
    filedialog_load=new FileDialog(this,"打開文件話框",FileDialog.LOAD);
    filedialog_load.setVisible(false);
    filedialog_save.addWindowListener(new WindowAdapter()//對(duì)話框增加適配器
     {public void windowClosing(WindowEvent e)
     {filedialog_save.setVisible(false);}
     });
    filedialog_load.addWindowListener(new WindowAdapter()//對(duì)話框增加適配器
     {public void windowClosing(WindowEvent e)
     {filedialog_load.setVisible(false);}
     });
    addWindowListener(new WindowAdapter()  //窗口增加適配器
     {public void windowClosing(WindowEvent e)
     {setVisible(false);System.exit(0);}
     });
    text=new TextArea(10,10);text.setBackground(Color.cyan);
    add(text,"Center");
 }
 public void actionPerformed(ActionEvent e) //實(shí)現(xiàn)接口中的方法
  { if(e.getSource()==item1)
    {  filedialog_load.setVisible(true);String s;
      try {//建立到文件file的FileReader流,該文件通過File類和對(duì)話框來確定
                        File file=new File(filedialog_load.getDirectory(),filedialog_load.getFile());
           file_reader=new FileReader(file);
           in=new BufferedReader(file_reader);
           while((s=in.readLine())!=null)
           text.append(s+'\n'); 
          }
    catch(FileNotFoundException e1){}
    catch(IOException e2){}
     try {in.close();
          file_reader.close();
         }
     catch(IOException exp){} 
    }
  else if(e.getSource()==item2)
    { filedialog_save.setVisible(true);
       try {//建立到文件file的FileWtiter流,該文件通過File類和對(duì)話框來確定
                      File file=new File(filedialog_save.getDirectory(),filedialog_save.getFile());
           tofile=new FileWriter(file);
           out=new BufferedWriter(tofile);
           out.write(text.getText(),0,(text.getText()).length());
           out.flush();
          }
    catch(FileNotFoundException e1){}
    catch(IOException e2){}
     try {out.close();
          tofile.close();
         }
     catch(IOException exp){} 
    }
  } 
}


20-例子8
import java.awt.*;import java.io.*;
import java.awt.event.*;
public class Example20_8
{public static void main(String args[])
 { Frame_FileDialog f=new Frame_FileDialog(); }
}
class  Frame_FileDialog extends Frame implements ActionListener
{ FileDialog filedialog_load;//聲明文件對(duì)話框
  MenuBar menubar;Menu menu;MenuItem item;
  Frame_FileDialog()
 {  super("帶文件對(duì)話框的窗口"); 
  setSize(60,70);               
  setVisible(true);    
  menubar=new MenuBar();   
  menu=new Menu("文件"); 
  item=new MenuItem("運(yùn)行可執(zhí)行文件");
  item.addActionListener(this); 
  menu.add(item);
  menubar.add(menu);  
  setMenuBar(menubar);        
  filedialog_load=new FileDialog(this,"打開文件話框",FileDialog.LOAD);
  filedialog_load.setVisible(false);
  filedialog_load.addWindowListener(new WindowAdapter()  
   {public void windowClosing(WindowEvent e)
     {filedialog_load.setVisible(false);}
     });
    addWindowListener(new WindowAdapter()  
     {public void windowClosing(WindowEvent e)
     {setVisible(false);System.exit(0);}
     });
}
 public void actionPerformed(ActionEvent e) //實(shí)現(xiàn)接口中的方法
  { if(e.getSource()==item)
    {  filedialog_load.setVisible(true);
      try 
{File file=
 new File(filedialog_load.getDirectory(),filedialog_load.getFile());
         Runtime ce=Runtime.getRuntime();
         ce.exec(file.toString());//把file用字符串表示,所有對(duì)象都能使用
                                 //toString()
        }
        catch(FileNotFoundException e1){}
        catch(IOException e2){}
    }
  } 
}



20-例子9
import java.io.*;
public class Example20_9
{public static void main(String args[])
 {RandomAccessFile in_and_out=null;
 int data[]={124,389,33,256,-90,34,21,7,100,25};
 try{in_and_out=new RandomAccessFile("tom.dat","rw");}
 catch(FileNotFoundException e){System.out.println("PPPP?????");}
 try{for(int i=0;i<data.length;i++)
    {in_and_out.writeInt(data[i]);
    } 
  for(long i=data.length-1;i>=0;i--)//一個(gè)int型數(shù)據(jù)占4個(gè)字節(jié),我們從
  {in_and_out.seek(i*4);               //文件的第36個(gè)字節(jié)讀取最后面的一個(gè)整數(shù),
  System.out.print(","+in_and_out.readInt());//每隔4個(gè)字節(jié)往前讀取一個(gè)整數(shù)。
   }
 in_and_out.close();
  }
 catch(IOException e){System.out.println("??????");} 
 }
}



20-例子10
import  java.io.*;
class Example20_10 
{ public static void main(String args[])
 { try{
  RandomAccessFile file=new RandomAccessFile("Example20_10.java","rw");
  long filePoint=0;
  long fileLength=file.length();
  while(filePoint<fileLength)
  {String s=file.readLine();
   System.out.println(s);
   filePoint=file.getFilePointer();
   }
  file.close();
  }
  catch(Exception e){}
 }
}



20-例子11
import  java.io.*;
class Example20_11 
{ public static void main(String args[])
 { PipedOutputStream  out=null;
   PipedInputStream  in=null;
  try
   { out=new PipedOutputStream();
     in=new PipedInputStream();
     in.connect(out); 

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91色婷婷久久久久合中文| 夜夜亚洲天天久久| 精品国产一区二区三区忘忧草| 欧美日韩激情在线| 一本到不卡精品视频在线观看| 国产99久久久国产精品免费看| 国产综合久久久久影院| 五月天亚洲精品| 亚洲欧美电影院| 亚洲精品中文在线观看| 亚洲欧洲中文日韩久久av乱码| 日韩美女视频一区二区 | 狠狠色丁香婷婷综合| 久久99精品久久久久久| 国精产品一区一区三区mba桃花 | 中文字幕一区二区三区乱码在线| 久久久久久久久久久久久夜| 久久久久亚洲蜜桃| 中文字幕+乱码+中文字幕一区| 国产精品理伦片| 亚洲精品国产一区二区精华液| 一区二区三区四区蜜桃| 三级成人在线视频| 青草av.久久免费一区| 国产一区福利在线| 91亚洲精品乱码久久久久久蜜桃| eeuss国产一区二区三区| 97久久久精品综合88久久| 色婷婷激情久久| 欧美一级免费大片| 久久精品视频一区| 亚洲精品美腿丝袜| 精品夜夜嗨av一区二区三区| 色综合久久综合中文综合网| 欧美性色综合网| av不卡在线播放| 欧美日韩免费高清一区色橹橹 | 中文字幕一区二区三区色视频| 亚洲一区在线视频| 国产主播一区二区三区| 色婷婷久久综合| 久久综合九色综合97婷婷| 亚洲欧美区自拍先锋| 美国毛片一区二区| 欧美中文一区二区三区| 日韩欧美一级二级三级| 18成人在线观看| 国产精品自拍av| 欧美肥妇free| 亚洲一区在线观看免费观看电影高清 | 精品视频1区2区| 久久久www免费人成精品| 亚洲最新视频在线观看| 国内精品伊人久久久久av影院 | 日本不卡视频一二三区| 9久草视频在线视频精品| 欧美一级一级性生活免费录像| 亚洲国产成人私人影院tom| 亚洲123区在线观看| 丁香桃色午夜亚洲一区二区三区| 51精品国自产在线| 亚洲一区二区三区四区在线 | 中文字幕日韩欧美一区二区三区| 另类小说综合欧美亚洲| 欧洲亚洲精品在线| 中文字幕一区二区三区在线不卡| 久草热8精品视频在线观看| 一本大道av伊人久久综合| 欧美国产日韩亚洲一区| 国产一区欧美一区| 久久久午夜精品| 国产麻豆视频一区| 久久久久9999亚洲精品| 国产毛片精品视频| 国产三级三级三级精品8ⅰ区| 麻豆精品视频在线观看| 日韩欧美黄色影院| 另类小说色综合网站| 日韩精品影音先锋| 国产麻豆视频一区| 中文字幕乱码亚洲精品一区| 成人一区在线看| 18成人在线观看| 欧美性猛交一区二区三区精品 | 久久精品理论片| 欧美一激情一区二区三区| 捆绑调教美女网站视频一区| 2024国产精品| 成人国产在线观看| 亚洲人成精品久久久久久| 欧美午夜视频网站| 麻豆极品一区二区三区| 国产亚洲精品超碰| 一本久久综合亚洲鲁鲁五月天| 亚洲午夜精品一区二区三区他趣| 欧美一区日韩一区| 国产精品一卡二| 一区二区三区在线观看动漫| 欧美美女bb生活片| 国产福利精品一区| 一区二区三区四区在线播放| 欧美理论片在线| 国产伦精品一区二区三区免费 | 久久久一区二区三区| 成人国产精品免费观看动漫| 亚洲电影一级黄| 国产欧美一区二区三区网站| 欧美自拍丝袜亚洲| 国产综合一区二区| 亚洲午夜视频在线观看| 亚洲精品在线观看网站| 91麻豆免费看| 国产真实乱对白精彩久久| 亚洲欧美色综合| 久久午夜色播影院免费高清| 91久久精品一区二区三| 国产精品99久久不卡二区| 夜夜嗨av一区二区三区网页| 久久久不卡网国产精品二区| 欧美日韩在线免费视频| 成人午夜在线播放| 麻豆精品一区二区三区| 亚洲一区国产视频| 国产精品国产馆在线真实露脸| 日韩欧美一区二区免费| 色婷婷久久久综合中文字幕| 豆国产96在线|亚洲| 毛片av一区二区| 亚洲不卡av一区二区三区| 国产精品福利一区| 久久免费视频色| 欧美成人性战久久| 欧美日韩视频一区二区| 色偷偷成人一区二区三区91| 成人小视频免费在线观看| 狠狠狠色丁香婷婷综合激情| 日韩国产欧美在线观看| 亚洲福利电影网| 一区二区三区日韩精品| 18成人在线视频| 最新日韩av在线| 国产精品电影院| 日本一区二区免费在线观看视频 | 国产精品无人区| 精品国产91久久久久久久妲己| 欧美高清视频在线高清观看mv色露露十八| jiyouzz国产精品久久| 成人黄页在线观看| 成人激情免费电影网址| voyeur盗摄精品| 99久久精品免费| 91小宝寻花一区二区三区| 波多野结衣在线aⅴ中文字幕不卡| 国产精品一线二线三线精华| 国产美女主播视频一区| 国产成人亚洲精品青草天美| 国产v日产∨综合v精品视频| 国产精品自在在线| 成人国产视频在线观看| 成人免费的视频| 色综合久久久网| 在线欧美日韩精品| 欧美乱妇15p| 精品福利一区二区三区| 精品国产一区二区三区忘忧草| 久久久九九九九| 亚洲欧洲中文日韩久久av乱码| 亚洲综合色婷婷| 日韩1区2区日韩1区2区| 国产一区高清在线| 色一情一乱一乱一91av| 欧美日韩精品一区二区在线播放| 日韩一区二区不卡| 国产精品视频免费看| 一区二区三区日韩精品| 蜜桃一区二区三区在线| 国产成人亚洲综合色影视| 在线观看国产一区二区| 日韩精品一区二区三区在线| 中文久久乱码一区二区| 亚洲电影中文字幕在线观看| 精油按摩中文字幕久久| 99国产麻豆精品| 精品乱码亚洲一区二区不卡| 国产精品美女久久久久久| 午夜精品久久久久| 成人性生交大片免费看在线播放| 在线观看不卡视频| 久久久久久久精| 香蕉av福利精品导航| 国产不卡视频在线播放| 制服丝袜日韩国产| 中文字幕一区三区| 国内外成人在线| 欧美精品久久天天躁| 亚洲视频一二区| 国精产品一区一区三区mba视频| 色欧美88888久久久久久影院| 亚洲精品在线三区| 男人的天堂亚洲一区|