How to set border style

2.7k Views Asked by At

I am wondering is there an optimal way to set border (CSS like) for RichTextArea directly?;

I tried to use Formatter but it doesn't contain required methods :(

I'm using GWT 2.3.

4

There are 4 best solutions below

0
On BEST ANSWER

There are many ways of achieving it.

You can use the following

getElement().setAttribute( "name", "value" );

Here provide CSS attribute name you want to modify and provide the value.

getElement().setClassName( "className" );
getElement().addClassName( "className" );

Here provide the CSS classname( it can be any name). Use the same className in your CSS file and do all the manipulation you need.

0
On

One way to do that would be to use the embedded methods inside GWT, which are:

from the GWT Style class.

Here is an example:

HTMLPanel htmlPanel= new HTMLPanel("TestPanel");
htmlPanel.getElement().getStyle().setBorderStyle(BorderStyle.SOLID); // DOTTED, NONE ...
htmlPanel.getElement().getStyle().setBorderWidth(0.5, Unit.PX);
htmlPanel.getElement().getStyle().setBorderColor("#DD05FF");

Here your htmlPanel would have a purple, solid border of 0.5 pixel wide.

1
On

Maybe you could extended the frame from GWT's frame with a method that sets the border:

public void setFrameBorder(Integer border) {
    getFrameElement().setFrameBorder(border);
}
0
On

You can apply the CSS settings to your gwt-objects