Textarea font style

898 views
Skip to first unread message

muralism

unread,
Sep 14, 2006, 1:54:54 AM9/14/06
to Google Web Toolkit
Hi, i am new to GWT. i wanted to change text font size & font style
inside a textarea using the drop down listbox.

Michael Neale

unread,
Sep 14, 2006, 5:46:59 AM9/14/06
to Google-We...@googlegroups.com
Have you tried setting the CSS properties under .gwt-TextArea { }
as per http://code.google.com/webtoolkit/documentation/com.google.gwt.user.client.ui.TextArea.html

Not sure how to make it dynamic though. There are other non GWT rich text editors, I was thinking of building my own in GWT (simple) for this purpose.

Any other ideas anyone?

claude

unread,
Sep 14, 2006, 11:06:25 AM9/14/06
to Google Web Toolkit
I suspect you want to use something like:

Element element = textArea.getElement();
DOM.setStyleAttribute(element, "font", fontValue);
DOM.setStyleAttribute(element, "fontSize", sizeValue);

muralism

unread,
Sep 15, 2006, 3:11:23 AM9/15/06
to Google Web Toolkit
Thank u Mr.claude.
I replaced setStyleAttribute setIntStyleAttribute to change the font
size, its changing cursor size but its resizing the textarea .

Is thr any way i could hightlight a selected text inside textarea with
some color?

I am getting following exception while changing the font family.

[ERROR] Uncaught exception escaped
java.lang.RuntimeException: JavaScript method
'@com.google.gwt.user.client.impl.DOMImpl::setStyleAttribute(Lcom/google/gwt/user/client/Element;Ljava/lang/String;Ljava/lang/String;)'
threw an exception
at
com.google.gwt.dev.shell.ie.ModuleSpaceIE6.invokeNative(ModuleSpaceIE6.java:394)
at
com.google.gwt.dev.shell.ie.ModuleSpaceIE6.invokeNativeVoid(ModuleSpaceIE6.java:283)
at
com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:127)
at
com.google.gwt.user.client.impl.DOMImpl.setStyleAttribute(DOMImpl.java:257)
at com.google.gwt.user.client.DOM.setStyleAttribute(DOM.java:816)
at
com.veetech.gwt.client.RichtextEditor$1.onChange(RichtextEditor.java:57)
at
com.google.gwt.user.client.ui.ChangeListenerCollection.fireChange(ChangeListenerCollection.java:36)
at
com.google.gwt.user.client.ui.ListBox.onBrowserEvent(ListBox.java:152)
at com.google.gwt.user.client.DOM.dispatchEventImpl(DOM.java:902)
at com.google.gwt.user.client.DOM.dispatchEventAndCatch(DOM.java:886)
at com.google.gwt.user.client.DOM.dispatchEvent(DOM.java:854)
at
com.google.gwt.dev.shell.StaticJavaDispatch.callMethod(StaticJavaDispatch.java:45)
Caused by: com.google.gwt.core.client.JavaScriptException: JavaScript
Error exception: Invalid argument.
at
com.google.gwt.dev.shell.ModuleSpace.createJavaScriptException(ModuleSpace.java:267)
at
com.google.gwt.dev.shell.ie.ModuleSpaceIE6.exceptionCaught(ModuleSpaceIE6.java:105)
at
com.google.gwt.dev.shell.JavaScriptHost.exceptionCaught(JavaScriptHost.java:31)
at
com.google.gwt.dev.shell.StaticJavaDispatch.callMethod(StaticJavaDispatch.java:45)
at
com.google.gwt.dev.shell.ie.IDispatchProxy.invoke(IDispatchProxy.java:127)
at
com.google.gwt.dev.shell.ie.IDispatchImpl.Invoke(IDispatchImpl.java:199)
at
com.google.gwt.dev.shell.ie.IDispatchImpl.method6(IDispatchImpl.java:108)
at
org.eclipse.swt.internal.ole.win32.COMObject.callback6(COMObject.java:117)
at
org.eclipse.swt.internal.ole.win32.IDispatch.Invoke(IDispatch.java:64)
at
org.eclipse.swt.ole.win32.OleAutomation.invoke(OleAutomation.java:487)

muralism

unread,
Sep 15, 2006, 3:30:22 AM9/15/06
to Google Web Toolkit
Thank u very much Mr.claude.

I replaced setStyleAttribute setIntStyleAttribute to change the
fontsize, its changing cursor size but its resizing the textarea .

Intead of font i replaced fontFamily "DOM.setStyleAttribute(element,
"font", fontValue); " its work but text area is been resizing.

Is thr any way i could hightlight a selected text inside textarea with

some color pelette?

Reply all
Reply to author
Forward
0 new messages