BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 09-08-2010, 07:42 AM   #1 (permalink)
New Member
 
SergioTapia's Avatar
 
Join Date: Aug 2010
Model: 7100T
PIN: N/A
Carrier: asdfasdf
Posts: 12
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Why am I getting IndexOutOfBounds exceptions here?

Please Login to Remove!

I've done practically nothing on the application and I get this error. Why?

Thanks for the help!

Code:
import javax.microedition.lcdui.Display;

import net.rim.device.api.system.Bitmap;
import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.FieldChangeListener;
import net.rim.device.api.ui.Ui;
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.component.BasicEditField;
import net.rim.device.api.ui.component.BitmapField;
import net.rim.device.api.ui.component.ButtonField;
import net.rim.device.api.ui.component.Dialog;
import net.rim.device.api.ui.component.LabelField;
import net.rim.device.api.ui.component.RichTextField;
import net.rim.device.api.ui.component.SeparatorField;
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;

public class ExpenseManager extends UiApplication {
	public static void main(String[] args) {
		ExpenseManager theApp = new ExpenseManager();
		theApp.enterEventDispatcher();
	}

	public ExpenseManager() {
		pushScreen(new GeneralExpenseViewScreen());
	}
}

final class GeneralExpenseViewScreen extends MainScreen {
	public GeneralExpenseViewScreen() {
		super();
		LabelField title = new LabelField("TeamMate TEC | Expenses",
				LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH);
		setTitle(title);
		
		Background bg = BackgroundFactory.createSolidBackground(0xBDBDDB);
		setBackground(bg);
		
		HorizontalFieldManager headerAreaManager = new HorizontalFieldManager();
		HorizontalFieldManager filterAreaManager = new HorizontalFieldManager() {
			protected void sublayout(int width, int height) {
				setExtent(360, 95);
			}
		};
		HorizontalFieldManager expenseListAreaManager = new HorizontalFieldManager() {
			protected void sublayout(int width, int height) {
				setExtent(360, 200);
			}
		};		
		HorizontalFieldManager totalAreaManager = new HorizontalFieldManager() {
			protected void sublayout(int width, int height) {
				setExtent(360, 45);
			}
		};
		HorizontalFieldManager addNewAreaManager = new HorizontalFieldManager() {
			protected void sublayout(int width, int height) {
				setExtent(360, 103);
			}
		};
		
		filterAreaManager.setBackground(bg);
		expenseListAreaManager.setBackground(bg);
		totalAreaManager.setBackground(bg);
		addNewAreaManager.setBackground(bg);
		
		add(headerAreaManager);
		add(filterAreaManager);
		add(expenseListAreaManager);
		add(totalAreaManager);
		add(addNewAreaManager);
		
		/**Begin form layouts**/
		
		Bitmap headerImage = Bitmap.getBitmapResource("sergioheader.png");
		BitmapField header = new BitmapField(headerImage);
		headerAreaManager.add(header);
		
	}

	public boolean onClose() {
		Dialog.alert("AH!");
		System.exit(0);
		return true;
	}
}

Edit: Just tried out creating a VerticalFieldManager using the same code as above and I do not get the errors...Why is this? Thanks.

Last edited by SergioTapia : 09-08-2010 at 08:02 AM.
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





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