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.
Are you using the swing client?
Do you want to change the logo "Eclipse Scout" provided by default:
Read this: How to brand the swing client .
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:
Check the example in this Form: ImageFieldForm (Scout demo: widgets application ).
The ImageField should work perfectly fine for your use case. We are currently in the process of creating a widget sample application [1] that addresses such questions.
have a look at the DefaultField [2] of this application. 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:
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/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.