public AddFeedDialog(ObjectListField list) { super( new VerticalFieldManager(VERTICAL_SCROLLBAR | VERTICAL_SCROLL), DEFAULT_MENU | Field.FOCUSABLE); this.list = list; // title label to sit at top of screen LabelField titleLbl = new LabelField("Add a Feed", Field.FIELD_HCENTER); titleLbl.setFont(titleLbl.getFont().derive(Font.BOLD)); titleLbl.setMargin(new XYEdges(0, 0, 10, 0)); // top,right,bottom,left // set up fields.. LabelField nameLbl = new LabelField("Name"); nameTxt = new TextField(500); LabelField urlLbl = new LabelField("Address"); urlTxt = new TextField(500, EditField.FILTER_URL); addBtn = new ButtonField("Add", ButtonField.CONSUME_CLICK | Field.FIELD_HCENTER); cancelBtn = new ButtonField("Cancel", ButtonField.CONSUME_CLICK | Field.FIELD_HCENTER); // add everything to the screen.. HorizontalFieldManager buttonsManager = new HorizontalFieldManager(Field.FIELD_HCENTER); buttonsManager.setMargin(new XYEdges(10, 0, 5, 0)); // top,right,bottom,left buttonsManager.add(addBtn); buttonsManager.add(cancelBtn); this.add(titleLbl); this.add(nameLbl); this.add(nameTxt); this.add(urlLbl); this.add(urlTxt); this.add(buttonsManager); // add action listeners to buttons.. addBtn.setChangeListener( new FieldChangeListener() { public void fieldChanged(Field field, int context) { add(); } }); cancelBtn.setChangeListener( new FieldChangeListener() { public void fieldChanged(Field field, int context) { cancel(); } }); }
public void runMain() { Bitmap img = imgstock.getHeader(); BitmapFieldWithStatus bf = new BitmapFieldWithStatus(img, BitmapField.FIELD_HCENTER | BitmapField.USE_ALL_WIDTH, ""); add(bf); Engine.getInstance().registerStatus(bf); try { MainListVerticalFieldManager mainManager = new MainListVerticalFieldManager(); XYEdges edge = new XYEdges(5, 25 * Display.getWidth() / 480, 2, 25 * Display.getWidth() / 480); HorizontalFieldManager mainHorizontalManager = new HorizontalFieldManager( HorizontalFieldManager.FIELD_HCENTER | HorizontalFieldManager.USE_ALL_WIDTH | HorizontalFieldManager.FIELD_VCENTER); RadioButtonGroup rgrp = new RadioButtonGroup(); // EditField // EditField searchTextField = new EditFieldwithFocus( "Search: ", topic, 35, BasicEditField.FIELD_HCENTER | BasicEditField.FIELD_VCENTER, MyColor.FONT_SEARCH, MyColor.SEARCH_COLOR) { public void layout(int width, int height) { super.layout(getPreferredWidth(), getPreferredHeight()); setExtent(getPreferredWidth(), getPreferredHeight()); } public int getPreferredHeight() { return 25; } public int getPreferredWidth() { return 340 * Display.getWidth() / 480; } }; // edit.setBorder(BorderFactory.createSimpleBorder(edge,Border.STYLE_TRANSPARENT)); // add(edit); MyButtonField button = new MyButtonField("Share a file", ButtonField.ELLIPSIS); // stopButton.setBorder(BorderFactory.createSimpleBorder(edge,Border.STYLE_TRANSPARENT)); button.setChangeListener(new ButtonListener(rgrp, 12)); button.setMargin(edge); mainManager.add(button); // searchTextField.setMargin(edge); mainHorizontalManager.add(searchTextField); mainHorizontalManager.add(searchBT); mainHorizontalManager.setMargin(edge); mainManager.add(mainHorizontalManager); // BitmapField bff = new BitmapField(img, // BitmapField.NON_FOCUSABLE); // mainManager.add(bff); LabelField topicLabel = new LabelFieldWithFullBG( "Document Sharing", MyColor.FONT_TOPIC, MyColor.FONT_TOPIC_COLOR, MyColor.TOPIC_BG, Const.LABEL_WIDTH); edge = new XYEdges(2, 25 * Display.getWidth() / 480, 2, 25 * Display.getWidth() / 480); topicLabel.setMargin(edge); mainManager.add(topicLabel); _list = new TrainingListField(); mainManager.add(_list); pagingManager.setMargin(edge); mainManager.add(pagingManager); add(mainManager); } catch (Exception e) { System.out.println("" + e.toString()); } // bf = new BitmapField(img, Field.FIELD_BOTTOM | Field.USE_ALL_HEIGHT); // bf.setBorder(BorderFactory.createSimpleBorder(edge,Border.STYLE_TRANSPARENT)); // add(bf); addMenuItem(_mainMenuItem); }