Actually, you're best off using setStylePrimaryName() and setStyleDependentName() because AFAIK there are some problems with setStyleName() and some browsers. See the API here: http://google-web-toolkit.googlecode.com/svn/javadoc/1.5/com/google/gwt/user/client/ui/UIObject.html#setStylePrimaryName(com.google.gwt.dom.client.Element,%20java.lang.String) -- Arthur Kalmenson
On Mon, Oct 13, 2008 at 5:23 AM, Paul Robinson <[EMAIL PROTECTED]> wrote: > > setStyleName() removes all existing styles, so you've removed the > standard gwt style names (gwt-*) > > addStyleName() adds to it. > > [EMAIL PROTECTED] wrote: > > Is there a problem with the following code as it doesnt grey out my > > text boxes (it does stet the size though). or is this a gwt bug? > > > > > > my java is: > > > > final TextBoxBase textBox; > > if (type.equals("small")) { > > textBox = new TextArea(); > > textBox.setStyleName("small"); > > } else if (type.equals("large")) { > > textBox = new TextArea(); > > textBox.setStyleName("large"); > > } else { > > throw new IllegalArgumentException("wrong type"); > > } > > textBox.setText("some text"); > > grid.setWidget(row, 1, textBox); > > textBox.setReadOnly(true); > > > > > > and my CSS is: > > > > .gwt-TextArea-readonly { > > background-color: #D1D1D1; > > } > > > > .small { > > width: 20em; > > font: 10pt Arial; > > } > > > > .large { > > width: 40em; > > height: 10em; > > font: 10pt Arial; > > } > > > > I am aware there is an easy work around for this by using different > > style names e.g. smallreadOnly but i have other "small" text boxes and > > i want to avoid where possible duplicating code. > > > > Thanks, > > steve > > > > > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to Google-Web-Toolkit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~----------~----~----~----~------~----~------~--~---