Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Thank you guys, i got one fine solution from Blackberry Journal.</p> <pre class="lang-java prettyprint-override"><code>public class ScrollingSearchBox extends HorizontalFieldManager { private int managerWidth; private int managerHeight; public ScrollingSearchBox() { super(Manager.NO_HORIZONTAL_SCROLL); searchEdit = new BasicEditField(){ public int getPreferredHeight() { return ret; } public int getPreferredWidth() { return ret; } public void paint(Graphics g) { getManager().invalidate(); super.paint(g); } }; HorizontalFieldManager hfm = new HorizontalFieldManager(Manager.HORIZONTAL_SCROLL) { public void sublayout(int width, int height) { if (managerWidth == 0) { managerWidth = searchEdit.getPreferredWidth(); } if (managerHeight == 0) { managerHeight = searchEdit.getPreferredHeight(); } super.sublayout(managerWidth, managerHeight); setExtent(managerWidth,managerHeight); } public void paint(Graphics g) { super.paint(g); } }; searchEdit.setMaxSize(70); hfm.add(searchEdit); add(hfm); } public int getPreferredHeight() { int ret = 0; return ret; } protected void sublayout(int maxWidth, int maxHeight) { int currX = 0; int currY = 0; Field currField; currField = this.getField(0); switch (ScreenConfig.getInstance().getScreen()) { case ScreenConfig.SCREEN_320_240: currX = 5; currY = 3; break; case ScreenConfig.SCREEN_480_360: case ScreenConfig.SCREEN_480_320: currX = 5; currY = 1; break; } this.setPositionChild(currField, currX, currY); this.layoutChild(currField, currField.getPreferredWidth(), currField.getPreferredHeight()); setExtent(this.getPreferredWidth(), this.getPreferredHeight()); } protected void paint(Graphics graphics) { super.paint(graphics); graphics.drawRect(0, 0, this.getPreferredWidth(), this.getPreferredHeight()); } } </code></pre> <p>I am giving this so it can help others. Keep sharing your codes. Thanks.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload