View Javadoc

1   /*
2    *    This program is free software; you can redistribute it and/or modify
3    *    it under the terms of the GNU General Public License as published by
4    *    the Free Software Foundation; either version 2 of the License, or
5    *    (at your option) any later version.
6    *
7    *    This program is distributed in the hope that it will be useful,
8    *    but WITHOUT ANY WARRANTY; without even the implied warranty of
9    *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10   *    GNU General Public License for more details.
11   *
12   *    You should have received a copy of the GNU General Public License
13   *    along with this program; if not, write to the Free Software
14   *    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
15   */
16  
17  
18  package jr239.co620;
19  
20  
21  import weka.gui.LogPanel;
22  
23  import java.awt.Color;
24  import javax.swing.ImageIcon;
25  import javax.swing.JFrame;
26  
27  import org.apache.log4j.xml.DOMConfigurator;
28  
29  
30  
31  
32  /**
33   *
34   * @author jar
35   */
36  public class Main {
37  
38     protected static Main getInstance(){
39           synchronized(Main.class) {
40               
41               if (singleInstace == null){
42                   singleInstace = new Main();
43                   setLogging();
44                   setOutputPanel();
45                    ACOjoinedAttrbSearch.getInstance();
46                    ACOjoinedAttrbSearch.startSearch(wl);
47              }
48         }
49           
50           return singleInstace;
51      }
52      //
53      
54      
55      
56      public  static  void main (String[] args ){
57  	
58  	Main inst = getInstance();
59      }
60      
61     /** ===================== private side  ============================ **/ 
62     private Main(){}
63    private static void setLogging(){
64  	String resourceXml = system+"co620log4Properties.xml";
65         	DOMConfigurator.configure( resourceXml);
66  	
67      }
68    
69    private static void setOutputPanel(){
70        java.net.URL imgURL = Main.class.getResource("icons/b.png"); 
71       JFrame.setDefaultLookAndFeelDecorated(true);
72       frame = new JFrame("ACOjoinedAttrbSearch");
73      //Set the frame icon to an image loaded from a file.
74       frame.setIconImage(new ImageIcon(imgURL).getImage());
75       Color bg = new Color(0.7f,0.8f, 0.8f), fg = new Color(0.9f,0.99f, 1.0f);
76       wl.setBackground(bg);
77       wl.setForeground(fg);
78       frame.add(wl);
79       frame.setLocationRelativeTo(null);
80       frame.pack();
81       frame.setExtendedState(frame.getExtendedState()|JFrame.MAXIMIZED_BOTH);
82       frame.setVisible(true);
83       //wl.logMessage("creAted\n");
84       frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
85    }
86    
87    
88    /** **/
89    
90     protected static String projectResources = "resources/";
91     protected static String data= projectResources +"dataSets/";
92     protected static String system =  projectResources + "system/";
93    
94      /** -------------------------------- private fields  ----------------------------------------- **/
95    private static LogPanel wl =new LogPanel();
96    private static JFrame frame ;
97    
98    private static volatile Main singleInstace = null;
99      
100 }//
101 //end of class