0

I have to set a image on wizard dialogue in swt,classpath load this image but image not displayed properly. In my design create a composit in this composit create a lebel.there after in this lebel I want add an image.After that i will create a runnable jar.This jar will be executed with proper image. In my implementation part i have create a resources (src folder) within src folder and in this resources folder kept image which i need.Please find the below code,

   File file = new File("resources/Automatics_Logo.png");
   Image image = new Image(Display.getDefault(), file.getPath());

   Label lblNewLabel_4 = new Label(composite, SWT.NONE);
  lblNewLabel_4.setImage(SWTResourceManager.getImage(CheckSystemConfigurationAndInstallation.class,image.toString()));

enter image description here

Cœur
  • 37,241
  • 25
  • 195
  • 267
Biswabir
  • 19
  • 8

1 Answers1

0
Image imgSWT=null;  // Image class is the SWT Image class
        ImageDescriptor imgDesc=null;
        java.net.URL imgURL = IntroductionPage.class.getResource("/Automatics_Logo.png");

        if (imgURL != null) {
            imgDesc = ImageDescriptor.createFromURL(imgURL);
            imgSWT = imgDesc.createImage();
Biswabir
  • 19
  • 8