How do I get the icon associated with a file type?

CodeProject has some classes you can download. First get the FileAssociationInfo, and from that get the ProgramAssociationInfo. The pai object can give you the icon. FileAssociationInfo fai = new FileAssociationInfo(“.bob”); ProgramAssociationInfo pai = new ProgramAssociationInfo(fai.ProgID); ProgramIcon icon = pai.DefaultIcon;

How to show an icon in the status bar when application is running, including in the background?

You should be able to do this with Notification and the NotificationManager. However getting a guaranteed way to know when your application is not running is the hard part. You can get the basic functionality of what you are desiring by doing something like: Notification notification = new Notification(R.drawable.your_app_icon, R.string.name_of_your_app, System.currentTimeMillis()); notification.flags |= Notification.FLAG_NO_CLEAR | … Read more

how to create own file with icon that inherit from JFrame icon, that I set it, in java and my own file use FileOutputStream and ObjectOutputStream

@David is correct that the host platform owns the JFrame decorations, but you may be able to leverage the JInternalFrame icons, which typically recapitulate those of the platform. For example, private static final Icon ICON = (Icon) UIManager.get(“InternalFrame.closeIcon”); Other decorative defaults are enumerated here. SSCCE: import java.awt.EventQueue; import java.awt.GridLayout; import javax.swing.BorderFactory; import javax.swing.Icon; import javax.swing.JFrame; … Read more

Extract Icon from Windows .lnk (shortcut) file

Using the Shell32 method of acessing links: String lnkPath = @”C:\Users\PriceR\Desktop\Microsoft Word 2010.lnk”; //— run microsoft word var shl = new Shell32.Shell(); // Move this to class scope lnkPath = System.IO.Path.GetFullPath(lnkPath); var dir = shl.NameSpace(System.IO.Path.GetDirectoryName(lnkPath)); var itm = dir.Items().Item(System.IO.Path.GetFileName(lnkPath)); var lnk = (Shell32.ShellLinkObject)itm.GetLink; //lnk.GetIconLocation(out strIcon); String strIcon; lnk.GetIconLocation(out strIcon); Icon awIcon = Icon.ExtractAssociatedIcon(strIcon); this.button1.Text = … Read more