In GWT, how to create a Style object and associate it with a Widget WITHOUT using a CSS file and WITHOUT UiBinder


Tags: css,gwt

Problem :

I would just like to create a Style object and associate it with a Widget, all in Java.

It is possible to create a Style object like that: Style style = new Style();

It is possible to link a Widget with a Style using: FlowPanel panel = new FlowPanel(); panel.setStyleName("myStyle");

But you need "myStyle" to exist in some CSS file.

It would be nice to be able to do: Style style = new Style("myStyle");

I would like to do everything in Java and avoid the CSS or UiBinder file.

Thank you !



Solution :

You should be able to access the Style element by using

someUiObject.getElement().getStyle()

and then manipulate the style there.


    CSS Howto..

    How can I compute a percentage based margin with LESS css?

    How to separate Text and HTML with CSS

    How To Layout a Grid in CSS

    How to do fade-in and fade-out with JavaScript and CSS

    How do I align columns in thead and tbody when tbody css display attribute is block

    how to configure .htc files to work on nginx

    How to stretch div height to fill parent div - CSS

    How to offset div columns in CSS grid system

    How to override css class without touching the HTML?

    How to handle alternating rows dynamically?

    How to :hover one div on two other divs and make it dynamic with JS/JQuery?

    how to make 100% buttons with fixed pixel space

    How to prevent image moving when resizing window

    HTML/CSS How do I get 2 completely independant scrollbars?

    Images not showing in PhoneGap Build application

    How to make the section and aside touch the footer?

    How to make css border shape [duplicate]

    How to change CSS for a specific page in wordpress?

    how to Load a css file for html page android web view

    How to know from css if a select is opened

    How to give option to add css classes/IDs to content to in CMS's WYSIWYG content builder/editor to non-technical client?

    How can I animate my div to go from top to bottom whithout interfering with the content inside?

    How to make text appear under div without moving other items in list?

    How to hide div on swipe in Angular

    CSS: How to put form input fields and button next to each other in the same line?

    How to pull css attributes from

    how to add several td and tr in css

    How to have multiple borders on div using css

    CSS classes: base+additional. How to define?

    How to avoid text go below the icon with css?