0

i want to create a resizeable Image in GWT. I just found a sample for resizeable Panels, see here: http://gwt-ext.com/demo/#resizablePanel . But it doesn't work for images. Can anybody help me?

Thanks! Jogi

Shayan Ghosh
  • 882
  • 6
  • 14
Jogi
  • 25
  • 1
  • 8

2 Answers2

0

Set image as a background to its container (e.g. your view) with the following CSS rules, and it will resize as necessary.

Community
  • 1
  • 1
Andrei Volgin
  • 40,755
  • 6
  • 49
  • 58
  • okay, that only works when the widgets are not draggable :( I am using gwt-dnd...do you know what could be the problem? – Jogi Apr 12 '16 at 10:40
  • I don't think that setting a container to draggable will affect this in any way. – Andrei Volgin Apr 12 '16 at 17:51
  • I'm using a HTML-Widget, in my css i set the image as background-image, the property resize:both and overflow:auto. The resizing works! then i add dragController.makeDraggable(myhtmlwidget), the widget is draggable but no longer resizable! but i wonder, because the resize-symbol is shown. – Jogi Apr 12 '16 at 18:54
0

An image widget is a <img /> tag in disguise. I find the best way to resize is use css class and set it as a style name with width and height or use inline style using imageWidget.getElement().getStyle().setWidth or setHeight. A percentage width and/or height value could be used in some cases but this depends on the elements display attribute and/or the parent elements available size.

Brandon
  • 2,034
  • 20
  • 25
  • okay, i created following css: div.resize { background-repeat: no-repeat; background-size: 100% 100%; border: 2px solid; padding: 20px; width: 120px; height:50px; resize: both; overflow: auto; } and then i set: insert2.setStyleName("resize"); but it does not work :( whats wrong? – Jogi Apr 08 '16 at 12:02