Source code: com/fm/feedMan.java
1 /****************************************************************************
2 * Copyright (c) 2003 Andrew Duka | aduka@users.sourceforge.net
3 * All right reserved.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 ****************************************************************************/
11 package com.fm;
12
13 import com.fm.rss.channelStorageFactory;
14 import com.fm.rss.ChannelStorage;
15 import com.fm.rss.rssParseException;
16 import com.fm.gui.fmFrame;
17
18 import javax.swing.*;
19 import java.util.Properties;
20 import java.io.FileInputStream;
21 import java.io.File;
22 import java.io.FileNotFoundException;
23 import java.io.IOException;
24
25 /**
26 * Main class
27 */
28 public class feedMan
29 {
30 public static void main(String[] args)
31 {
32 channelStorageFactory storageFactory = channelStorageFactory.newInstance();
33 ChannelStorage storage = storageFactory.newStorageInstance();
34
35 Properties p = new Properties();
36
37 // LOADING PROPERTIES FIRST
38 try
39 {
40 p.load(new FileInputStream(new File(".","fm.ini")));
41 if (p.containsKey("DEFAULT_INI_FILE") == false) {
42 p.put("DEFAULT_INI_FILE", "fm.ini");
43 }
44 }
45 catch (FileNotFoundException fnfe)
46 {
47 p.setProperty("DEFAULT_INI_FILE","fm.ini");
48 }
49 catch (IOException e)
50 {
51 e.printStackTrace();
52 }
53
54 // LOADING DEFAULT STORAGE
55 try
56 {
57 storage.setParamValue(ChannelStorage.SOURCE, storage.getDefaultSource());
58 storage.load();
59 }
60 catch (rssParseException e)
61 {
62 e.printStackTrace();
63 }
64 catch (IOException ioe)
65 {
66 ioe.printStackTrace();
67 }
68
69
70 try {
71 UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
72 }
73 catch (Exception e) {
74 System.err.println("Can't set default look and feel: " + e.toString());
75 System.exit(0);
76 }
77
78 fmFrame f = new fmFrame(storage,p);
79 f.pack();
80 f.setVisible(true);
81 }
82
83 }