Вопрос

My LWUIT application has 3 Forms:

1) FormA 2) FormB 3) FormC

The current form being displayed on the screen is FormB.

Case 1:

If the user swipes his finger LEFT on his touch screen phone, I want LWUIT to capture that event and display FormC

Case2:

If the user swipes his finger RIGHT on his touch screen phone, I want LWUIT to capture that event and display FormA

How do I do this? I think it has to do something with drag event but not sure how to implement it.

Thanks.

Это было полезно?

Решение

just need to override pointerDragged method in form and get/cal its X,Y positions and display another form. 


new Form()
{

protected void pointerDragged(int x, int y) {
if(x,y....)
{
form3.show();

}else
{
from1.show();
}
super.pointerDragged(x,y);

}

};

here x,y can be calculated based on screen resolutions and components u have added to it.

Другие советы

Use the Tabs component with 3 Containers, it supports Swipe. You can set the Tabs themselves to be hidden.

instead of taking 3 forms use 3 containers under 1 form and setScrollableX(true) and add all components in appropriate containers.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top