View Javadoc

1   package org.opensync.engine.admin.gui;
2   
3   import java.awt.CardLayout;
4   import java.net.URL;
5   
6   import javax.swing.BorderFactory;
7   import javax.swing.ImageIcon;
8   import javax.swing.JFrame;
9   import javax.swing.JPanel;
10  import javax.swing.JScrollPane;
11  import javax.swing.JTextPane;
12  import javax.swing.border.Border;
13  
14  /***
15   *
16   * @version	1.0
17   * @author	SOFTMED
18   *
19   */
20  
21  public class LogFileFrm extends JFrame{
22    JPanel panel = new JPanel();
23    JTextPane textPanel = new JTextPane();
24    JScrollPane scrollPane = new JScrollPane();
25    Border border;
26  
27    /***
28     * @param	filePath ?task?
29     * @param	log
30     */
31    public LogFileFrm(String filePath) {
32      super(filePath);
33      try {
34        border = BorderFactory.createEmptyBorder(10,10,10,10);
35        textPanel.setBorder(border);
36        textPanel.setPage(
37          new URL("file:" + filePath)
38        );
39        textPanel.setEditable(false);
40        panel.setLayout(new CardLayout());
41        panel.add(scrollPane,"");
42        scrollPane.getViewport().add(textPanel,null);
43        getContentPane().add(scrollPane);
44        setSize(700,400);
45        setIconImage(
46          new ImageIcon(LogFileFrm.class.getResource("/images/log.gif")).getImage()
47        );
48      }
49      catch (Exception ex) {
50        ex.printStackTrace();
51      }
52    }
53  }