import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.program.Program;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
public class SystemFileIconLoad {
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setLayout(new RowLayout());
Label label = new Label(shell, SWT.NONE);
Image image = null;
Program p = Program.findProgram(".txt");
ImageData data = p.getImageData();
image = new Image(display, data);
label.setImage(image);
p = Program.findProgram(".bmp");
data = p.getImageData();
image = new Image(display, data);
label = new Label(shell, SWT.NONE);
label.setImage(image);
p = Program.findProgram(".doc");
data = p.getImageData();
image = new Image(display, data);
label = new Label(shell, SWT.NONE);
label.setImage(image);
label.pack();
shell.pack();
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
if (image != null)
image.dispose();
display.dispose();
}
}