문제

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