Forums Register Login

Custom List

+Pie Number of slices to send: Send
Does anyone know of a custom item which implements a custom list?
+Pie Number of slices to send: Send
O Gur,

Please change your display name to conform to the JavaRanch naming policy, which you had agreed to when you signed up.

thanks.
Michael (the moderator)
+Pie Number of slices to send: Send
Oh sorry.
Back to my question, can you help me please, I need to write a custom item that implements a list behavior (MUST support text wrapping). I have succeeded in most parts of the custom item but for the text wrapping.

Thanks,

Ofer.
+Pie Number of slices to send: Send
Hi Ofer,

There is no component or class that provides what you need in MIDP. I also had to do something like that. For the text-wrapping part I wrote a function that takes a string and divides it into lines based on the width available.

What you need is Canvas.getWidth() to see what is the maximum width of the screen and then Font.getCharWidth() to find out how many chars can you have in one line. You should also check for whitespace to break on word boundary.
+Pie Number of slices to send: Send
Ofer,

Your name still does not conform to the requirement. Please read the link I provided above. You need a first name and a last name.

In MIDP 2, the Choice.TEXT_WRAP_DEFAULT variable controls whether the item wraps text. There is no need for a custom item.
+Pie Number of slices to send: Send
Ups, I have missed this one. Always good to learn something new, though.
To do a great right, do a little wrong - shakepeare. twisted little ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 856 times.
Similar Threads
What's your favorite open source library/project?
why to send generated Event Object to the EventListener ??
how JComboBox can have unique items ?
how to get child attribute in parent tag
creating listview dynamically with radio buttons
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 06:06:17.