jfisher I think I see where you might have run into problems
I'm going to re-paste the code here for brevity:
Code:
class ExtendedCustomMainScreen extends CustomMainScreen {
ExtendedCustomMainScreen() {
super();
RichTextField rtf = new RichTextField( "This is a readonly textfield", Field.READONLY );
LabelField helloWorld = new LabelField( "Hi jfisher!" );
add( rtf );
add( helloWorld );
}
}
class CustomMainScreen extends MainScreen {
private VerticalFieldManager _container;
CustomMainScreen() {
super( Manager.NO_VERTICAL_SCROLL | Manager.NO_VERTICAL_SCROLLBAR );
setTitle( "Test" );
VerticalFieldManager internalManager = new VerticalFieldManager( Manager.NO_VERTICAL_SCROLL | Manager.NO_VERTICAL_SCROLLBAR ) {
public void paintBackground( Graphics g ) {
g.clear();
int color = g.getColor();
g.setColor( 0xc0dce0 );
g.fillRect( 0, 0, Display.getWidth(), Display.getHeight() );
g.setColor( color );
}
protected void sublayout( int maxWidth, int maxHeight ) {
Field titleField = getMyTitleField();
int titleFieldHeight = 0;
if ( titleField != null ) {
titleFieldHeight = titleField.getHeight();
}
int displayWidth = Display.getWidth(); // I would probably make these global
int displayHeight = Display.getHeight();
super.sublayout( displayWidth, displayHeight - titleFieldHeight );
setExtent( displayWidth, displayHeight - titleFieldHeight );
}
};
_container = new VerticalFieldManager( Manager.VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR );
internalManager.add( _container );
super.add( internalManager );
}
public void add( Field field ) {
_container.add( field );
}
private Field getMyTitleField() {
Manager delegate = getDelegate();
Field titleField = null;
try {
titleField = delegate.getField( 0 );
}
catch ( IndexOutOfBoundsException ioobe ) {
//
}
return titleField;
}
}
class MainScreenWithBackgroundMain extends UiApplication {
public static void main( String[] args ) {
MainScreenWithBackgroundMain app = new MainScreenWithBackgroundMain();
app.enterEventDispatcher();
}
MainScreenWithBackgroundMain() {
ExtendedCustomMainScreen mainScreen = new ExtendedCustomMainScreen();
pushScreen( mainScreen );
}
}
I ran a few tests on it and they came out clean. Give her a shot.