【问题标题】:How to load and display an image on selection of a Node in TreeViewer in eclipse e4 rcp?如何在 eclipse e4 rcp 中的 TreeViewer 中选择节点时加载和显示图像?
【发布时间】:2015-10-06 00:29:55
【问题描述】:

我正在尝试从用户选择的输入文件加载图像并使用Label 将其显示给用户。此图像是所选TreeViewer 节点的属性。因此,选择更改图像(如果存在)也应更改。 (主/细节场景)

论坛帖子How to load image to view in RCP? 建议我必须手动将图像读取为byte 数组。

是否有框架提供的方式来直接加载和显示图像?如果这样的方式存在,在选择变化时需要用新的图像替换图像的方法?这样内存中一次只有一张图像。

【问题讨论】:

    标签: eclipse eclipse-rcp rcp e4


    【解决方案1】:

    要读取图像,请使用:

    ImageDescriptor desc = ImageDescriptor.createFromFile(null, "file path");
    
    Image image = desc.createImage();
    

    完成后不要忘记处理图像。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-04-06
      • 2010-09-28
      • 1970-01-01
      • 1970-01-01
      • 2014-06-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多