Is it possible to overwrite the pointerdragged method so as to use foats instead of integers? If so, how?
Why would you require something like that?
Floats make sense when you need to draw based on subpixel coordinates which LWUIT tries to abstract away. When porting to platforms that deliver events as floats we just round to the nearest integer.
I need two objects to move at the same time, but the B object has to move 1.5 times the distance the A object has moved, and I want a steady motion. If not floats, doubles may do.
You don't need floats for drawing on the screen for this purpose, it would just slow you down.
Look at LWUIT's list scrolling which is pretty smooth on reasonably performant devices. We use floating point arithmetics for the Motion class yet when it comes time to choosing a pixel we round to the nearest integer position.
You should only use floating point drawing primitives when dealing with graphics that neads features such as anti-alising or view neutrality.
Sorry, but I need at least one decimal.
Drawing with floating point values is SLOW. VERY SLOW.
Even if it were supported in LWUIT you shouldn't do this.
You can store positions in floating point values (that is what we do, e.g. in class motion) but there is absolutely no reason whatsoever to DRAW the positions using floating point values. The difference will not be noticeable even on a 4 inch device while the performance will be horrible.
Let's see if I explain myself better. When object A.X (the one that gets the getX position) equals 1, object B.X should be 2, and when A.X is 2, B.X should be 4. But what happens when I want B.X to equal 3? I need A.X to be 1.5.
It doesn't matter.
A difference of a single pixel rounded up or down will hardly be noticeable to the eye.
To shift the objects you can use floats all you want just round them when setting the X and Y.
Once again, let's see if I explain myself better. I've already tried this midlet in my mobile and it "is" noticeable. So if what I'm trying to do is not noticeable, I will simply drop the project. But if anyone can think of a workaround, I would be glad to hear it.
Does anyone at leat know how the pointer dragged function works, to see if I can create a similar one instead of overriding it?
Your use of this web site or any of its content or software indicates your agreement to be bound by these Terms of Participation.
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.