scanlog.java

来自「用Java开发的学生信息管理系统」· Java 代码 · 共 67 行

JAVA
67
字号
package studentsystem;import javax.swing.*;import java.awt.*;import java.io.*;import java.awt.event.*;/** * <p>Title: </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2006</p> * <p>Company: </p> * @download by http://www.codefans.net * @author not attributable * @version 1.0 */public class scanLog extends JFrame {  JScrollPane jScrollPane1 = new JScrollPane();  JTextPane xs = new JTextPane();  String str;  int b;  byte buffer[]=new byte[2500];  public scanLog() {    try {      jbInit();    }    catch(Exception e) {      e.printStackTrace();    }                 try                 {FileInputStream readfile=new FileInputStream("log.txt");                         b=readfile.read(buffer,0,2500);                         try                         { str=new String(buffer,0,b,"default");                               xs.setText(str);                                 }                                 catch(UnsupportedEncodingException e)                                 {                                         //System.out.println("the encoding was not found :"+e);                                 }                         }                         catch(IOException e)                         {System.out.println("File read Error");                         }  }  private void jbInit() throws Exception {    this.setResizable(false);    this.setTitle("查看日志");    this.getContentPane().setLayout(null);    jScrollPane1.setBounds(new Rectangle(18, 32, 449, 333));    this.getContentPane().add(jScrollPane1, null);    this.setBounds(200,200,600,400);    this.setVisible(true);  }public static void main(String[] args) {    scanLog scanLog = new scanLog();  }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?