Pregunta

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.

¿Fue útil?

Solución

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.

Otros consejos

You can apply the CSS settings to your gwt-objects

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);
}

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.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top