0
  1. I want to use textfield in my j2me application where in want to give constraint that user can enter 4digit numeric data only?? How can it be possible.

    i had used this:-TxtField1.setConstraint(TextField.NUMERIC); Which makes my textfield numeric but can't had constraint which enter 4 digits only!

  2. I want to use Sprite class in LWUIT.

As i want to make clock timer type of application.That when user enter the time in textfield like (10,7,3 etc..) and press ok User can see the number below the screen moving 0,1,2....etc.Now i had taker the image of 0-9 number to give a better look.Now i want to change that image at run time.

Means when the number comes 25.Then i have to take the image of number 2 and 5 For this purpose i want sprite

Is there any other way i can do this!!

Can anyone please help me for this? Thanks in advance

ios developer
  • 3,363
  • 3
  • 51
  • 111

2 Answers2

2

Use a list of images fixed to the center and set selected index. You can also use a label with an image and use Container.replace() which allows you to assign a transition for the replace operation.

There is no need for sprites in LWUIT.

Shai Almog
  • 51,749
  • 5
  • 35
  • 65
1

Use setMaxSize(4) for limit the 4 digits only. AFAIK you can't use sprite with LWUIT. Why you want use Sprite with LWUIT?

bharath
  • 14,283
  • 16
  • 57
  • 95
  • You can achieve with LWUIT for this. See this article, [animation with LWUIT](http://today.java.net/pub/a/today/2008/11/20/animation-and-transition-with-lwuit.html) – bharath Jul 13 '11 at 13:31
  • thanxs for the reply/i am facing one other problem that when i had TxtNumber.setConstraint(TextField.NUMERIC); And execute the code it will not allowing me to write anything!can u please help me out – ios developer Jul 14 '11 at 05:02
  • 1
    Use `txtfield.setInputModeOrder(new String[] {"123"});` – bharath Jul 15 '11 at 10:44