i have created one lable and RoundedEditField.but i am not able to make that RoundedEditField under the lable in blackberry with spcific margin.
How to do that..
hear is Code
enter code here
public class MyClass extends MainScreen implements FieldChangeListener {
ButtonField next;
Bitmap bit;
//String emp_id,emp_name,salary;
public MyClass()
{
bit=Bitmap.getBitmapResource("PlainScreen.png");
VerticalFieldManager v_mgr=new VerticalFieldManager()
//HorizontalFieldManager h_mgr = new HorizontalFieldManager()
{
protected void paint(Graphics graphics)
{
graphics.drawBitmap(0, 0, Display.getWidth(),Display.getHeight(), bit, 0, 0);
super.paint(graphics);
}
protected void sublayout(int maxWidth, int maxHeight) //It fit the image to device width and height.
{
super.sublayout(Display.getWidth(),Display.getHeight());
setExtent(Display.getWidth(),Display.getHeight());
}
};
HorizontalFieldManager hSecond = new HorizontalFieldManager(USE_ALL_WIDTH);
/*BasicEditField roundedBorderEdit = new BasicEditField();
XYEdges padding = new XYEdges(15, 15, 15, 15);
int color = Color.WHITE;
int lineStyle = Border.STYLE_FILLED;
Border roundedBorder = BorderFactory.createRoundedBorder(padding,
color, lineStyle);
roundedBorderEdit.setBorder(roundedBorder);
*/
LabelField lbl= new LabelField("LastName:", LabelField.FIELD_HCENTER | LabelField.NON_FOCUSABLE ){
protected void paint(Graphics g)
{
Font font1 = getFont();
g.setColor(Color.WHITE);
super.paint(g);
}};
BasicEditField lblName = new BasicEditField(" ","",50,BasicEditField.FIELD_HCENTER)
{
protected void paint(Graphics graphics)
{
Font font= getFont();
graphics.drawRoundRect(0, 0, 240, font.getHeight(), 30, 30);
graphics.setColor(Color.BLACK);
super.paint(graphics);
graphics.setColor(Color.WHITE);
super.paint(graphics);
}
};
hSecond.add(lbl);
hSecond.add(lblName);
hSecond.setMargin(0, 0, 0, 50);
hSecond.setPadding(5, 30, 20, 0);
v_mgr.add(hSecond);
//v_mgr.setPadding(0, 0, 0, 10);
HorizontalFieldManager hThird = new HorizontalFieldManager(USE_ALL_WIDTH);
LabelField lbl1= new LabelField("Number:",LabelField.FIELD_HCENTER | LabelField.NON_FOCUSABLE){
protected void paint(Graphics g)
{
Font font = getFont();
g.setColor(Color.WHITE);
super.paint(g);
}};
BasicEditField lblName1 = new BasicEditField(" ","",50,BasicEditField.FIELD_HCENTER)
{
protected void paint(Graphics graphics) {
Font font1= getFont();
graphics.drawRoundRect(0, 0, 240, font1.getHeight(), 30, 30);
graphics.setColor(Color.BLACK);
super.paint(graphics);
graphics.setColor(Color.WHITE);
super.paint(graphics);
}
};
//lblEmail.setFont(StaticVariables.font2);
hThird.add(lbl1);
hThird.add(lblName1);
hThird.setMargin(0, 0, 0, 50);
//PasswordEditField txtEmail = new PasswordEditField();
//hThird.add(txtEmail);
hThird.setPadding(5, 30, 20, 0);
v_mgr.add(hThird);
//v_mgr.setPadding(0, 0, 0, 10);
add(v_mgr);
}
public void fieldChanged(Field field, int context)
{
// TODO Auto-generated method stub
}
}
If you're wanting it to be under the LabelField, you'll need to put them in a VerticalFieldManager rather than a HorizontalFieldManager. This should work for you:
VerticalFieldManager vfm = new VerticalFieldManager();
LabelField lbl = new LabelField("Last Name:");
lbl.setMargin(0, 0, yourMargin, 0);
BasicEditField lblName = new BasicEditField() { // your rounded code };
vfm.add(lbl);
vfm.add(lblName);
hfmSecond.add(vfm);
On a side note, you may consider creating a RoundedBasicEditField (or whatever name you'd like) class so you don't have to keep anonymous classing BasicEditField inside the code (makes the code more readable, and easier to implement changes for all of them if you find something else you want to do).
Related
I want to add header.In header,i want to add background image..and two buttons.. in Blackberry.
so what i have to do??
I have tried following.. but it did not work..
VerticalFieldManager vfm=new VerticalFieldManager();
vfm.setBackground(BackgroundFactory.createBitmapBackground(Bitmap.getBitmapResource("topbar.png")));
setTitle(vfm);
try this -
final Bitmap bg = Bitmap.getBitmapResource("bg.png");
VerticalFieldManager vfm_mid = new VerticalFieldManager(Manager.NO_HORIZONTAL_SCROLL | Manager.NO_HORIZONTAL_SCROLLBAR | Manager.VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR | Field.USE_ALL_WIDTH){
public void paint(Graphics graphics) {
graphics.setBackgroundColor(0x040811);
graphics.clear();
graphics.drawBitmap(0, 0, bg.getWidth(),
bg.getHeight(), bg, 0, 0);
super.paint(graphics);
}
};
ButtonField b1=new ButtonField("Button 1");
ButtonField b2=new ButtonField("Button 2");
vfm_mid.add(b1);
vfm_mid.add(b2);
setTitle(vfm_mid);
try this custom header:
public class TopBar extends HorizontalFieldManager implements FieldChangeListener{
int width;
int height;
Bitmap bgBitmap;
Button btnHome;
Bitmap btnImage;
boolean isHome;
MainScreen screenFromNavigate;
LabelField lblTitle;
public TopBar(String title)
{
super(FIELD_HCENTER);
setLayout(title);
}
public void setLayout(String title)
{
this.width=Display.getWidth();
this.height=50;
this.bgBitmap= Bitmap.getBitmapResource("topbar.png");
this.isHome = isHomeBtn;
btnHome = new ButtonField("Button 1");
btnHome.setMargin(7, 0, 0, 15);
add(btnHome);
btnHome.setChangeListener(this);
lblTitle = new LabelField(title);
add(lblTitle);
lblTitle.setMargin(12, 0, 0,Display.getWidth()/2-160);
}
protected void sublayout(int maxWidth, int maxHeight)
{
maxWidth=width;
maxHeight=height;
super.sublayout(maxWidth, maxHeight);
setExtent(maxWidth, maxHeight);
}
protected void paint(Graphics graphics)
{
graphics.drawBitmap(0, 0, Display.getWidth(),50, bgBitmap, 0, 0);
// graphics.setBackgroundColor(Color.GRAY);
// graphics.clear();
super.paint(graphics);
}
public void fieldChanged(Field field, int context) {
// TODO Auto-generated method stub
}
}
}
call this:
TopBar topBar = new TopBar("Test");
setTitle(topBar);
How to create three editfields like this
HorizontalFieldManager hfm_city=new HorizontalFieldManager();
VerticalFieldManager vfm_city = new VerticalFieldManager();
vfm_city.setBorder(
BorderFactory.createBitmapBorder(
new XYEdges(12,12,12,12), borderBitmap
)
);
vfm_city.setMargin(0, 200, 0, 0);
final EditField city = new EditField("", "", 30, BasicEditField.FILTER_DEFAULT){
String emptyString = "City";
protected void paintBackground(Graphics g) {
g.setBackgroundColor(0xFFFFFF);
g.clear();
}
protected void paint(Graphics g) {
int oldColor = g.getColor();
try {
g.setColor(0x000000);
test = super.getText();
if ( test == null || test.length() < 1 ) {
//g.setColor(Config.hint_colour);
g.drawText(emptyString, 0, 0);
}
super.paint(g);
} finally {
g.setColor(oldColor);
}
}
};
vfm_city.add(city);
VerticalFieldManager vfm_state = new VerticalFieldManager();
vfm_state.setBorder(
BorderFactory.createBitmapBorder(
new XYEdges(12,12,12,12), borderBitmap
)
);
vfm_state.setMargin(0, 0, 0, 0);
final EditField state = new EditField("", "", 30, BasicEditField.FILTER_DEFAULT){
String emptyString = "State";
protected void paintBackground(Graphics g) {
g.setBackgroundColor(0xFFFFFF);
g.clear();
}
protected void paint(Graphics g) {
int oldColor = g.getColor();
try {
g.setColor(0x000000);
test = super.getText();
if ( test == null || test.length() < 1 ) {
//g.setColor(Config.hint_colour);
g.drawText(emptyString, 0, 0);
}
super.paint(g);
} finally {
g.setColor(oldColor);
}
}
};
vfm_state.add(state);
VerticalFieldManager vfm_zip = new VerticalFieldManager();
vfm_zip.setBorder(
BorderFactory.createBitmapBorder(
new XYEdges(12,12,12,12), borderBitmap
)
);
vfm_zip.setMargin(0, 0, 0, 0);
final EditField zip = new EditField("", "", 30, BasicEditField.FILTER_DEFAULT){
String emptyString = "Zip";
protected void paintBackground(Graphics g) {
g.setBackgroundColor(0xFFFFFF);
g.clear();
}
protected void paint(Graphics g) {
int oldColor = g.getColor();
try {
g.setColor(0x000000);
test = super.getText();
if ( test == null || test.length() < 1 ) {
//g.setColor(Config.hint_colour);
g.drawText(emptyString, 0, 0);
}
super.paint(g);
} finally {
g.setColor(oldColor);
}
}
};
vfm_zip.add(zip);
hfm_city.add(vfm_city);
hfm_city.add(vfm_state);
hfm_city.add(vfm_zip);
You are going in the right way. but you have to give specific width & height to yourVerticalFieldManager otherwise it will take full width by default.
VerticalFieldManager vfm_city = new VerticalFieldManager() {
protected void sublayout(int maxWidth, int maxHeight) {
super.sublayout(Display.getwidth()/3,30);
setExtent(Display.getwidth()/3,30);
}
};
Do this in your State & city vfm and add in your hfm and try.
Check my answer
{
Border bdr = BorderFactory.createRoundedBorder(new XYEdges(4, 4, 4, 4),Border.STYLE_SOLID);
VerticalFieldManager vert=new VerticalFieldManager()
{
protected void sublayout(int maxWidth, int maxHeight) {
super.sublayout(Display.getWidth(),Display.getHeight());
setExtent(Display.getWidth(),Display.getHeight());
}
};
HorizontalFieldManager hr=new HorizontalFieldManager(USE_ALL_HEIGHT)
{
protected void sublayout(int maxWidth, int maxHeight) {
super.sublayout(Display.getWidth(),50);
setExtent(Display.getWidth(),50);
}
};
hr.setBackground(BackgroundFactory.createSolidBackground(Color.GREEN));
EditField e1=new EditField(Field.FOCUSABLE|Field.FIELD_VCENTER){
protected void layout(int width, int height) {
super.layout(100,30);
setExtent(100,30);
}
};
EditField e2=new EditField(Field.FOCUSABLE|Field.FIELD_VCENTER){
protected void layout(int width, int height) {
super.layout(60,30);
setExtent(60,30);
}
};
EditField e3=new EditField(Field.FOCUSABLE|Field.FIELD_VCENTER){
protected void layout(int width, int height) {
super.layout(60,30);
setExtent(60,30);
}
};
e1.setBackground(BackgroundFactory.createSolidBackground(Color.WHITE));
e2.setBackground(BackgroundFactory.createSolidBackground(Color.WHITE));
e3.setBackground(BackgroundFactory.createSolidBackground(Color.WHITE));
e1.setPadding(0, 0, 0, 10);
e2.setPadding(0, 0, 0, 20);
e3.setPadding(0, 0, 0, 10);
e1.setBorder(bdr);
e2.setBorder(bdr);
e3.setBorder(bdr);
hr.add(e1);
hr.add(e2);
hr.add(e3);
vert.add(hr);
add(vert);
}
Hi please tell me how to make this screen in blackberry.
my data is not adding on it.i took vertical field manager to add all components.
Its working.. I created it for you. use this code
public class home extends UiApplication {
public static void main(String[] args)
{
home app = new home();
app.enterEventDispatcher();
}
MainScreen screen = new MainScreen();
private int deviceWidth = Display.getWidth();
private int deviceHeight = Display.getHeight();
LabelField lbl1 = new LabelField("label");
final Bitmap backgroundBitmap = Bitmap.getBitmapResource("bg1.jpg");
final Bitmap backgroundBitmap1 = Bitmap.getBitmapResource("bg2.jpg");
final BitmapField mybitmapField = new BitmapField(Bitmap.getBitmapResource("facebook-logo.jpg"),DrawStyle.HCENTER);
public home()
{
super();
pushScreen(screen);
VerticalFieldManager mainManager = new VerticalFieldManager(Manager.NO_VERTICAL_SCROLL | Manager.NO_VERTICAL_SCROLLBAR )
{
public void paint(Graphics graphics)
{
graphics.clear();
graphics.drawBitmap(0, 0, deviceWidth, deviceHeight, backgroundBitmap, 0, 0);
super.paint(graphics);
}
};
//this manger is used for adding the componentes
VerticalFieldManager subManager = new VerticalFieldManager(Manager.NO_VERTICAL_SCROLL | Manager.NO_VERTICAL_SCROLLBAR )
{
public void paint(Graphics graphics)
{
graphics.clear();
graphics.drawBitmap(0, 0, deviceWidth, deviceHeight, backgroundBitmap1, 0, 0);
super.paint(graphics);
}
};
screen.add(mainManager);
mainManager.add(lbl1);
mainManager.add(subManager);
subManager.add(mybitmapField);
subManager.add(new LabelField("Data 1"));
subManager.add(new LabelField("Data 1"));
subManager.add(new LabelField("Data 1"));
}
}
output will be like this.
Find an example of how to make this screen below:
VerticalFieldManager manager = new VerticalFieldManager();
VerticalFieldManager first = new VerticalFieldManager();
VerticalFieldManager second = new VerticalFieldManager();
first.add(label);
second.add(image);
second.add(data);
second.add(data);
second.add(data);
manager.add(first);
manager.add(second);
add(manager);
I am new to blackberry,This is my first question.I am doing one sample app for this i require multi line textbox.i googled about this,I found the code below.
VerticalFieldManager vfm =new VerticalFieldManager(Manager.VERTICAL_SCROLL)
{
public void paint(Graphics g)
{
g.drawRoundRect(0, 0,getWidth(), getHeight(),12,12);
super.paint(g);
}
public void sublayout(int width, int height)
{
if (managerWidth == 0) {
managerWidth = width;
}
if (managerHeight == 0) {
managerHeight = height;
}
super.sublayout(managerWidth, managerHeight);
setExtent(managerWidth,managerHeight);
}
};
editField = new EditField(){
public void paint(Graphics g) {
getManager().invalidate();
super.paint(g);
}
};
vfm.add(editField);
vfm.setBackground(BackgroundFactory.createSolidBackground(Color.WHITE));
add(vfm);
It works fine,if the text is less than Field height,if the text is greater than the field height.The text is crossing the border.How i fix that problem.Please help me.
You need to implement your own custom field.
Documentation can be found here: "Create a custom field"
You can use EditField from Blackberry APIs and use:
yourEditField.setBorder(yourBorder);
You will have then an edit field with a border and which accepts several lines
package nativeapp;
import net.rim.device.api.system.Bitmap;
import net.rim.device.api.system.Display;
import net.rim.device.api.ui.Color;
import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.FieldChangeListener;
import net.rim.device.api.ui.Graphics;
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.XYEdges;
import net.rim.device.api.ui.component.BitmapField;
import net.rim.device.api.ui.component.ButtonField;
import net.rim.device.api.ui.component.CheckboxField;
import net.rim.device.api.ui.component.Dialog;
import net.rim.device.api.ui.component.LabelField;
import net.rim.device.api.ui.container.HorizontalFieldManager;
import net.rim.device.api.ui.container.MainScreen;
import net.rim.device.api.ui.container.VerticalFieldManager;
import net.rim.device.api.ui.decor.Background;
import net.rim.device.api.ui.decor.BackgroundFactory;
import net.rim.device.api.ui.decor.Border;
import net.rim.device.api.ui.decor.BorderFactory;
public class LoginScreen extends MainScreen {
/**
* Login page
*/
private ButtonField btnLogin;
//private EditField txtUserID;
CustomTextBox txtUserID;
CustomTextBox txtPassword;
// private PasswordEditField txtPassword;
private CheckboxField Chkbox;
private LabelField RememberMe;
public LoginScreen() {
super(NO_VERTICAL_SCROLL);
txtUserID = new CustomTextBox() {
protected void paint(Graphics g) {
// Border roundedBorder = BorderFactory
// .createRoundedBorder(new XYEdges(9, 9, 9, 9),
// Color.GRAY, Border.STYLE_SOLID);
// setBorder(roundedBorder);
// setBackground(BackgroundFactory
// .createSolidBackground(Color.WHITE));
if (getText().length() == 0) {
g.setColor(Color.GRAY);
g.drawText("UserName", 0, 0);
}
g.setColor(Color.BLACK);
//g.drawRect(0, 0, (int) (Display.getWidth() / 1.5),
//txtUserID.getHeight()/* (int)(Display.getHeight()/9) */);
super.paint(g);
}
};
txtPassword = new CustomTextBox() {
protected void paint(Graphics g) {
Border roundedBorder = BorderFactory
.createRoundedBorder(new XYEdges(9, 9, 9, 9),
Color.GRAY, Border.STYLE_SOLID);
setBorder(roundedBorder);
setBackground(BackgroundFactory
.createSolidBackground(Color.WHITE));
if (getText().length() == 0) {
g.setColor(Color.GRAY);
g.drawText("txtPassword", 0, 0);
}
g.setColor(Color.BLACK);
super.paint(g);
}
};
// btnLogin = new ButtonField("SignIn");
btnLogin = new ButtonField("Sign In", Field.FIELD_HCENTER);
Chkbox = new CheckboxField();
// Chkbox.setMargin(0, 0, 0, 30);
RememberMe = new LabelField("Remember Me");
// RememberMe.setMargin(10, 0, 0, 0);
FieldChangeListener login = new FieldChangeListener() {
public void fieldChanged(Field field, int context) {
String uname = txtUserID.getText().toString().trim();
String pword = txtPassword.getText().toString().trim();
if (!uname.equalsIgnoreCase("")
&& !uname.equalsIgnoreCase(null)
&& !pword.equalsIgnoreCase("")
&& !pword.equalsIgnoreCase(null)) {
boolean lgnStatus = (new httpClient()).loginStatus(uname,
pword, DataURL.smartURLloginchk);
if (lgnStatus) {
PersistentsStore ps = new PersistentsStore();
ps.setObject(DataURL.UserName, uname);
ps.setObject(DataURL.PassWord, pword);
UiApplication.getUiApplication().popScreen(
LoginScreen.this);
UiApplication.getUiApplication().pushScreen(
new WelcomeScreen());
} else {
Dialog.inform("Invalid UserID or Password");
}
} else {
Dialog.inform("UserID and Password shouldnot be Empty");
}
}
};
FieldChangeListener cancel = new FieldChangeListener() {
public void fieldChanged(Field field, int context) {
}
};
btnLogin.setChangeListener(login);
// btnCancel.setChangeListener(cancel);
setLoginScreen();
}
private void setLoginScreen() {
VerticalFieldManager vfmForCenterDisplay = new VerticalFieldManager(
Field.FIELD_HCENTER | Field.FIELD_VCENTER | Field.USE_ALL_WIDTH
| Field.USE_ALL_HEIGHT) {
protected void sublayout(int maxWidth, int maxHeight) {
super.sublayout(maxWidth, maxHeight);
}
};
Background background = BackgroundFactory.createBitmapBackground(Bitmap
.getBitmapResource("bground.png"));
vfmForCenterDisplay.setBackground(background);
int topSpace = (Display.getHeight() / 4);
vfmForCenterDisplay.setPadding(topSpace, 0, 0, 0);
VerticalFieldManager vfmBasicInfoWithBorder1 = new VerticalFieldManager(
FIELD_HCENTER | FIELD_VCENTER) {
protected void sublayout(int maxWidth, int maxHeight) {
super.sublayout(250, 95);
}
};
BitmapField bitmapField = new BitmapField(
Bitmap.getBitmapResource("loginbg_01.png")) {
protected void layout(int width, int height) {
setExtent(250, 95);
}
};
vfmBasicInfoWithBorder1.add(bitmapField);
VerticalFieldManager vfmBasicInfoWithBorder2 = new VerticalFieldManager(
FIELD_HCENTER | FIELD_VCENTER) {
protected void sublayout(int maxWidth, int maxHeight) {
super.sublayout(250, 95);
}
};
vfmBasicInfoWithBorder2.setBackground(BackgroundFactory
.createBitmapBackground(Bitmap
.getBitmapResource("loginbg_02.jpg")));
VerticalFieldManager vfmBasicInfoWithBorder3 = new VerticalFieldManager(
FIELD_HCENTER | FIELD_VCENTER) {
protected void sublayout(int maxWidth, int maxHeight) {
super.sublayout(250, 95);
setExtent(250, 95);
}
};
vfmBasicInfoWithBorder3.setBackground(BackgroundFactory
.createBitmapBackground(Bitmap
.getBitmapResource("loginbg_03.png")));
vfmBasicInfoWithBorder3.add(btnLogin);
// btnLogin.setMargin(0, 0, 0, 0);
// HorizontalFieldManager hfm1 = new HorizontalFieldManager(
// Field.FIELD_HCENTER);
HorizontalFieldManager hfm2 = new HorizontalFieldManager(
Field.FIELD_VCENTER);
hfm2.add(txtUserID);
// txtUserID.setMargin(0, 0, 0, 0);
HorizontalFieldManager hfm3 = new HorizontalFieldManager(FIELD_HCENTER
& FIELD_VCENTER);
hfm3.add(txtPassword);
// txtPassword.setMargin(0, 0, 0, 10);
HorizontalFieldManager hfm4 = new HorizontalFieldManager(
Field.FIELD_HCENTER);
hfm4.add(Chkbox);
Chkbox.setMargin(0, 0, 0, 10);
hfm4.add(RememberMe);
RememberMe.setMargin(0, 0, 0, 10);
// HorizontalFieldManager hfm5 = new
// HorizontalFieldManager(FIELD_HCENTER
// & FIELD_VCENTER) {
// protected void sublayout(int maxWidth, int maxHeight) {
// super.sublayout(250, 95);
// }
// };
// hfm5.add(btnLogin);
// btnLogin.setMargin(0, 0, 0, 0);
// hfm5.add(btnCancel);
// hfm5.setPadding(new XYEdges(0, 0, 0, ((250 - (70 + 75)) / 2)));
// btnCancel.setMargin(0, 0, 0, 15);
// vfmBasicInfoWithBorder1.add(hfm1);
vfmBasicInfoWithBorder2.add(hfm2);
vfmBasicInfoWithBorder2.add(hfm3);
vfmBasicInfoWithBorder3.add(hfm4);
// vfmBasicInfoWithBorder3.add(hfm5);
vfmForCenterDisplay.add(vfmBasicInfoWithBorder1);
vfmForCenterDisplay.add(vfmBasicInfoWithBorder2);
vfmForCenterDisplay.add(vfmBasicInfoWithBorder3);
add(vfmForCenterDisplay);
}
}
hi all The below is my code .i try to remove black border color from popup window .i tried this but still i get small black border .
public class S2SPopup extends PopupScreen
{
public S2SPopup()
{
super(new VerticalFieldManager()
{
public void paint(Graphics g)
{
int a = g.getGlobalAlpha();
int c = g.getColor();
g.setColor(c);
g.drawBitmap(0, 0, HomeScreen.popupimg.getWidth(),HomeScreen.popupimg.getHeight(),HomeScreen.popupimg, 0, 0);
super.paint(g);
}
protected void sublayout(int maxWidth, int maxHeight)
{
super.sublayout( HomeScreen.popupimg.getWidth(),HomeScreen.popupimg.getHeight());
setExtent( HomeScreen.popupimg.getWidth(),HomeScreen.popupimg.getHeight());
}
});
setBackground(BackgroundFactory.createSolidTransparentBackground(Color.WHITE, 0));
VerticalFieldManager vfm_Label = new VerticalFieldManager(VerticalFieldManager.VERTICAL_SCROLL)
{
protected void sublayout(int maxWidth, int maxHeight)
{
super.sublayout(maxWidth,150);
setExtent(maxWidth, 150);
}
};
vfm_Label.setMargin(80, 0, 0, 0);
ButtonField btnclose = new ButtonField("",ButtonField.RIGHT)
{
public void paint(Graphics g)
{
//setBackground(BackgroundFactory.createSolidTransparentBackground(Color.WHITE, 0));
int c = g.getGlobalAlpha();
g.setBackgroundColor(c);
super.paint(g);
}
};
btnclose.setMargin(0, 0, 0, 250);
btnclose.setChangeListener(new FieldChangeListener() {
public void fieldChanged(Field field, int context)
{
close();
}
});
LabelField s2sLabelField = new LabelField()
{
public void paint(Graphics g)
{
g.setColor(Color.BLUE);
super.paint(g);
}
protected void layout(int width, int height)
{
super.layout(width, 150);
setExtent(width, 150);
}
};
s2sLabelField.setPadding(0, 50, 0, 30);
s2sLabelField.setText("lasjdfljlsjlfj ljsfdl jsflljfiowurnowncnvouern.zvovn ljlsfdjj jlj" +
"jsljfdlj ljsfl sjfl jfjsljdfljslfu jsjf;ujerpljsfdjpn sdflsajf ss23s mail jsldfjlfdju nsfjljljlfjmnn,nsf,n,nlojljlsndf,n,ljnsjfdljjufsn jj" +
"sjfd;jjljlsduflja;sfj ljsldfujrqnfqperiujf.zvnpqrue 33333333333333333333333333333333333333 ");
add(btnclose);
vfm_Label.add(s2sLabelField);
add(vfm_Label);
} //end of constructor
} // end of main screen
Override applyTheme with an empty implementation, and the black border goes away. You can't fix this from the constructor alone:
protected void applyTheme(){}
I doubt that it will correct this, but you may try giving your delegate manager a margin of 0 just to be certain that there isn't one on it and background color is creeping in from the theme. A solution that I have implemented in the past is to create your own custom Screen
public class CustomPopup extends Screen {
public CustomPopup() {
super(new VerticalFieldManager() {
//your custom code or a custom manager class (which is what I did)
);
setBackground(BackgroundFactory.createSolidTransparentBackground(0x000000, 0));
}
protected void sublayout(int width, int height) {
//make this screen take up the entire display
setPosition(0, 0);
setExtent(Display.getWidth(), Display.getHeight());
//and layout the delegate
setPositionDelegate(some_x, some_y);
layoutDelegate(some_width, some_height);
}
}
You'll have to add your own buttons and other graphics to it, but This should at least help point you in the right direction.