当前位置: 首页>>代码示例>>Java>>正文


Java ShellFolder.get方法代码示例

本文整理汇总了Java中sun.awt.shell.ShellFolder.get方法的典型用法代码示例。如果您正苦于以下问题:Java ShellFolder.get方法的具体用法?Java ShellFolder.get怎么用?Java ShellFolder.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sun.awt.shell.ShellFolder的用法示例。


在下文中一共展示了ShellFolder.get方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import sun.awt.shell.ShellFolder; //导入方法依赖的package包/类
public static void main(String[] args) {
    if (OSInfo.getOSType() != OSInfo.OSType.WINDOWS) {
        System.out.println("The test was skipped because it is sensible only for Windows.");

        return;
    }

    for (String key : KEYS) {
        Image image = (Image) ShellFolder.get(key);

        if (image == null) {
            throw new RuntimeException("The image '" + key + "' not found.");
        }

        if (image != ShellFolder.get(key)) {
            throw new RuntimeException("The image '" + key + "' is not cached.");
        }
    }

    System.out.println("The test passed.");
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:22,代码来源:bug6840086.java

示例2: createValue

import sun.awt.shell.ShellFolder; //导入方法依赖的package包/类
public Object createValue(UIDefaults table) {
    if (nativeImage != null) {
        Image image = (Image)ShellFolder.get(nativeImage);
        if (image != null) {
            return new ImageIcon(image);
        }
    }
    return SwingUtilities2.makeIcon(getClass(),
                                    WindowsLookAndFeel.class,
                                    resource);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:12,代码来源:WindowsLookAndFeel.java

示例3: main

import sun.awt.shell.ShellFolder; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
    if (OSInfo.getOSType() != OSInfo.OSType.WINDOWS) {
        System.out.println("The test is suitable only for Windows OS. Skipped.");

        return;
    }

    // Init toolkit because it shouldn't be interrupted while initialization
    Toolkit.getDefaultToolkit();

    // Init the sun.awt.shell.Win32ShellFolderManager2.drives field
    ShellFolder.get("fileChooserComboBoxFolders");

    // To get NPE the path must obey the following rules:
    // path.length() == 3 && path.charAt(1) == ':'
    final File tempFile = new File("c:\\");

    for (int i = 0; i < 10000; i++) {
        final CountDownLatch countDownLatch = new CountDownLatch(1);

        final Thread thread = new Thread() {
            public void run() {
                countDownLatch.countDown();

                ShellFolder.isFileSystemRoot(tempFile);
            }
        };

        thread.start();

        countDownLatch.await();

        thread.interrupt();
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:36,代码来源:bug6945316.java

示例4: main

import sun.awt.shell.ShellFolder; //导入方法依赖的package包/类
public static void main(String[] args) {
    // the error icon is round and in all four corner transparent
    // we check that all corners are identical
    Image icon = (Image) ShellFolder.get("optionPaneIcon Error");
    final BufferedImage image = getBufferedImage(icon);
    final int upperLeft = image.getRGB(0, 0);
    final int upperRight = image.getRGB(image.getWidth() - 1, 0);
    final int lowerLeft = image.getRGB(0, image.getHeight() - 1);
    final int lowerRight = image.getRGB(image.getWidth() - 1, image.getHeight() - 1);
    if (upperLeft != upperRight || upperLeft != lowerLeft || upperLeft != lowerRight) {
        throw new RuntimeException("optionPaneIcon Error is not a round icon with transparent background.");
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:14,代码来源:BadHiDPIIcon.java

示例5: addItem

import sun.awt.shell.ShellFolder; //导入方法依赖的package包/类
/**
 * Adds the directory to the model and sets it to be selected,
 * additionally clears out the previous selected directory and
 * the paths leading up to it, if any.
 */
public void addItem(File directory) {

    if (directory == null) {
        return;
    }

    boolean useShellFolder = FilePane.usesShellFolder(chooser);

    int oldSize = directories.size();
    directories.clear();
    if (oldSize > 0) {
        fireIntervalRemoved(this, 0, oldSize);
    }

    File[] baseFolders = (useShellFolder)
            ? (File[]) ShellFolder.get("fileChooserComboBoxFolders")
            : fsv.getRoots();
    directories.addAll(Arrays.asList(baseFolders));

    // Get the canonical (full) path. This has the side
    // benefit of removing extraneous chars from the path,
    // for example /foo/bar/ becomes /foo/bar
    File canonical;
    try {
        canonical = ShellFolder.getNormalizedFile(directory);
    } catch (IOException e) {
        // Maybe drive is not ready. Can't abort here.
        canonical = directory;
    }

    // create File instances of each directory leading up to the top
    try {
        File sf = useShellFolder ? ShellFolder.getShellFolder(canonical)
                                 : canonical;
        File f = sf;
        Vector<File> path = new Vector<File>(10);
        do {
            path.addElement(f);
        } while ((f = f.getParentFile()) != null);

        int pathCount = path.size();
        // Insert chain at appropriate place in vector
        for (int i = 0; i < pathCount; i++) {
            f = path.get(i);
            if (directories.contains(f)) {
                int topIndex = directories.indexOf(f);
                for (int j = i-1; j >= 0; j--) {
                    directories.insertElementAt(path.get(j), topIndex+i-j);
                }
                break;
            }
        }
        calculateDepths();
        setSelectedItem(sf);
    } catch (FileNotFoundException ex) {
        calculateDepths();
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:64,代码来源:SynthFileChooserUIImpl.java

示例6: addItem

import sun.awt.shell.ShellFolder; //导入方法依赖的package包/类
/**
 * Adds the directory to the model and sets it to be selected,
 * additionally clears out the previous selected directory and
 * the paths leading up to it, if any.
 */
private void addItem(File directory) {

    if(directory == null) {
        return;
    }

    boolean useShellFolder = FilePane.usesShellFolder(chooser);

    directories.clear();

    File[] baseFolders = (useShellFolder)
            ? (File[]) ShellFolder.get("fileChooserComboBoxFolders")
            : fsv.getRoots();
    directories.addAll(Arrays.asList(baseFolders));

    // Get the canonical (full) path. This has the side
    // benefit of removing extraneous chars from the path,
    // for example /foo/bar/ becomes /foo/bar
    File canonical;
    try {
        canonical = directory.getCanonicalFile();
    } catch (IOException e) {
        // Maybe drive is not ready. Can't abort here.
        canonical = directory;
    }

    // create File instances of each directory leading up to the top
    try {
        File sf = useShellFolder ? ShellFolder.getShellFolder(canonical)
                                 : canonical;
        File f = sf;
        Vector<File> path = new Vector<File>(10);
        do {
            path.addElement(f);
        } while ((f = f.getParentFile()) != null);

        int pathCount = path.size();
        // Insert chain at appropriate place in vector
        for (int i = 0; i < pathCount; i++) {
            f = path.get(i);
            if (directories.contains(f)) {
                int topIndex = directories.indexOf(f);
                for (int j = i-1; j >= 0; j--) {
                    directories.insertElementAt(path.get(j), topIndex+i-j);
                }
                break;
            }
        }
        calculateDepths();
        setSelectedItem(sf);
    } catch (FileNotFoundException ex) {
        calculateDepths();
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:60,代码来源:WindowsFileChooserUI.java

示例7: addItem

import sun.awt.shell.ShellFolder; //导入方法依赖的package包/类
/**
 * Adds the directory to the model and sets it to be selected,
 * additionally clears out the previous selected directory and
 * the paths leading up to it, if any.
 */
private void addItem(File directory) {

    if(directory == null) {
        return;
    }

    boolean useShellFolder = FilePane.usesShellFolder(chooser);

    directories.clear();

    File[] baseFolders = (useShellFolder)
            ? (File[]) ShellFolder.get("fileChooserComboBoxFolders")
            : fsv.getRoots();
    directories.addAll(Arrays.asList(baseFolders));

    // Get the canonical (full) path. This has the side
    // benefit of removing extraneous chars from the path,
    // for example /foo/bar/ becomes /foo/bar
    File canonical;
    try {
        canonical = ShellFolder.getNormalizedFile(directory);
    } catch (IOException e) {
        // Maybe drive is not ready. Can't abort here.
        canonical = directory;
    }

    // create File instances of each directory leading up to the top
    try {
        File sf = useShellFolder ? ShellFolder.getShellFolder(canonical)
                                 : canonical;
        File f = sf;
        Vector<File> path = new Vector<File>(10);
        do {
            path.addElement(f);
        } while ((f = f.getParentFile()) != null);

        int pathCount = path.size();
        // Insert chain at appropriate place in vector
        for (int i = 0; i < pathCount; i++) {
            f = path.get(i);
            if (directories.contains(f)) {
                int topIndex = directories.indexOf(f);
                for (int j = i-1; j >= 0; j--) {
                    directories.insertElementAt(path.get(j), topIndex+i-j);
                }
                break;
            }
        }
        calculateDepths();
        setSelectedItem(sf);
    } catch (FileNotFoundException ex) {
        calculateDepths();
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:60,代码来源:MetalFileChooserUI.java


注:本文中的sun.awt.shell.ShellFolder.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。