Hi Ian, You example works fine except that I have to include myGrid when setting the styles into the cells like the following:
f.setStyleName(0, 0, "myGrid my-Grid-ne my-Grid-border-row my-Grid-border-col"); f.setStyleName(0, 1, "myGrid my-Grid-n my-Grid-border-row"); f.setStyleName(0, 2, "myGrid my-Grid-nw my-Grid-border-row my-Grid-border-col"); f.setStyleName(1, 0, "myGrid my-Grid-e my-Grid-border-col") For some reasons, the myGrid style specified in Grid has no effect in the cells. Thanks Ian, you shown me a good CSS example and it is very helpful for a Java Swing developer like me ;-) On Mon, Jun 29, 2009 at 8:06 PM, Ian Bambury <[email protected]> wrote: > You can apply border-spacing to a table (e.g. your grid) which adjusts the > spacing between cells. To get rid of it completely, you need to set > border-collapse:collapse to the *table* (not the cells - i.e.not the td > elements) > I think you can get away with setting font-size on the table/grid and to > make the css easier, you might like to set style something like below. It > makes the code easier to read (e.g. every cell has ne. n, nw to indicate > where it is in the grid) and the css is so much simpler - you set all the > widths/heights in one place and therefore don't miss any if you change from > 5px to 3px, say. > > Grid grid = new Grid(3, 3); > grid.setStylePrimaryName("my-Grid"); > CellFormatter f = grid.getCellFormatter(); > f.setStyleName(0, 0, "my-Grid-ne my-Grid-border-row > my-Grid-border-col"); > f.setStyleName(0, 1, "my-Grid-n my-Grid-border-row"); > f.setStyleName(0, 1, "my-Grid-nw my-Grid-border-row > my-Grid-border-col"); > f.setStyleName(1, 0, "my-Grid-e my-Grid-border-col"); > . > . > . > and then the css is simpler > > .my-Grid > { > font-size : 1px; > border-collapse : collapse; > } > .my-Grid-border-row > { > height : 5px; > } > .my-Grid-border-col > { > width : 5px; > } > .my-Grid-ne > { > /* put the north-east corner image here */ > } > etc > > Ian > > http://examples.roughian.com > > > > > > -- Hez --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected] 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 -~----------~----~----~----~------~----~------~--~---
