MyDragHandler.java 文件源码

java
阅读 33 收藏 0 点赞 0 评论 0

项目:UaicNlpToolkit 作者:
public boolean importData(JComponent comp, Transferable t) {
    if (GrammarEditor.theEditor.shouldSave) {
        int answer = JOptionPane.showConfirmDialog(GrammarEditor.theEditor.frame, "Save before opening a new grammar?", null, JOptionPane.YES_NO_CANCEL_OPTION);
        if (answer == JOptionPane.YES_OPTION)
            GrammarEditor.theEditor.save.doClick();
        else if (answer == JOptionPane.CANCEL_OPTION)
            return false;
    }

    File f = null;
    try {
        f = ((List<File>) t.getTransferData(DataFlavor.javaFileListFlavor)).get(0);
        GrammarEditor.theEditor.openGrammar(f);
        return true;
    } catch (Exception ex) {
        JOptionPane.showMessageDialog(GrammarEditor.theEditor.frame, ex.getMessage(), "Can't drag file", JOptionPane.ERROR_MESSAGE);
    }

    return false;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号