How can I use alignment viewer in my programs?


I want to use alignment viewing capability and other features of Jalview
in my programs. For this, i create new classes encapsulation necessary Jalview
components. However i have hard time to decide which components
to use and what to change. Below is an example of my way of using Jalview.
I will be glad if someone points out the steps of doing this right.


import jalview.datamodel.Alignment;
import jalview.gui.AlignFrame;

import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import javax.swing.JFrame;

* Test to see if i can use Jalview's alignment displayer
* independently.
public class JalviewTest
    public static void main(String[] args)
        JalviewTest test = new JalviewTest();
       private void createAndShowGUI()
        JalviewFrame frame = new JalviewFrame(new File("C:\\HDV.aln")); frame.pack();
        frame.addWindowListener(new WindowAdapter()
            public void windowClosing(WindowEvent e)

    class JalviewFrame extends JFrame
        AlignFrame alignFrame ; File alignmentFile ;
               private static final long serialVersionUID = 1L;
               public JalviewFrame(File file)
            alignmentFile = file;

        private void init()
            AlignFile afile = null;
                afile = new ClustalFile(alignmentFile.getAbsolutePath(),"File");
            } catch (IOException e)
                       Alignment alignment = new Alignment(afile.getSeqsAsArray()); afile.addAnnotations(alignment); alignFrame = new AlignFrame(
            this.setJMenuBar(alignFrame.getJMenuBar()); }