public Analyst(String arg0) {
        super(applicationName+ " - " + ADocument.DEFAULT_TITLE);
  
        
        addWindowListener(this);
        setMinimumSize(new Dimension(600,400));
        setPreferredSize(new Dimension(1000,700));
        //Create the text pane and configure it.
        textPane = new JTextPane();
        // Replace the built-in  behavior when the caret highlight
        // becomes invisible when focus moves to another component
        textPane.setCaret(
        	    new DefaultCaret(){
        			public void focusLost(FocusEvent e){};
        		}
        	);
        // popup menu for the textPane
        popupMenu = new JPopupMenu();
        
        textPane.setCaretPosition(0);
        //textPane.setMargin(new Insets(5,5,5,5));
        textPane.setMinimumSize(new Dimension(400,100));
        
        
        // binding the popup menu for textPane
        Toolkit.getDefaultToolkit().getSystemEventQueue().push(new MyEventQueue()); 
        

        fc = new JFileChooser();
        fc.addChoosableFileFilter( new FileNameExtensionFilter("Файлы ."+extension, extension));
        optionPane = new JOptionPane();
        aDoc = new ADocument();
        textPane.setEditorKit(new AEditorKit());
        textPane.setDocument(aDoc);
        
    
        if (aDoc instanceof AbstractDocument) {
            doc = (AbstractDocument)aDoc;
            doc.setDocumentFilter(new DocumentSizeFilter(MAX_CHARACTERS));
        } else {
            System.err.println("Text pane's document isn't an AbstractDocument!");
            System.exit(-1);
        }
        JScrollPane scrollPane = new JScrollPane(textPane);
        scrollPane.setPreferredSize(new Dimension(600, 500));
        scrollPane.setMinimumSize(new Dimension(400,250));
        
        
        //Create the text area for the status log and configure it.
        commentField = new JTextArea (5, 30) ;
        commentField.setEditable(false);
        commentField.setLineWrap(true);
        commentField.setWrapStyleWord(true);
        commentField.setMaximumSize(new Dimension(400,30));
        
        JScrollPane scrollPaneForComment = new JScrollPane(commentField);
        scrollPaneForComment.setMinimumSize(new Dimension(400,30));
        scrollPaneForComment.setMaximumSize(new Dimension(400,30));
        scrollPaneForComment.setPreferredSize(new Dimension(400,30));
        
        //Create a split pane for the change log and the text area.
        JSplitPane splitPaneV = new JSplitPane(
                                       JSplitPane.VERTICAL_SPLIT,
                                       scrollPane, scrollPaneForComment);
        splitPaneV.setOneTouchExpandable(false);
 
        //Create the status area.
        JPanel statusPane = new JPanel(new BorderLayout() ); // GridLayout(1, 2));
        status =
                new StatusLabel("Откройте сохраненный документ или вставтьте анализируемый текст в центральное окно");
        progress = new JProgressBar(0,100);
        progress.setSize(new Dimension(300,30));
        
        progress.setVisible(false);
        statusPane.add(status, BorderLayout.WEST);
        statusPane.add(progress, BorderLayout.CENTER);
        
        // Create tabbed navigation pane

        navigateTree 	= new ATree (aDoc);
        analisysTree 	= new BTree (aDoc);
        hystogramTree	= new CTree (aDoc);
        navigateTabs = createTabPane();
        
        JSplitPane splitPaneH = new JSplitPane(
                JSplitPane.HORIZONTAL_SPLIT,
                navigateTabs, splitPaneV);
        splitPaneH.setOneTouchExpandable(true);
        
        
        //Add the control panels.
        controlsPane = new ControlsPane();
        controlsPane.bindToTextPane(textPane, aDoc, commentField);

        textPane.addCaretListener(controlsPane);
        controlsPane.addADataListener(controlsPane);
        controlsPane.addADataListener(status);
        navigateTree.addTreeSelectionListener(controlsPane);
        analisysTree.addTreeSelectionListener(controlsPane);
        
        commentField.getCaret().addChangeListener((ChangeListener)controlsPane);

        JScrollPane scrollPaneControls = new JScrollPane(controlsPane);
        scrollPaneControls.setMinimumSize(new Dimension(300,500));     
        scrollPaneControls.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
        
        
        //getContentPane().add(navigateTabs, BorderLayout.WEST);
        JPanel allButToolbar = new JPanel();
        
        getContentPane().add(splitPaneH, BorderLayout.CENTER);
        getContentPane().add(statusPane, BorderLayout.SOUTH);
        
        
        controlsPane.setMargin(new Insets(1,1,1,1));
        controlsPane.setBorderPainted(true);
        
        
        //getContentPane().setLayout(new BorderLayout());
        //getContentPane().add(allButToolbar, BorderLayout.CENTER);
        getContentPane().add(controlsPane, BorderLayout.EAST);
    
       
        
        //Set up the menu bar.
        actions=createActionTable(textPane);
        JMenu fileMenu = createFileMenu();
        JMenu editMenu = createEditMenu();
        JMenu styleMenu = createStyleMenu();
        JMenu settingsMenu = createSettingsMenu();
        JMenu infoMenu = createInfoMenu();
        JMenuBar mb = new JMenuBar();
        
        mb.add(fileMenu);
        mb.add(editMenu);
        mb.add(styleMenu);
        mb.add(settingsMenu);
        mb.add(infoMenu);
        setJMenuBar(mb);

        //Add some key bindings.
        addBindings();
        
        textPane.setCaretPosition(0);

        //Start watching for undoable edits and caret changes.
        doc.addUndoableEditListener(new MyUndoableEditListener());
        textPane.addCaretListener(status);
        doc.addDocumentListener(new MyDocumentListener());
        
        // load document passed in the command line
        if (arg0 != null){
        	 File file = new File (arg0);
        	 FileInputStream fis;
			try {
				fis = new FileInputStream(file);
			
    		 ProgressWindow pw = new ProgressWindow(frame, "    Идет загрузка файла...   ");
    		 aDoc.load(fis, pw);
    		 
			 fileName = file.getAbsolutePath();
 	 	
		   	status.setText("");
		   	frame.setTitle(applicationName + " - "+ file.getName());
		   	
			} catch (Exception e1) {
				System.out.println("Ошибка при загрузке файла: " + arg0);
				e1.printStackTrace();
			}
        	
        }
    }