Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Scaled Linked Image in Vaadin

DZone's Guide to

Scaled Linked Image in Vaadin

· Java Zone
Free Resource

Build vs Buy a Data Quality Solution: Which is Best for You? Gain insights on a hybrid approach. Download white paper now!

In vaadin you can easily embed images either via:

Embedded logoEmbed = new Embedded("yourText",new ThemeResource("../yourtheme/img/logo.png"));
logoEmbed.setType(Embedded.TYPE_IMAGE);

or if you need a linked image do the following:

Link iconLink = new Link();
iconLink.setIcon(new ExternalResource(urlAsString));
iconLink.setResource(new ThemeResource("../yourtheme/img/logo.png"));

But how can you scale that external image? This is simple if you let the browser do it for you. In Java do:

iconLink.setStyleName("mylogo");

and then you will need to change the following style in your custom style.css to your needs:

.mylogo a img { width: 67px; 

From http://karussell.wordpress.com/2010/05/31/scaled-linked-image-in-vaadin/

Build vs Buy a Data Quality Solution: Which is Best for You? Maintaining high quality data is essential for operational efficiency, meaningful analytics and good long-term customer relationships. But, when dealing with multiple sources of data, data quality becomes complex, so you need to know when you should build a custom data quality tools effort over canned solutions. Download our whitepaper for more insights into a hybrid approach.

Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}