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
Contributor
Posts: 17
Registered: ‎04-16-2011
My Device: 7100T
My Carrier: BB

JVM Exception illegal Stack Size

Hi,

 

I am using 8520 simulaor, when I run project on this simulator, i am getting JVM Exception illegal Stack Size

 

But when I run on other simulator is working fine

 

my code is here Please help

 

package com.budgettracker.views;

import in.com.locale.BudgetTrackerResource;

import java.util.Calendar;
import java.util.Date;
import java.util.Vector;

import net.rim.device.api.i18n.ResourceBundle;
import net.rim.device.api.i18n.SimpleDateFormat;
import net.rim.device.api.io.http.HttpDateParser;
import net.rim.device.api.system.Bitmap;
import net.rim.device.api.system.Characters;
import net.rim.device.api.system.Display;
import net.rim.device.api.system.EncodedImage;
import net.rim.device.api.system.PersistentObject;
import net.rim.device.api.system.PersistentStore;
import net.rim.device.api.ui.Color;
import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.Font;
import net.rim.device.api.ui.Graphics;
import net.rim.device.api.ui.Manager;
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.XYEdges;
import net.rim.device.api.ui.XYRect;
import net.rim.device.api.ui.component.BitmapField;
import net.rim.device.api.ui.component.Dialog;
import net.rim.device.api.ui.component.LabelField;
import net.rim.device.api.ui.component.ListField;
import net.rim.device.api.ui.component.ListFieldCallback;
import net.rim.device.api.ui.component.NullField;
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.BackgroundFactory;
import net.rim.device.api.ui.decor.Border;
import net.rim.device.api.ui.decor.BorderFactory;
import net.rim.device.api.util.DateTimeUtilities;

import com.budgettracker.manager.TabManager;
import com.budgettracker.util.Advertisment;
import com.budgettracker.util.DataabaseController;
import com.budgettracker.util.Globalvalue;
import com.budgettracker.util.categoryTempClass;

public class CategoryPlan extends MainScreen implements BudgetTrackerResource {
EncodedImage titleEncodeBgImg = EncodedImage.getEncodedImageResource("images/name_header_back.png");
EncodedImage backGroundEncodeImg = EncodedImage.getEncodedImageResource("background.png");
EncodedImage rowBgImgEncode = EncodedImage.getEncodedImageResource("images/table_view_background.png");
Bitmap titleBgImg,backGroundImg,rowBgImg;
EncodedImage selrowBgImgEncode = EncodedImage.getEncodedImageResource("images/table_view_background_select.png");
public Bitmap selRowImage;
VerticalFieldManager categoryPlanVerticalManager;
planTaskField categoryField;
Bitmap arrowImg;
EncodedImage arrowEncodeImage = EncodedImage.getEncodedImageResource("images/arrow.png");
String[] arr = null;
String amount,weekLabel;
Vector arrSelectCategoryElement;
double totalAmount;
String planSaving;
double planedSaving,planedExpense ;
DataabaseController objDatbase = new DataabaseController();
int mDayOfMonth,mMonth, mYear;
public static Bitmap plusImg,plusSelectImg;
EncodedImage plusEncodeImage = EncodedImage.getEncodedImageResource("images/plus.png");
EncodedImage plusSelectEncodeImage = EncodedImage.getEncodedImageResource("images/plus_select.png");
private ResourceBundle _resources=ResourceBundle.getBundle(BudgetTrackerResource.BUNDLE_ID, BudgetTrackerResource.BUNDLE_NAME);
public static PersistentObject storePlanAmount;
public static final long PERSISTENT_KEY = Globalvalue.planAmountKey ;
static {
storePlanAmount = PersistentStore.getPersistentObject( PERSISTENT_KEY );
}
static PersistentObject purchase_store;
static {
purchase_store = PersistentStore.getPersistentObject( Globalvalue.purchaseKey );
}
Vector v;
int[] colorCode = {0x0041FC03,0x00FC0303,0x00E3FB07,0x005007FB,0x0007FBF3,0x008D07FB,0x00F707FB,0x00419188,0x00415591};
public CategoryPlan() {
super(NO_VERTICAL_SCROLL);
// TODO Auto-generated constructor stub
TabManager tabObj = new TabManager();
VerticalFieldManager tabVfm = tabObj.getTabScreen(2);
add(tabVfm);
NullField field = new NullField();
add(field);
field.setFocus();
/**
*
* Showing the Advertisment
*/
Advertisment adverObj = new Advertisment();
VerticalFieldManager advVfm= adverObj.getAdvertiesment();
setStatus(advVfm);
/* if (purchase_store.getContents() == null) {
Advertisment adverObj = new Advertisment();
VerticalFieldManager advVfm= adverObj.getAdvertiesment();
setStatus(advVfm);
}*/
if (storePlanAmount.getContents() != null) {
String dateInString =new SimpleDateFormat("yyyy-MM-dd").format(new Date());
String date = dateInString.substring(0, 7);
arr = (String[]) storePlanAmount.getContents();
if (arr[0].equals("Monthly")) {
arrSelectCategoryElement = objDatbase.insertCategoryElement(arr[0],date,"");
} else {
String strDate = doIt();
String finishDate = add7days(strDate);
arrSelectCategoryElement = objDatbase.insertCategoryElement(arr[0],strDate,finishDate);
}
}
if ( arrSelectCategoryElement != null && arrSelectCategoryElement.size() > 0 ) {
for (int i = 0; i < arrSelectCategoryElement.size(); i++) {
categoryTempClass catObj = (categoryTempClass) arrSelectCategoryElement.elementAt(i);
totalAmount += Double.parseDouble(catObj.getCategoryAmount());
}
}
rowBgImg = Globalvalue.setImage(rowBgImgEncode,1);
titleBgImg = Globalvalue. setImage(titleEncodeBgImg,0);
selRowImage = Globalvalue.setImage(selrowBgImgEncode,1);
arrowImg = Globalvalue. setArrowImage(arrowEncodeImage);
backGroundImg = Globalvalue.setBackGroundImage(backGroundEncodeImg);
HorizontalFieldManager hrManager = new HorizontalFieldManager(USE_ALL_WIDTH|HorizontalFieldManager.FIELD_VCENTER|HorizontalFieldManager.FIELD_HCENTER) {
protected void paintBackground(Graphics graphics) {
try {
graphics.drawBitmap(0, 0, titleBgImg.getWidth(), titleBgImg.getHeight(), titleBgImg, 0, 0);
super.paint(graphics);
} catch (Exception e) {
// TODO: handle exception
}
}
protected void sublayout(int maxWidth, int maxHeight) {
// TODO Auto-generated method stub
try {
super.sublayout(maxWidth, maxHeight);
setPositionChild( getField(0),(int) (Display.getWidth()/2.4),8);
layoutChild( getField(0),getField(0).getWidth(), getField(0).getHeight());

if (Display.getWidth() == 320) {
setPositionChild( getField(1),(int) (Display.getWidth()-35),5);
layoutChild( getField(1),getField(1).getWidth(), getField(1).getHeight());
} else {
setPositionChild( getField(1),(int) (Display.getWidth()-45),4);
layoutChild( getField(1),getField(1).getWidth(), getField(1).getHeight());
}
if (Display.getWidth() == 320) {
setExtent(Display.getWidth(), 30);
} else {
setExtent(Display.getWidth(), 40);
}
} catch (Exception e) {
// TODO: handle exception
}

}
};
arrowImg = Globalvalue.setArrowImage(arrowEncodeImage);
plusSelectImg = Globalvalue.setAddImage(plusSelectEncodeImage);
plusImg = Globalvalue.setAddImage(plusEncodeImage);
BitmapField arrowImageField = new BitmapField(plusImg,BitmapField.FOCUSABLE|FIELD_RIGHT){
protected void paint(Graphics graphics) {
// TODO Auto-generated method stub
try {
super.paint(graphics);
if (isFocus()) {
graphics.drawBitmap(0, 0, plusSelectImg.getWidth(), plusSelectImg.getHeight(), plusSelectImg, 0, 0);
} else {
graphics.drawBitmap(0, 0, plusImg.getWidth(), plusImg.getHeight(), plusImg, 0, 0);
}
} catch (Exception e) {
// TODO: handle exception
}

}
protected void drawFocus(Graphics graphics, boolean on) {
// TODO Auto-generated method stub
if (on) {
graphics.clear(0, 0, 0, 0);
}
}
protected boolean navigationClick(int status, int time) {
// TODO Auto-generated method stub
arr = (String[]) storePlanAmount.getContents();
UiApplication.getUiApplication().pushScreen(new AddCategoryPlanView(totalAmount,arr[0]));
return super.navigationClick(status, time);
}
};
LabelField title = new LabelField(_resources.getString(FIELD_PLAN_TAB),FIELD_HCENTER){
protected void paint(Graphics graphics) {
// TODO Auto-generated method stub
try {
graphics.setColor(0x005f3f1f);
if (Display.getWidth() == 480) {
setFont(Font.getDefault().derive(Font.PLAIN, 22));
}
super.paint(graphics);
} catch (Exception e) {
// TODO: handle exception
}
}
};
hrManager.add(title);
hrManager.add(arrowImageField);
add(hrManager);
addElement();
categoryPlanVerticalManager=new VerticalFieldManager(VERTICAL_SCROLL|VERTICAL_SCROLLBAR){
protected void paint(Graphics graphics) {
// TODO Auto-generated method stub
try {
graphics.drawBitmap(0, 0, backGroundImg.getWidth(), backGroundImg.getHeight(), backGroundImg, 0, 0);
super.paint(graphics);
} catch (Exception e) {
// TODO: handle exception
}

}
};

HorizontalFieldManager hfm = new HorizontalFieldManager();
if (storePlanAmount.getContents() != null) {
arr = (String[]) storePlanAmount.getContents();
// System.out.println(totalAmount);
planedSaving = Double.parseDouble(arr[1])-totalAmount;
}
planSaving = ""+planedSaving;
if (planSaving.indexOf(".") != -1) {
if (Globalvalue.NumberDecimalPlaces(Double.parseDouble(planSaving)) == 1) {
planSaving = planSaving.concat("0");
} else {
planSaving = Globalvalue.roundTwoDecimals(Double.parseDouble(planSaving));
}
} else {
planSaving = ""+planedSaving+".00";
}
hfm.add(new LabelField(_resources.getString(FIELD_PLAN_SAVING_LABEL)+": "+planSaving){
protected void paint(Graphics graphics) {
// TODO Auto-generated method stub
try {
graphics.setColor(Color.GREEN);
if (Display.getWidth() == 320) {
setFont(Font.getDefault().derive(Font.BOLD, 15));
} else {
setFont(Font.getDefault().derive(Font.BOLD, 20));
}
super.paint(graphics);
} catch (Exception e) {
// TODO: handle exception
}
}
});
hfm.setPadding(5, 0, 0, 20);
// add(hfm);
categoryPlanVerticalManager.add(hfm);

/***
* For Color bar
*/
HorizontalFieldManager colorManager = new HorizontalFieldManager(){
protected void paint(Graphics graphics) {
// TODO Auto-generated method stub
try {
setBackground(BackgroundFactory.createSolidBackground(Color.LIGHTGREEN));
super.paint(graphics);
} catch (Exception e) {
// TODO: handle exception
}
}
protected void sublayout(int maxWidth, int maxHeight) {
// TODO Auto-generated method stub
try {
super.sublayout(maxWidth, maxHeight);
if (Display.getWidth() == 320) {
setExtent(Display.getWidth()-10, 25);
} else {
setExtent(Display.getWidth()-10, 35);
}
} catch (Exception e) {
// TODO: handle exception
}

}
};
colorManager.setMargin(5, 0, 0, 0);
colorManager.setBorder(BorderFactory.createRoundedBorder(new XYEdges(6,6,6,6),Color.LIGHTSLATEGRAY,Border.STYLE_FILLED),true);
// add(colorManager);
categoryPlanVerticalManager.add(colorManager);
HorizontalFieldManager hfm1 = new HorizontalFieldManager();
if (storePlanAmount.getContents() != null) {
arr = (String[]) storePlanAmount.getContents();
planedExpense = totalAmount;
}
planSaving = ""+planedExpense;
if (planSaving.indexOf(".") != -1) {
if (Globalvalue.NumberDecimalPlaces(Double.parseDouble(planSaving)) == 1) {
planSaving = planSaving.concat("0");
} else {
planSaving = Globalvalue.roundTwoDecimals(Double.parseDouble(planSaving));
}
} else {
planSaving = ""+planSaving+".00";
}
hfm1.add(new LabelField(_resources.getString(FIELD_PLAN_EXPENSE_LABEL)+": "+planSaving){
protected void paint(Graphics graphics) {
// TODO Auto-generated method stub
try {
graphics.setColor(Color.GREEN);
if (Display.getWidth() == 320) {
setFont(Font.getDefault().derive(Font.BOLD, 15));
} else {
setFont(Font.getDefault().derive(Font.BOLD, 20));
}
super.paint(graphics);
} catch (Exception e) {
// TODO: handle exception
}
}
});
hfm1.setPadding(5, 0, 0, 20);
categoryPlanVerticalManager.add(hfm1);
if (arrSelectCategoryElement != null && arrSelectCategoryElement.size()>0) {
try {
for (int i = 0; i < arrSelectCategoryElement.size(); i++) {
categoryTempClass catObj = (categoryTempClass) arrSelectCategoryElement.elementAt(i);
arr = (String[]) storePlanAmount.getContents();
int width =(int) ((Double.parseDouble(catObj.getCategoryAmount())*Display.getWidth()) /Double.parseDouble(arr[1]));
System.out.println(width);
colorManager.add(addColorLabel(width, Integer.parseInt(catObj.getCategoryColor(),16)));
}
} catch (Exception e) {
// TODO: handle exception
}
}

categoryField = new planTaskField(){
protected boolean navigationClick(int status, int time) {
// TODO Auto-generated method stub
arr = (String[]) storePlanAmount.getContents();
UiApplication.getUiApplication().pushScreen(new EditAmount(totalAmount,arrSelectCategoryElement,categoryField.getSelectedIndex(),arr[0]));
return super.navigationClick(status, time);
}
};
categoryField.setPadding(10, 0, 0, 0);
categoryPlanVerticalManager.add(categoryField);
add(categoryPlanVerticalManager);

}
private String doIt() {
Calendar c = Calendar.getInstance();
c.setTime(new Date(System.currentTimeMillis()));
mYear = c.get(Calendar.YEAR);
mMonth = c.get(Calendar.MONTH);
mDayOfMonth = c.get(Calendar.DAY_OF_MONTH);
int dateOfWeek = c.get(Calendar.DAY_OF_WEEK)-1;
c.set(Calendar.MONTH, mMonth);
c.set(Calendar.DAY_OF_MONTH, mDayOfMonth);
c.set(Calendar.YEAR, mYear);
long ctime = c.getTime().getTime();
long ctimeMinus4Days = ctime - dateOfWeek * ((long)DateTimeUtilities.ONEDAY); // not usre the 'longs are needed
c.setTime(new Date(ctimeMinus4Days));
String dateInString =new SimpleDateFormat("yyyy-MM-dd").format(new Date(ctimeMinus4Days));
return dateInString;

}
private String add7days(String date) {
Calendar c = Calendar.getInstance();
long d = HttpDateParser.parse(date);
Date newDate = new Date(d);
c.setTime(newDate);
mYear = c.get(Calendar.YEAR);
mMonth = c.get(Calendar.MONTH);
mDayOfMonth = c.get(Calendar.DAY_OF_MONTH);
int dateOfWeek = c.get(Calendar.DAY_OF_WEEK)-1;
c.set(Calendar.MONTH, mMonth);
c.set(Calendar.DAY_OF_MONTH, mDayOfMonth);
c.set(Calendar.YEAR, mYear);
long ctime = c.getTime().getTime();
long ctimeMinus4Days = ctime + 7 * ((long)DateTimeUtilities.ONEDAY); // not usre the 'longs are needed
c.setTime(new Date(ctimeMinus4Days));
String dateInString =new SimpleDateFormat("yyyy-MM-dd").format(new Date(ctimeMinus4Days));
//System.out.println(dateInString);
return dateInString;

}
public LabelField addColorLabel(final int wdth,final int color) {
LabelField lbl = new LabelField(){
protected void paint(Graphics graphics) {
// TODO Auto-generated method stub
try {
setBackground(BackgroundFactory.createSolidBackground(color));
super.paint(graphics);
} catch (Exception e) {
// TODO: handle exception
}
}
protected void layout(int width, int height) {
try {
super.layout(width, height);
setExtent(wdth, 35);
} catch (Exception e) {
// TODO: handle exception
}

}
};
return lbl;
}
protected boolean keyChar(char c, int status, int time) {
// TODO Auto-generated method stub
if (c == Characters.ESCAPE) {
System.exit(0);
}
return super.keyChar(c, status, time);
}
private void addElement() {
// TODO Auto-generated method stub
VerticalFieldManager vManager = new VerticalFieldManager();
HorizontalFieldManager hfm = new HorizontalFieldManager();
BitmapField rowImg = new BitmapField(rowBgImg,FOCUSABLE){

protected boolean navigationClick(int status, int time) {
// TODO Auto-generated method stub
UiApplication.getUiApplication().pushScreen(new AddAmountPlanView(totalAmount));
return super.navigationClick(status, time);
}
protected void paint(Graphics graphics) {
// TODO Auto-generated method stub
try {
super.paint(graphics);
if (isFocus()) {
graphics.drawBitmap(0, 0, selRowImage.getWidth(), selRowImage.getHeight(), selRowImage, 0, 0);

}
graphics.setColor(0x005f3f1f);
if (storePlanAmount.getContents() != null) {
arr = (String[]) storePlanAmount.getContents();
if (arr[0].equals("Monthly")) {
weekLabel = _resources.getString(FIELD_MONTHLY_LABEL);
} else {
weekLabel = _resources.getString(FIELD_WEEKLY_LABEL);
}
graphics.drawText(weekLabel, 20, (rowBgImg.getHeight()/3-3), 0, Display.getWidth());
if (arr[1].indexOf(".") != -1) {
if (Globalvalue.NumberDecimalPlaces(Double.parseDouble(arr[1])) == 1) {
amount = arr[1]+"0";
} else {
amount = Globalvalue.roundTwoDecimals(Double.parseDouble(arr[1]));
}
} else {
amount = arr[1]+".00";
}
graphics.drawText(Globalvalue.getCurrency+" "+amount, Display.getWidth()-140, (rowBgImg.getHeight()/3-3), 0, Display.getWidth());
}
if (Display.getWidth() == 480 || Display.getWidth() == 360) {
setFont(Font.getDefault().derive(Font.BOLD, 18));
}
if (Display.getWidth() == 320) {
graphics.drawBitmap(Display.getWidth()-30,(rowBgImg.getHeight()/3-5),arrowImg.getWidth(),arrowImg.getHeight(),arrowImg,0,0);
} else {
graphics.drawBitmap(Display.getWidth()-30,(rowBgImg.getHeight()/3-8),arrowImg.getWidth(),arrowImg.getHeight(),arrowImg,0,0);
}
} catch (Exception e) {
// TODO: handle exception
}
}

};

hfm.add(rowImg);
vManager.add(hfm);
add(vManager);

}

/* public boolean onClose() {
String[] choices = { "Yes", "No" };
int choice = Dialog.ask("Do you Want to Exit?", choices, 0);
if (choice == 0) {
System.exit(0);
}
return false;
}*/
class offerTableRowManager extends Manager {
// Bitmap rowBgImg =
// Bitmap.getBitmapResource("img/results_listview_background.png");
public offerTableRowManager() {
super(0);
}

// Causes the fields within this row manager to be layed out then
// painted.

public void drawRow(Graphics g, int x, int y, int width, int height) {
// Arrange the cell fields within this row manager.
layout(width, height);

// Place this row manager within its enclosing list.
setPosition(x, y);

// Apply a translating/clipping transformation to the graphics
// context so that this row paints in the right area.
g.pushRegion(getExtent());

// Paint this manager's controlled fields.
subpaint(g);
// Restore the graphics context.
g.popContext();
}

// Arranges this manager's controlled fields from left to right within
// the enclosing table's columns.
protected void sublayout(int width, int height) {
// set the size and position of each field.

int preferredWidth = getPreferredWidth();

Field field = getField(0);
layoutChild(field, (int) (Display.getWidth() / 2.5), 100);
setPositionChild(field, 15, 10);

// CategoryName field
field = getField(1);
layoutChild(field, (int) (Display.getWidth() / 2.5), 100);
setPositionChild(field, 60, 10);

// Amount field
int fontHeight = Font.getDefault().getHeight();
field = getField(2);
layoutChild(field, (int) (Display.getWidth() / 1.5), fontHeight + 1);
setPositionChild(field, (int) (Display.getWidth() / 1.5), 10);
setExtent(preferredWidth, getPreferredHeight());
}

// The preferred width of a row is defined by the list renderer.
public int getPreferredWidth() {
return Display.getWidth();
}

// The preferred height of a row is the "row height" as defined in the
// enclosing list.
public int getPreferredHeight() {
return rowBgImg.getHeight();
}
}

class planTaskField extends ListField implements ListFieldCallback {
private Vector rows;
private Bitmap bt_media;
ListFieldCallback listCallback;
BitmapField imgMedia;
offerTableRowManager row;
EncodedImage encode_media;
// final Bitmap bm_sel = Bitmap.getBitmapResource("images/results_listview_background_select.png");
// Bitmap img = Bitmap.getBitmapResource("images/arrow.png");
// Bitmap squareImg = Bitmap.getBitmapResource("images/square.png");
int[] colorCode = {0x00FC0303,0x0041FC03,0x00E3FB07,0x005007FB,0x0007FBF3,0x008D07FB,0x00F707FB,0x00419188,0x00415591};
boolean _inFocus = false;
int i;
String amt ;
Bitmap squareImg ;
EncodedImage squareImgEncode = EncodedImage.getEncodedImageResource("images/square.png");
public boolean isFocusable() {
// TODO Auto-generated method stub
return true;
}

public void onFocus(int direction) {
_inFocus = true;
super.onFocus(direction);
this.invalidate();
}

public void onUnfocus() {
_inFocus = false;
super.onUnfocus();
this.invalidate();
}
public planTaskField() {
super(0, 0);
squareImg = Globalvalue.setSquareImage(squareImgEncode);
setRowHeight(rowBgImg.getHeight());
setCallback(this);
try {
rows = new Vector();
if (arrSelectCategoryElement != null && arrSelectCategoryElement.size() > 0) {
for ( i = 0; i < arrSelectCategoryElement.size()-1; i++) {
categoryTempClass obj = (categoryTempClass) arrSelectCategoryElement.elementAt(i);
row = new offerTableRowManager();
String color = obj.getCategoryColor();
BitmapLable squreImageField = new BitmapLable(squareImg,Integer.parseInt(obj.getCategoryColor(), 16)){
protected void paint(Graphics graphics) {
// TODO Auto-generated method stub
super.paint(graphics);
graphics.setBackgroundColor(colorId);
graphics.clear();
}

};
row.add(squreImageField);
ListLabel categoryName = new ListLabel(this,i,obj.getCategoryName());
categoryName.setFont(Font.getDefault().derive(Font.BOLD, 18));
row.add(categoryName);
amt = obj.getCategoryAmount();
if (amt.indexOf('.') == -1) {
amt = Globalvalue.getCurrency+" "+obj.getCategoryAmount()+".00";
} else {
amt = Globalvalue.getCurrency+" "+obj.getCategoryAmount();
}
ListLabel categoryAmount = new ListLabel(this,i,amt);
categoryAmount.setFont(Font.getDefault().derive(Font.BOLD, 18));
row.add(categoryAmount);
rows.addElement(row);

}
}

setSize(rows.size());
} catch (Exception e) {
e.printStackTrace();

}
}

public void drawListRow(ListField listField, Graphics g, int index,
int y, int width) {
planTaskField list = (planTaskField) listField;
offerTableRowManager rowManager = (offerTableRowManager) rows
.elementAt(index);
if (g.isDrawingStyleSet(Graphics.DRAWSTYLE_FOCUS)) {

g.drawBitmap(new XYRect(0, y, width, list.getRowHeight()),
selRowImage, 0, 0);
}

else {
g.drawBitmap(new XYRect(0, y, width, list.getRowHeight()),
rowBgImg, 0, 0);
}

rowManager.drawRow(g, 0, y, width, list.getRowHeight());
g.drawBitmap(width-30,y+(arrowImg.getHeight()/7),arrowImg.getWidth(),arrowImg.getHeight(),arrowImg,0,0);
}

public Object get(ListField list, int index) {
return rows.elementAt(index);
}

public int indexOfList(ListField listField, String prefix, int start) {
return listField.getSelectedIndex();
}

public int getPreferredWidth(ListField list) {
return Display.getWidth();
}

class ListLabel extends LabelField {
int mIndex = -1;

public ListLabel(planTaskField list, int index, String text) {
super(text);
mIndex = index;
}

protected void paint(Graphics graphics) {
// TODO Auto-generated method stub
graphics.setColor(0x005f3f1f);
super.paint(graphics);
}
}
class BitmapLable extends BitmapField {
int colorId;
Bitmap bitImg;
public BitmapLable( Bitmap bitImg, int colorId) {
super(bitImg);
this.bitImg = bitImg;
this.colorId = colorId;
}

public Bitmap getBitImg() {
return bitImg;
}

public void setBitImg(Bitmap bitImg) {
this.bitImg = bitImg;
}

public int getColorId() {
return colorId;
}
public void setColorId(int colorId) {
this.colorId = colorId;
}
}

}
}

class tempClass {

int categoryId;
String categoryName;
String categoryAmount;

public tempClass(int _categoryId, String _categoryName,
String _categoryAmount) {
categoryId = _categoryId;
categoryName = _categoryName;
categoryAmount = _categoryAmount;
}

public int getCategoryId() {
return categoryId;
}

public void setCategoryId(int categoryId) {
this.categoryId = categoryId;
}

public String getCategoryName() {
return categoryName;
}

public void setCategoryName(String categoryName) {
this.categoryName = categoryName;
}

public String getCategoryAmount() {
return categoryAmount;
}

public void setCategoryAmount(String categoryAmount) {
this.categoryAmount = categoryAmount;
}

}

Developer
Posts: 17,012
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: JVM Exception illegal Stack Size

maybe you could use the code tags to format the code a bit better. i did not read all of it, but this could possibly cause issues:

if (Display.getWidth() == 320) {
setFont(Font.getDefault().derive(Font.BOLD, 15));
} else {
setFont(Font.getDefault().derive(Font.BOLD, 20));
}

setFont can cause an invalidate, which in turn calls paint, so you get a loop there.
if you want to change the font of your graphics object, call graphics.setFont, if you want to change it on the screen use another method like onUiEngineAttached.
----------------------------------------------------------
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