1    /*
2    Copyright 2000 by Ralph Hartley
3    This software is licenced under the terms of the
4    Gnu Public Licence
5    */
6    import java.io.*;
7    import java.awt.event.*;
8    
9    public class LibrarySymbol extends LibraryItem {
10   
11     Symbol sym = null;
12   
13     public LibrarySymbol(File file,LibraryUser user) {
14       super(file,user);
15       if (icon==null && iconsym==null)
16         iconsym = getSymbol();
17       setView();
18     }
19   
20     public Symbol getSymbol() {
21       try {
22         if (sym==null)
23           sym = (Symbol)(new ObjectInputStream(new FileInputStream(file))).readObject();
24       } catch (Exception e) {panic(e);}
25       return(sym);
26     }
27   
28     public void actionPerformed(ActionEvent e) {
29       getSymbol();
30       if (sym!=null)
31         user.libSymbol(sym); 
32     }
33   }
34   
35