Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
dankolix
Posts: 100
Registered: ‎06-21-2010
My Device: Not Specified
Accepted Solution

Probably the simplest question ever

HI all,

 

Please whats the equivalent of JTextArea in Blackberry API?

 

Thanks,

 

Dan

Please use plain text.
Developer
simon_hain
Posts: 15,806
Registered: ‎07-29-2008
My Device: Z10 LE
My Carrier: O2 Germany

Re: Probably the simplest question ever

LabelField most likely. there are some other fields that provide added functionality, like RichTextField, Active... etc

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Developer
dankolix
Posts: 100
Registered: ‎06-21-2010
My Device: Not Specified

Re: Probably the simplest question ever

really? LabelField? I thought that was just for adding labels..

 

Sorry for not making myself very clear. What I am trying to do is make a simple chat program that looks like this (pictures are worth Kilo-words)

 

 

----------------------------------------------------------------------------------

|                                                                                                           |

|  ------------------------------------------------                                         |

|  |                                                               |                                        |

|  |                                                               |     --------------------        |

|  |                                                               |     |        send        |       |

|  |                    This                                   |      -------------------        |

|  |                        is                                    |                                       |

|  |                     the TextArea                    |                                       |

|  |                                                               |     -------------------         |

|  |                                                               |     |       quit         |          |

|  |                                                               |      -----------------           |

|  |                                                               |                                       |

|  |                                                               |                                       |

|  |                                                               |                                       |

|  ------------------------------------------------                                        |

|  ------------------------------------------------------------------                |

| |                                editfielfd                                          |              |

|  -------------------------------------------------------------------               |

---------------------------------------------------------------------------------

 

 

send and quit are buttons..

 

I want to have a text window for both the editfield and the TextArea. So when you type in the editfield and click send, it appears on the TextArea(which is not editable).

 

If i was using normal Java SE i would use JTextArea for both. What is the equivalent of that in BB? excuse the oversimplification ;-)

Please use plain text.
Developer
simon_hain
Posts: 15,806
Registered: ‎07-29-2008
My Device: Z10 LE
My Carrier: O2 Germany

Re: Probably the simplest question ever

i have used a listfield for the text area. each message is an object in the listfield.

another option would be to add one labelfield per message.

or use a labelfield for the whole area.

 

a labelfield is just a field to display text.

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Developer
dankolix
Posts: 100
Registered: ‎06-21-2010
My Device: Not Specified

Re: Probably the simplest question ever

i get what you mean simon, but i want it to look like a proper conventional JTextArea (chat window) with a whilte background and some border around it, without making the whole Screen have a white background.

Please use plain text.
Developer
simon_hain
Posts: 15,806
Registered: ‎07-29-2008
My Device: Z10 LE
My Carrier: O2 Germany

Re: Probably the simplest question ever

a textfield has no background per se. you have to overwrite paintbackground to create one.

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Developer
titakalpesh
Posts: 203
Registered: ‎07-30-2009
My Device: Bold(9780),Curve(8520)
My Carrier: Vodafone

Re: Probably the simplest question ever

Hi,

 

for that you have to create a custom FieldMenager that has the border then you can add the label to it so it will become same like chat area.

 

Thanks,

Tita

Please use plain text.
Developer
dankolix
Posts: 100
Registered: ‎06-21-2010
My Device: Not Specified

Re: Probably the simplest question ever

thanks titakapelsh,

 

One more thing, How do i make it scorllable? is there any properties in the FieldManager that would make it scrollable? or do I have to overwrite something again and draw the scrollbars myself? hope not

Please use plain text.
Developer
simon_hain
Posts: 15,806
Registered: ‎07-29-2008
My Device: Z10 LE
My Carrier: O2 Germany

Re: Probably the simplest question ever

i use a verticalfieldmanager with scrollable style.

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Developer
titakalpesh
Posts: 203
Registered: ‎07-30-2009
My Device: Bold(9780),Curve(8520)
My Carrier: Vodafone

Re: Probably the simplest question ever

Hi,

 

as simon said you can set the style property see below code.

 

VerticalFieldManager fieldManager2 = new VerticalFieldManager(VerticalFieldManager.VERTICAL_SCROLL);

 

and if you get it's working please mark it as solved

 

Thanks

Tita

Please use plain text.