09-06-2011 03:19 PM
Ok, I went back to the original code from http://supportforums.blackberry.com/t5/Java-Develo
package uid.rim.uidchecker; import net.rim.device.api.ui.Color; import net.rim.device.api.ui.Graphics; import net.rim.device.api.ui.Manager; import net.rim.device.api.ui.component.EditField; import net.rim.device.api.ui.container.VerticalFieldManager; public class TextBoxField extends Manager { int managerWidth; int managerHeight; private VerticalFieldManager vfm = new VerticalFieldManager(VERTICAL_SCROLL | VERTICAL_SCROLLBAR | USE_ALL_WIDTH | USE_ALL_HEIGHT); private EditField editField = new EditField("", "", EditField.DEFAULT_MAXCHARS, FOCUSABLE); TextBoxField(int width, int height, long style) { super(style | NO_VERTICAL_SCROLL | NO_HORIZONTAL_SCROLL); managerWidth = width; managerHeight = height; add(vfm); vfm.add(editField); } TextBoxField(int width, int height) { this(width, height, 0L); } public String getText() { return editField.getText(); } public int getPreferredWidth() { return managerWidth; } public int getPreferredHeight() { return managerHeight; } public void setFocus() { editField.setFocus(); } public void setText(String value) { editField.setText( value ); editField.setCursorPosition( editField.getText().length() ); } public void writeLine(String value) { editField.setText( editField.getText() + value + "\n" ); } protected void sublayout(int w, int h) { if (managerWidth == 0) { managerWidth = w; } if (managerHeight == 0) { managerHeight = h; } int actWidth = Math.min(managerWidth, w); int actHeight = Math.min(managerHeight, h); layoutChild(vfm, actWidth - 2, actHeight - 2); // Leave room for border setPositionChild(vfm, 1, 1); // again, careful not to stomp over the border setExtent(actWidth, actHeight); } protected void paint(Graphics g) { super.paint(g); int prevColor = g.getColor(); g.setColor(Color.BLACK); g.drawRect(0, 0, getWidth(), getHeight()); // draws border g.setColor(prevColor); } }
Now the left and right borders do not appear and the original problem remains.
09-06-2011 03:47 PM
Well, you'll need to debug the problem - I don't see what's wrong. As I've suggested, at least report exceptions. And try to make the debugger work for you - it is an invaluable tool sometimes.
09-06-2011 03:55 PM
It really looks to me like the new lines are somehow being ignored after the scan. I have put a question to the vendor of the barcode library about this.