×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    May 2013
    Posts
    153

    how to register GestureIntrectiveZone in lwuit1.5

    i am working on sdk2.0 using lwuit 1.5 .I tried to apply the gesture on form but i am facing problem during the register GestrueInterctiveZone.i am using following code please help me i dont know how to apply gesture on form.
    Code:
    public class ScrollText extends MIDlet implements GestureListener{
    MIDlet midlet=this;
    Label northlab;
    	public ScrollText() {
    		// TODO Auto-generated constructor stub
    	}
    
    	protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
    		// TODO Auto-generated method stub
    
    	}
    
    	protected void pauseApp() {
    		// TODO Auto-generated method stub
    
    	}
    
    	protected void startApp() throws MIDletStateChangeException {
    		// TODO Auto-generated method stub
    		Display.init(this);
    		//Display.getInstance().setForceFullScreen(true);
    		Form form=new Form();
    		form.setScrollable(false);
    		form.getUnselectedStyle().setBgColor(10175989);
    		form.setLayout(new BorderLayout());
    		Container northcon=new Container();
    		int northcomponentHT=form.getPreferredH()*20/100;
    		northcon.setPreferredH(northcomponentHT);
    		 northlab=new Label("NORTH");
    		northcon.addComponent(northlab);
    		form.addComponent(BorderLayout.NORTH,northcon);
    		Container centercon=new Container();
    		TextArea textarea=new TextArea();
    		int centercomponentHT=form.getPreferredH()*60/100;
    		textarea.setPreferredH(centercomponentHT);
    		textarea.setPreferredW(form.getPreferredW());
    		
    		
    		textarea.setFocusable(true);
    		textarea.requestFocus();
    		textarea.setScrollVisible(true);
    		textarea.setEditable(false);
    		
    		centercon.addComponent(textarea);
    		form.addComponent(BorderLayout.CENTER,centercon);
    		Container southcon=new Container();
    		int southcomponentHT=form.getPreferredH()*20/100;
    		southcon.setPreferredH(southcomponentHT);
    		Label southlab=new Label("SOUTH");
    		southcon.addComponent(southlab);
    		form.addComponent(BorderLayout.SOUTH,southcon);
    		GestureInteractiveZone gest = new GestureInteractiveZone( GestureInteractiveZone.GESTURE_ALL);
    		System.out.println("........................");
    		GestureRegistrationManager.register(centercon, gest);
    		System.out.println("/////////////////////////////////");
    		form.show();
    	}
    		public void gestureAction(Object container,
    			GestureInteractiveZone gestureInteractiveZone,
    			GestureEvent gestureEvent) {
    		// TODO Auto-generated method stub
    		switch (gestureEvent.getType()) {
    		case GestureInteractiveZone.GESTURE_DRAG: {
    			// Handle the DRAG gesture
    		};break;
    		case GestureInteractiveZone.GESTURE_FLICK: {
    			// Handle the DRAG gesture
    		};break;
    		case GestureInteractiveZone.GESTURE_LONG_PRESS: {
    			// Handle the DRAG gesture
    		};break;
    		default:
    			System.out.println("handleGestureRect() event ignored.");
    		
    	}
    
    }}
    I am using cenercon which is Container object in GestureRegistrationManager.register(centercon, gest);
    I am using this link in this link canvas and rectangle is used as a gesture interctivezone but i dont knwo how to use canvas in lwuit it is not like lcdui.http://developer.nokia.com/Community...meAnimator_API
    Please help me

  2. #2
    Nokia Developer Champion
    Join Date
    Mar 2013
    Posts
    602

    Re: how to register GestureIntrectiveZone in lwuit1.5

    The GestureRegistrationManager class takes as the first argument the CANVAS and not a lwuit container, in general i would advice you against combining LWUIT and direct canvas dealing unless you KNOW what your doing....
    HOWEVER, if you must have access to the Canvas you can use the Midlet.getDisplay(midlet_instance).getCurrent() (and cast that into canvas since lwuit does infact uses canvas/gamecanvas as their displayable) and pass that to the GestureRegistrationManager.

Similar Threads

  1. please help,how to create slider menu in s40 using lwuit1.5
    By vikranttanwar@ in forum Mobile Java UI and User Experience
    Replies: 2
    Last Post: 2013-07-24, 06:10
  2. [moved] please help,how i show number of buttons on list in lwuit1.5
    By vikranttanwar@ in forum Mobile Java UI and User Experience
    Replies: 1
    Last Post: 2013-07-10, 15:27
  3. please help,event handling on label using lwuit1.5
    By vikranttanwar@ in forum Mobile Java General
    Replies: 4
    Last Post: 2013-07-10, 11:56
  4. [moved] please help,can we change in form of lwuit1.5
    By vikranttanwar@ in forum Mobile Java UI and User Experience
    Replies: 3
    Last Post: 2013-07-06, 22:48
  5. Svn link for lwuit1.5
    By kumarv75 in forum Mobile Java General
    Replies: 2
    Last Post: 2011-07-25, 14:37

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •