I am using jre 5 and a 9550 simulator in my system.. I have a problem in my app with scrolling the VerticalFieldManager..
I am calling a new Screen from my MainScreen java file..
The Code is like…
UiApplication.getUiApplication().invokeLater(new Runnable()
{
public void run()
{
try
{
UiApplication.getUiApplication().pushScreen(new CustomDialog());
}
catch (Exception e) {
Dialog.alert("loading Error");
}
}
});
And that CustomDialog.java is like…
public final class CustomDialog extends MainScreen
{
LabelField title, message;
HorizontalFieldManager hfm;
VerticalFieldManager vfm;
GridFieldManager gfm;
public CustomDialog()
{
super(Screen.DEFAULT_CLOSE);
hfm = new HorizontalFieldManager(Field.FIELD_LEFT);
title = new LabelField("hello User",FIELD_HCENTER)
{
protected void paint(Graphics graphics) {
graphics.setColor(Color.BROWN);
super.paint(graphics);
};
};
title.setFont(getFont().derive(Font.BOLD, 20));
hfm.add(title);
add(hfm);
vfm = new VerticalFieldManager(Manager.VERTICAL_SCROLL);
message = new LabelField("my text");//Actually a long text..
vfm.add(message);
VerticalFieldManager tmp = new VerticalFieldManager();
tmp.add(vfm);
add(tmp);
}
}
The message is displaying in the screen, but it is not scrolling..
Actually, the message is a long text, and i want to do scrolling for that VerticalFieldManager..
How can i get it scrolling?
To get the
VerticalFieldManagerscrolling, add focusableNullFieldobject before and after theLabelField.It will now scrolls from bottom to top of the Label at once and vice versa. To get rid of this problem use
RichTextField. It is the best choice for displaying long text. It itself handles scrolling vertically (line by line) and horizontally (character by character).