--Using ImageViewer for Pictures
1 post
• Page 1 of 1
--Using ImageViewer for Pictures
This article is outdated - please use our new system at
https://doc.sibvisions.com
Displaying pictures from databases is relatively simple, but time and again, the implementation in the UI causes problems and repetitive efforts.
JVx reduces the effort to a minium. The picture data is displayed in tables, selection lists or forms, and usually no more than three lines of code are necessary.
Example
We have saved a profile picture of a user in the database in binary format. At a different location, we have saved a picture path (e.g.: /com/sibvisions/apps/packung/images/flag/austria.png). We want to display both contents in UI as a picture. The definition of the picture's path requires that the picture is contained in the classpath. If that is not the case, a standard picture is displayed!
Now the promised three lines of code:
- Code: Select all
//create the image viewer
UIImageViewer ivProfile = new UIImageViewer();
ivProfile.setDefaultImageName(NO_IMAGE);
//set the image viewer als cell editor
rdbPerson.getRowDefinition().getColumnDefinition("IMAGE").getDataType().
setCellEditor(imageViewer);
All controls that refer to IMAGE represent the saved picture or the standard picture NO_IMAGE such as UITable, UIEditor, etc.
-
Development@SIB - Posts: 325
- Joined: Mon Sep 28, 2009 1:54 pm
1 post
• Page 1 of 1