getSystemIcon 如何得到大点的图表??

sunnet2008 2010-01-16 06:15:21
getSystemIcon得到的ico小的可怜 我想要再大点的 还有 如果没有实际文件 而只有文件后堆 怎么能得到系统关联的图表??
...全文
84 2 打赏 收藏 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
fengyoujie 2010-01-26
  • 打赏
  • 举报
回复
帮楼主顶了
huntor 2010-01-16
  • 打赏
  • 举报
回复
Copy自 SwingHacks Hack 99
import java.io.*;
import javax.swing.*;
public class LargeIconTest {
public static void main(String[] args) throws Exception {
// Create a File instance of an existing file
File file = new File(args[0]);

// Get metadata and create an icon
sun.awt.shell.ShellFolder sf =
sun.awt.shell.ShellFolder.getShellFolder(file);
Icon icon = new ImageIcon(sf.getIcon(true));
System.out.println("type = " + sf.getFolderType());

// show the icon
JLabel label = new JLabel(icon);
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().add(label);
frame.pack();
frame.show();
}
}

62,620

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧