Navigateur
Navigateur

Reputation: 1892

GWT - how to precisely set rendered width of TextArea in pixels?

I need to render a TextArea in an exact pixel width for the special purposes of my GUI.

When I set its width to "250px", it comes out as 256px.

Is there a way to override this behavior so I can render it as 250px exactly?

Upvotes: 0

Views: 1731

Answers (1)

Eliran Malka
Eliran Malka

Reputation: 16263

When you use setWidth(), you're effectively setting the element's content width.

To get the offset width use UIObject#getOffsetWidth(). This will return the width including padding and border (but not margins).

References on W3C

Upvotes: 4

Related Questions