BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 02-04-2010, 05:55 AM   #1 (permalink)
New Member
 
Join Date: Jan 2010
Model: 8310
PIN: N/A
Carrier: reliance
Posts: 2
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Custom Text edit Filed with Vertical Scroll

Please Login to Remove!

I tried hard to accomplish text input box the same as face book for blackberry application has finally i got through one great piece of code on the blackberry official web site Hope this will be useful to many of us.



import net.rim.device.api.ui.Graphics;
import net.rim.device.api.ui.Manager;
import net.rim.device.api.ui.component.EditField;
import net.rim.device.api.ui.container.VerticalFieldManag er;

public class CustomTextBox extends VerticalFieldManager {

//define some variables to be used
//in the class
private int managerWidth;
private int managerHeight;
private EditField editField;

public CustomTextBox(int width, int height) {
super(Manager.NO_VERTICAL_SCROLL);
managerWidth = width;
managerHeight = height;

VerticalFieldManager vfm =
new VerticalFieldManager
(Manager.VERTICAL_SCROLL);

editField = new EditField(){
public void paint(Graphics g) {
getManager().invalidate();
super.paint(g);
}
};

vfm.add(editField);
add(vfm);
}

public void paint(Graphics g) {
super.paint(g);
g.drawRect(0, 0, getWidth(), getHeight());
}

public void sublayout(int width, int height) {
if (managerWidth == 0) {
managerWidth = width;
}
if (managerHeight == 0) {
managerHeight = height;
}
super.sublayout(managerWidth, managerHeight);
setExtent(managerWidth,managerHeight);
}

public String getText() {
return editField.getText();
}
public void setText(String text) {
editField.setText(text);
}
}
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Vintage Brown & Sharpe No. 55 Micrometer Machinist Tool Pat'D Dec 30, 1902
$14.5
Vintage  Brown & Sharpe No. 55 Micrometer Machinist Tool Pat'D Dec 30, 1902 pictureVintage Rare DEC 290A H 9442 S13050-44 21064-CA 166 21-35023-14
$99.99
Vintage Rare DEC 290A H 9442 S13050-44 21064-CA 166 21-35023-14 pictureVintage Eldredge Electric Mfg., Co., Pocket Ammeter, Pat. Dec. 22, 1903.
$39.99
Vintage Eldredge Electric Mfg., Co., Pocket Ammeter, Pat. Dec. 22, 1903. pictureMetal Dress Form Mannequin Female Vintage Body Wire Stand Display Clothing Decor
$95.45
Metal Dress Form Mannequin Female Vintage Body Wire Stand Display Clothing Decor pictureVintage Magazine: PRINT dec. 2009 Graphic Design, Illustration--AWARDS
$13.44
Vintage Magazine: PRINT dec. 2009  Graphic Design, Illustration--AWARDS picture






Copyright 2004-2016 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.