简体   繁体   English

如何在Eclipse Scout中显示图像?

[英]How to show image in Eclipse Scout?

How to show an image in scout form? 如何以侦查兵的形式显示图像?

I want to show an image as logo in the desktop form, I tried imagefield and htmlfield, but i failed to find examples online. 我想以桌面形式显示图像作为徽标,我尝试使用imagefield和htmlfield,但是无法在线找到示例。

Swing UI 秋千UI

Are you using the swing client? 您正在使用swing客户吗?

Do you want to change the logo "Eclipse Scout" provided by default: 您是否要更改默认提供的徽标“ Eclipse Scout”:

Eclipse Scout-Swing桌面

Read this: How to brand the swing client . 阅读以下内容: 如何为摇摆客户打上烙印

Image field 像场

If you want to display an image somewhere in a form, consider using an Image Field . 如果要在表单的某处显示图像,请考虑使用“ 图像字段” You will get something like what you see in this Preview form: 您将获得类似于在“ Preview表单中看到的内容:

侦查应用程序示例

Check the example in this Form: ImageFieldForm (Scout demo: widgets application ). 请检查以下表单中的示例: ImageFieldForm (Scout演示: widgets应用程序 )。

The ImageField should work perfectly fine for your use case. 对于您的用例,ImageField应该可以很好地工作。 We are currently in the process of creating a widget sample application [1] that addresses such questions. 我们目前正在创建一个小部件样本应用程序[1]来解决这些问题。

have a look at the DefaultField [2] of this application. 看看这个应用程序的DefaultField [2]。 in this case you set the initial image as follows 在这种情况下,您将初始图像设置如下

    @Override
    protected String getConfiguredImageId() {
      return AbstractIcons.ApplicationLogo;
    }

You can also add your own icons in the shared plugin of your application and reference these accordingly. 您还可以在应用程序的共享插件中添加自己的图标,并相应地引用它们。

To display an external image you can override method ExecInitField of your ImageField: 要显示外部图像,您可以覆盖ImageField的ExecInitField方法:

      try {
        URL url = getUrl(<URL TO YOUR IMAGE>);
        setImage(IOUtility.getContent(url.openStream()));
      }
      catch (Exception e) {
        e.printStackTrace();
        getImageURLField().setErrorStatus(e.getMessage());
      }

hope this helps 希望这可以帮助

[1] https://github.com/BSI-Business-Systems-Integration-AG/scoutbook/blob/master/code/widgets/ [1] https://github.com/BSI-Business-Systems-Integration-AG/scoutbook/blob/master/code/widgets/

[2] https://github.com/BSI-Business-Systems-Integration-AG/scoutbook/blob/master/code/widgets/org.eclipse.scout.widget.client/src/org/eclipse/scout/widget/client/ui/forms/ImageFieldForm.java [2] https://github.com/BSI-Business-Systems-Integration-AG/scoutbook/blob/master/code/widgets/org.eclipse.scout.widget.client/src/org/eclipse/scout/widget /client/ui/forms/ImageFieldForm.java

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM