當前位置: 首頁>>代碼示例>>Java>>正文


Java ImageUtilities.addToolTipToImage方法代碼示例

本文整理匯總了Java中org.openide.util.ImageUtilities.addToolTipToImage方法的典型用法代碼示例。如果您正苦於以下問題:Java ImageUtilities.addToolTipToImage方法的具體用法?Java ImageUtilities.addToolTipToImage怎麽用?Java ImageUtilities.addToolTipToImage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.openide.util.ImageUtilities的用法示例。


在下文中一共展示了ImageUtilities.addToolTipToImage方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testByteConversions

import org.openide.util.ImageUtilities; //導入方法依賴的package包/類
public void testByteConversions() {
    ExtIcon ext = new ExtIcon();
    URL res = getClass().getClassLoader().getResource("org/netbeans/modules/project/ui/module.gif");
    assertNotNull(res);
    //#138000
    Image img = ImageUtilities.loadImage("org/netbeans/modules/project/ui/module.gif");
    img = ImageUtilities.addToolTipToImage(img, "XXX");
    Icon icon = ImageUtilities.image2Icon(img);
    ext.setIcon(icon);
    try {
        byte[] bytes1 = ext.getBytes();
        ExtIcon ext2 = new ExtIcon(bytes1);
        byte[] bytes2 = ext2.getBytes();
        ExtIcon ext3 = new ExtIcon(bytes2);
        byte[] bytes3 = ext3.getBytes();
        
        assertEquals(bytes1.length, bytes2.length);
        assertEquals(bytes3.length, bytes3.length);
        for (int i = 0; i < bytes1.length; i++) {
            assertEquals("Non equals at position " + i,bytes1[i], bytes2[i]);
            assertEquals("Non equals at position " + i,bytes1[i], bytes3[i]);
        }
    }
    catch (IOException ex) {
        Exceptions.printStackTrace(ex);
        fail();
    }
    
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:30,代碼來源:ExtIconTest.java

示例2: annotateIcon

import org.openide.util.ImageUtilities; //導入方法依賴的package包/類
@Override
public Image annotateIcon(Image icon, VCSContext context) {
    try {
        Thread.sleep(3000);
    } catch (InterruptedException ex) {
        Exceptions.printStackTrace(ex);
    }
    icon = ImageUtilities.mergeImages(icon, VersioningAnnotationProviderTest.IMAGE_ANNOTATION, 16, 16);
    icon = ImageUtilities.addToolTipToImage(icon, "Annotated");
    return icon;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:12,代碼來源:VersioningAnnotationProviderTest.java

示例3: annotateIcon

import org.openide.util.ImageUtilities; //導入方法依賴的package包/類
@Override
public Image annotateIcon(Image icon, VCSContext context) {
    try {
        Thread.sleep(3000);
    } catch (InterruptedException ex) {
        Exceptions.printStackTrace(ex);
    }
    icon = ImageUtilities.mergeImages(icon, VCSAnnotationProviderTestCase.IMAGE_ANNOTATION, 16, 16);
    icon = ImageUtilities.addToolTipToImage(icon, "Annotated");
    return icon;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:12,代碼來源:VCSAnnotationProviderTestCase.java

示例4: getIcon

import org.openide.util.ImageUtilities; //導入方法依賴的package包/類
@NbBundle.Messages("Tooltip_manifest=Contains NetBeans module manifest headers")
private Image getIcon() {
    return ImageUtilities.addToolTipToImage(ImageUtilities.loadImage(BADGE), toolTip);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:5,代碼來源:ModuleJarAccessibilityQueryImpl.java

示例5: annotateFileIcon

import org.openide.util.ImageUtilities; //導入方法依賴的package包/類
private Image annotateFileIcon (VCSContext context, Image icon) throws IllegalArgumentException {
    FileInformation mostImportantInfo = null;
    for (final File file : context.getRootFiles()) {
        FileInformation info = cache.getStatus(file);
        if (!info.containsStatus(STATUS_IS_IMPORTANT)) {
            continue;
        }
        if (isMoreImportant(info, mostImportantInfo)) {
            mostImportantInfo = info;
        }
    }
    if(mostImportantInfo == null) return null;
    String tooltip = null;
    String statusText = mostImportantInfo.getStatusText(FileInformation.Mode.HEAD_VS_WORKING_TREE);
    if (mostImportantInfo.containsStatus(Status.NOTVERSIONED_EXCLUDED)) {
        // File is IGNORED
        tooltip = getAnnotationProvider().EXCLUDED_FILE_TOOLTIP.getFormat().format(new Object[] { statusText });
    } else if (mostImportantInfo.getStatus().equals(EnumSet.of(Status.NEW_HEAD_INDEX, Status.REMOVED_INDEX_WORKING_TREE))) {
        // ADDED to index but REMOVED in WT
        tooltip = getAnnotationProvider().UP_TO_DATE_FILE_TOOLTIP.getFormat().format(new Object[]{statusText});
    } else if (mostImportantInfo.getStatus().equals(EnumSet.of(Status.MODIFIED_HEAD_INDEX, Status.MODIFIED_INDEX_WORKING_TREE))) {
        // MODIFIED in index, MODIFIED in WT, but in WT same as HEAD
        tooltip = getAnnotationProvider().UP_TO_DATE_FILE_TOOLTIP.getFormat().format(new Object[]{statusText});
    } else if (mostImportantInfo.containsStatus(Status.REMOVED_HEAD_WORKING_TREE)) {
        // DELETED in WT
        tooltip = getAnnotationProvider().REMOVED_FILE_TOOLTIP.getFormat().format(new Object[] { statusText });
    } else if (mostImportantInfo.getStatus().equals(EnumSet.of(Status.NEW_INDEX_WORKING_TREE, Status.REMOVED_HEAD_INDEX))) {
        // recreated in WT
        tooltip = getAnnotationProvider().UP_TO_DATE_FILE_TOOLTIP.getFormat().format(new Object[]{statusText});
    } else if (mostImportantInfo.getStatus().equals(EnumSet.of(Status.NEW_INDEX_WORKING_TREE, Status.REMOVED_HEAD_INDEX, Status.MODIFIED_HEAD_WORKING_TREE))) {
        // recreated in WT and modified
        tooltip = getAnnotationProvider().MODIFIED_FILE_TOOLTIP.getFormat().format(new Object[] { statusText });
    } else if (mostImportantInfo.containsStatus(Status.NEW_INDEX_WORKING_TREE)) {
        // NEW in WT and unversioned
        tooltip = getAnnotationProvider().NEW_FILE_TOOLTIP.getFormat().format(new Object[] { statusText });
    } else if (mostImportantInfo.containsStatus(Status.NEW_HEAD_INDEX)) {
        // ADDED to index
        tooltip = getAnnotationProvider().ADDED_FILE_TOOLTIP.getFormat().format(new Object[] { statusText });
    } else if (mostImportantInfo.containsStatus(Status.MODIFIED_HEAD_WORKING_TREE)) {
        tooltip = getAnnotationProvider().MODIFIED_FILE_TOOLTIP.getFormat().format(new Object[] { statusText });
    } else if (mostImportantInfo.containsStatus(Status.UPTODATE)) {
        tooltip = null;
    } else if (mostImportantInfo.containsStatus(Status.IN_CONFLICT)) {
        tooltip = getAnnotationProvider().CONFLICT_FILE_TOOLTIP.getFormat().format(new Object[] { statusText });
    } else if (mostImportantInfo.containsStatus(Status.NOTVERSIONED_NOTMANAGED)) {
        tooltip = null;
    } else if (mostImportantInfo.containsStatus(Status.UNKNOWN)) {
        tooltip = null;
    } else {
        throw new IllegalStateException("Unknown status: " + mostImportantInfo.getStatus()); //NOI18N
    }
    return tooltip != null ? ImageUtilities.addToolTipToImage(icon, tooltip) : null;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:54,代碼來源:Annotator.java

示例6: getIcon

import org.openide.util.ImageUtilities; //導入方法依賴的package包/類
@NbBundle.Messages("Tooltip_manifest=Contains OSGi manifest headers")
private Image getIcon() {
    return ImageUtilities.addToolTipToImage(ImageUtilities.loadImage(BADGE), toolTip);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:5,代碼來源:OSGiJarAccessibilityQueryImpl.java

示例7: addToolTip

import org.openide.util.ImageUtilities; //導入方法依賴的package包/類
private Image addToolTip (Image icon, VCSContext context) {
    if (!VersioningSupport.getPreferences().getBoolean(VersioningSupport.PREF_BOOLEAN_TEXT_ANNOTATIONS_VISIBLE, false)) {
        return icon;
    }
    File root = null;
    File repository = null;
    for (File f : context.getRootFiles()) {
        File repo = Mercurial.getInstance().getRepositoryRoot(f);
        if (repo != null) {
            if (repository == null) {
                repository = repo;
                root = f;
            } else if (!repository.equals(repo)) {
                // root files are from different repositories, do not annotate icon
                return icon;
            }
        }
    }
    if (repository != null) {
        WorkingCopyInfo info = WorkingCopyInfo.getInstance(repository);
        addFileWithRepositoryAnnotation(info, root);
        HgLogMessage[] parents = info.getWorkingCopyParents();
        String label = null;
        if (parents.length == 1) {
            HgLogMessage parent = parents[0];
            String branchName = null;
            for (String b : parent.getBranches()) {
                branchName = b;
            }
            if (branchName != null) {
                label = NbBundle.getMessage(MercurialAnnotator.class, "LBL_Annotator.currentBranch.toolTip", branchName); //NOI18N
            }
        } else if (parents.length > 1) {
            String b1 = parents[0].getBranches().length == 0 ? HgBranch.DEFAULT_NAME : parents[0].getBranches()[0];
            String b2 = parents[1].getBranches().length == 0 ? HgBranch.DEFAULT_NAME : parents[1].getBranches()[0];
            if (b1.equals(b2)) {
                label = NbBundle.getMessage(MercurialAnnotator.class, "LBL_Annotator.mergeNeeded.oneBranch.toolTip", new Object[] { //NOI18N
                    parents[0].getCSetShortID().substring(0, Math.min(7, parents[0].getCSetShortID().length())), 
                    parents[1].getCSetShortID().substring(0, Math.min(7, parents[1].getCSetShortID().length())), 
                    b1
                });
            } else {
                label = NbBundle.getMessage(MercurialAnnotator.class, "LBL_Annotator.mergeNeeded.twoBranches.toolTip", new Object[] { b1, b2 }); //NOI18N
            }
        }
        if (label != null) {
            icon = ImageUtilities.addToolTipToImage(icon, label.toString());
        }
    }
    return icon;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:52,代碼來源:MercurialAnnotator.java


注:本文中的org.openide.util.ImageUtilities.addToolTipToImage方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。