GWT resizing
Submitted by paul on Mon, 04/05/2010 - 11:56
I grew to love gwt more and more. Here's a little bit of code that I never though would be possible to write:
@Override public void onResize(ResizeEvent event) { width = event.getWidth(); height = event.getHeight(); canvas.setWidth(width); canvas.setHeight(height); draw(); }}); canvas = new Surface(width, height);
Let's be clear here, all this java code is being converted and run as javascript on client side. What does this do? Well, it disables all scrollbars, takes the size of the window and makes a canvas out of it. When the window resizes, it resizes the canvas. And it all works.
hmmm, new Surface()? Yes, I'm using the gwt-g2d library which seems a bit more mature than the canvas object from gwt-incubator. The gwt-incubator doesn't handle keyboard yet which is a major booboo for me.
»
- paul's blog
- Login or register to post comments
