Debian Codegraph @

display/src/amap/AmapDisplay.java

raw
1
2 //============================================================================
3 //
4 // file: AmapDisplay.java
5 //
6 // Copyright (c) 2007, Michael E. Smoot
7 //
8 // This program is free software; you can redistribute it and/or modify it
9 // under the terms of the GNU General Public License as published by the
10 // Free Software Foundation; either version 2 of the License, or (at your
11 // option) any later version.
12 //
13 // This program is distributed in the hope that it will be useful, but
14 // WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15 // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 // for more details.
17 //
18 // You should have received a copy of the GNU General Public License along
19 // with this program; if not, write to the Free Software Foundation, Inc.,
20 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 //
22 //============================================================================
23
24 package amap;
25
26 import java.io.*;
27 import java.util.*;
28 import javax.swing.*;
29 import java.awt.Dimension;
30
31 public class AmapDisplay {
32
33 public static void main(String[] args) {
34
35 if ( args.length != 1 ) {
36 System.out.println("USAGE: java -jar amapDisplay.jar <input file>");
37 System.exit(1);
38 }
39
40 try {
41 FileInputStream fis = new FileInputStream(args[0]);
42 AmapReader ar = new AmapReader(fis);
43
44 List<Alignment> aligns = ar.getAlignments();
45
46 final JFrame frame = new JFrame("AMAP Display");
47 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
48
49 JMenuBar menuBar = new JMenuBar();
50 JMenu fileMenu = new JMenu("File");
51 menuBar.add(fileMenu);
52 JMenuItem saveAsFasta = new JMenuItem( new SaveAsFastaAction(frame) );
53 fileMenu.add(saveAsFasta);
54
55 frame.setJMenuBar(menuBar);
56
57
58 AmapPanel panel = new AmapPanel(aligns);
59 panel.setPreferredSize( new Dimension(700,700) );
60
61 //Display the window.
62 frame.setContentPane(panel);
63 frame.pack();
64 frame.setVisible(true);
65 } catch (Exception ioe) {
66 ioe.printStackTrace();
67 }
68
69 }
70 }