/** * Constructor. * * @param text The text to be displayed on the button * @param style Combination of field style bits to specify display attributes */ public BOC(String dboc, String iboc, String tboc) { super(Field.NON_FOCUSABLE); try { _width = Display.getWidth(); switch (_width) { case 480: f2 = 20; dbmp = Bitmap.getBitmapResource("bocdom480.jpg"); ibmp = Bitmap.getBitmapResource("bocinter480.jpg"); tbmp = Bitmap.getBitmapResource("boctotal480.jpg"); _height = 60; break; case 360: f2 = 19; dbmp = Bitmap.getBitmapResource("bocdom360.png"); ibmp = Bitmap.getBitmapResource("bocinter360.png"); tbmp = Bitmap.getBitmapResource("boctotal360.png"); _height = 60; break; default: f2 = 17; dbmp = Bitmap.getBitmapResource("bocdom320.png"); ibmp = Bitmap.getBitmapResource("bocinter320.png"); tbmp = Bitmap.getBitmapResource("boctotal320.png"); _height = 60; break; } _dboc = dboc; _iboc = iboc; _tboc = tboc; FontFamily ff1 = FontFamily.forName("BBAlpha Serif"); font = ff1.getFont(Font.PLAIN, f2); } catch (Exception ex) { System.out.println(ex.getMessage()); } }
public UIExampleListStyleButtonFieldScreen() { super(NO_VERTICAL_SCROLL | USE_ALL_HEIGHT); setTitle("ListStyleButtonField Example"); Bitmap caret = Bitmap.getBitmapResource("chevron_right_black_15x22.png"); ListStyleButtonField one = new ListStyleButtonField("Music", caret); one.setChangeListener(this); add(one); ListStyleButtonField two = new ListStyleButtonField("Photos", caret); two.setChangeListener(this); add(two); ListStyleButtonField three = new ListStyleButtonField("Extras", caret); three.setChangeListener(this); add(three); ListStyleButtonField four = new ListStyleButtonField("Settings", caret); four.setChangeListener(this); add(four); ListStyleButtonField five = new ListStyleButtonField("Shuffle Songs", 0); five.setChangeListener(this); add(five); _explanation = new UIExampleScreen(); _explanation.setTitle("ListStyleButtonField Explanation"); LabelField explanationLabel = new LabelField( "The ListStyleButtonField looks like a list row, but is just a simple button. Good for use with a small finite set of elements."); explanationLabel.setPadding(5, 5, 5, 5); _explanation.add(explanationLabel); }