undoF.addEdit(evt.getEdit());  if (jframe.getTabbed().getComponentCount()!=0  && jframe.getCurrentFilename().indexOf("*")==-1){ jframe.getTabbed().setTitleAt( jframe.getTabbed().getSelectedIndex(), jframe.getCurrentFilename()+"*"); }
undoF.addEdit(evt.getEdit());  if (jframe.getTabbed().getComponentCount()!=0  && jframe.getCurrentFilename().indexOf("*")==-1){ jframe.getTabbed().setTitleAt( jframe.getTabbed().getSelectedIndex(), jframe.getCurrentFilename()+"*"); jframe.setTitle(jframe.getJifVersion() +" - " + jframe.getCurrentFilename()); }
    public JIFTextPane(jFrame parent,File file) {        this.jframe = parent;        this.pathfile = (file != null ? file.getAbsolutePath() : "");        this.popupListener = new PopupListener(this, jframe);        hlighterBrackets = new HighlightText(this,Color.pink);        //hlighterBookmarks = new HighlightBookmark(this,new Color(204, 204, 255));               hlighterBookmarks = new HighlightBookmark(this, Color.gray);                       hlighter = new HighlightText(this,Color.pink);        this.bookmarks = new ArrayList();                setBackground(jframe.colorBackground);        setCaretColor(jframe.colorNormal);        getCaret().setBlinkRate(200);        setDoubleBuffered(true);        setEditorKit(new StyledEditorKit());        setEditable(true);        setFont(jframe.defaultFont);        setCaretColor(jframe.colorNormal);        // If the JCheckBoxSyntax = true, using InformDocument, otherwise using Document	if (jframe.jCheckBoxSyntax.isSelected()){            if (file==null){                // This is a new file, I'll apply the Inform Syntax Highlighting                setDocument(new InformDocument(jframe));            }            else {                if (pathfile.endsWith(".inf")||(pathfile.endsWith(".h"))){                    // .inf or .h file                    setDocument(new InformDocument(jframe));                }                else if (pathfile.endsWith(".res")){                    // Resource File, I'll use the ResDocument for Syntax Highlighting                    setDocument(new ResDocument(jframe));                }                else {                    // a Normal Document. I'll use a DefaultStyledDocument                    setDocument(new DefaultStyledDocument());                    setBackground(Color.white);                    setCaretColor(Color.black);                }            }        }        else{            // a Normal Document. I'll use a DefaultStyledDocument            setDocument(new DefaultStyledDocument());            setBackground(Color.white);            setCaretColor(Color.black);        }        loadFile(file);        undoF = new UndoManager();        undoF.setLimit(50000);        Document doc = getDocument();        doc.addUndoableEditListener(new UndoableEditListener() {            public void undoableEditHappened(UndoableEditEvent evt) {            undoF.addEdit(evt.getEdit());            // adding a "*" to the file name, when the file has changed but not saved            if (jframe.getTabbed().getComponentCount()!=0  && jframe.getCurrentFilename().indexOf("*")==-1){                jframe.getTabbed().setTitleAt( jframe.getTabbed().getSelectedIndex(), jframe.getCurrentFilename()+"*");            }            }        });        getActionMap().put("Undo", new AbstractAction("Undo") {            public void actionPerformed(ActionEvent evt) {                try {                    if (undoF.canUndo()) {                        while (undoF.getUndoPresentationName().equals(java.util.ResourceBundle.getBundle("JIF").getString("JFRAME_STYLE_CHANGED_UNDO"))){                            undoF.undo();                        }                        undoF.undo();                        // adding a "*" to the file name, when the file has changed but not saved                        if (jframe.getTabbed().getComponentCount()!=0  && jframe.getCurrentFilename().indexOf("*")==-1){                            jframe.getTabbed().setTitleAt( jframe.getTabbed().getSelectedIndex(), jframe.getCurrentFilename()+"*");                        }                    }                } catch (CannotUndoException e) {                    System.out.println(e.getMessage());                }            }        });        getInputMap().put(KeyStroke.getKeyStroke("control Z"), "Undo");        getActionMap().put("Redo", new AbstractAction("Redo") {            public void actionPerformed(ActionEvent evt) {                try {                    if (undoF.canRedo()) {                        while (undoF.getRedoPresentationName().equals(java.util.ResourceBundle.getBundle("JIF").getString("JFRAME_STYLE_CHANGED_REDO"))){                            undoF.redo();                        }                        undoF.redo();                        // adding a "*" to the file name, when the file has changed but not saved                        if (jframe.getTabbed().getComponentCount()!=0  && jframe.getCurrentFilename().indexOf("*")==-1){                            jframe.getTabbed().setTitleAt( jframe.getTabbed().getSelectedIndex(), jframe.getCurrentFilename()+"*");                        }                    }                } catch (CannotRedoException e) {                //System.out.println(e.getMessage());                }            }        });        getInputMap().put(KeyStroke.getKeyStroke("control Y"), "Redo");        // New file (file==null)        if (file==null){            addKeyListener(new EditorKeyAdapter(jframe, this));        }        else {            // Syntax highlighting is used only with .inf and .h files            if (pathfile.endsWith(".inf")||(pathfile.endsWith(".h"))){                addKeyListener(new EditorKeyAdapter(jframe, this));            }        }        // Add Mouse Listener for the right-mouse popup        addMouseListener(popupListener);                addCaretListener(new CaretListener(){		public void caretUpdate(CaretEvent ce){			int pos = getCaretPosition();			Element map = getDocument().getDefaultRootElement();			int row = map.getElementIndex(pos);			Element lineElem = map.getElement(row);			int col = pos - lineElem.getStartOffset();			jframe.jTextFieldRowCol.setText((row+1)+" | "+(col+1));		}	});    }