.. | .. |
---|
72 | 72 | public JMenuBar TimeFlowWindow(Container container) throws HeadlessException |
---|
73 | 73 | { |
---|
74 | 74 | // read example directory |
---|
75 | | - String[] ex = getVisibleFiles("settings/examples"); |
---|
| 75 | + String[] ex = getVisibleFiles("timeflow/settings/examples"); |
---|
76 | 76 | int n = ex.length; |
---|
77 | 77 | examples = new String[n][2]; |
---|
78 | 78 | for (int i = 0; i < n; i++) |
---|
.. | .. |
---|
82 | 82 | if (dot >= 0 && dot < s.length() - 1); |
---|
83 | 83 | s = s.substring(0, dot); |
---|
84 | 84 | examples[i][0] = s; |
---|
85 | | - examples[i][1] = "settings/examples/" + ex[i]; |
---|
| 85 | + examples[i][1] = "timeflow/settings/examples/" + ex[i]; |
---|
86 | 86 | } |
---|
87 | 87 | |
---|
88 | | - templates = getVisibleFiles("settings/templates"); |
---|
| 88 | + templates = getVisibleFiles("timeflow/settings/templates"); |
---|
89 | 89 | fileChooser = new JFileChooser(state.getCurrentFile()); |
---|
90 | 90 | |
---|
91 | 91 | container.setLayout(new BorderLayout()); |
---|
.. | .. |
---|
554 | 554 | } |
---|
555 | 555 | try |
---|
556 | 556 | { |
---|
557 | | - final File f = new File(fileName); |
---|
| 557 | + final File f = new File(TimeflowApp.class.getClassLoader().getResource(fileName).toURI()); |
---|
558 | 558 | ActDB db = importer.importFile(f); |
---|
559 | 559 | model.setDB(db, fileName, readOnly, TimeflowApp.this); |
---|
560 | 560 | if (!readOnly) |
---|
.. | .. |
---|
693 | 693 | |
---|
694 | 694 | static String[] getVisibleFiles(String dir) |
---|
695 | 695 | { |
---|
696 | | - String[] s = new File(dir).list(); |
---|
697 | | - ArrayList<String> real = new ArrayList<String>(); |
---|
698 | | - for (int i = 0; i < s.length; i++) |
---|
| 696 | + System.out.println("getVisibleFiles = " + dir); |
---|
| 697 | + try |
---|
699 | 698 | { |
---|
700 | | - if (!s[i].startsWith(".")) |
---|
| 699 | + String[] s = new File(TimeflowApp.class.getClassLoader().getResource(dir).toURI()).list(); |
---|
| 700 | + ArrayList<String> real = new ArrayList<String>(); |
---|
| 701 | + for (int i = 0; i < s.length; i++) |
---|
701 | 702 | { |
---|
702 | | - real.add(s[i]); |
---|
| 703 | + if (!s[i].startsWith(".")) |
---|
| 704 | + { |
---|
| 705 | + real.add(s[i]); |
---|
| 706 | + } |
---|
703 | 707 | } |
---|
| 708 | + return (String[]) real.toArray(new String[0]); |
---|
704 | 709 | } |
---|
705 | | - return (String[]) real.toArray(new String[0]); |
---|
| 710 | + catch (Exception e) |
---|
| 711 | + { |
---|
| 712 | + return new String[0]; |
---|
| 713 | + } |
---|
706 | 714 | } |
---|
707 | 715 | } |
---|