JFrame frame = (JFrame) SwingUtilities.getAncestorOfClass(JFrame.class, workspace); if (frame == null) return; String oldTitle = frame.getTitle(); if (oldTitle == null) { oldTitle = FRAME_TITLE; } else { int colon = oldTitle.indexOf(':'); if (colon >= 0) oldTitle = oldTitle.substring(0, colon).trim(); } if (doc == null) frame.setTitle(oldTitle); else frame.setTitle(oldTitle + ":" + doc);
JFrame frame = (JFrame) SwingUtilities.getAncestorOfClass(JFrame.class, workspace); if (frame == null) return; String oldTitle = frame.getTitle(); if (oldTitle == null) { oldTitle = FRAME_TITLE; } else { int colon = oldTitle.indexOf(':'); if (colon >= 0) oldTitle = oldTitle.substring(0, colon).trim();
    private void setFrameTitleDocument(String doc) {        JFrame frame =            (JFrame) SwingUtilities.getAncestorOfClass(JFrame.class, workspace);        if (frame == null) return;        String oldTitle = frame.getTitle();        if (oldTitle == null) {            oldTitle = FRAME_TITLE;        } else {            int colon = oldTitle.indexOf(':');            if (colon >= 0) oldTitle = oldTitle.substring(0, colon).trim();        }        if (doc == null)            frame.setTitle(oldTitle);        else            frame.setTitle(oldTitle + ":" + doc);    }