public UserInput() { super(USE_ALL_WIDTH); userField = new CustomEditField( FIELD_LEFT | BasicEditField.NO_NEWLINE | BasicEditField.NO_SWITCHING_INPUT); fontSetting.setPoint(Font.PLAIN, 7); userField.setFont(fontSetting.getFont()); userField.setBackground(BackgroundFactory.createSolidBackground(Color.WHITE)); add(userField); Bitmap icon = Bitmap.getBitmapResource("icon_user.png"); if (Variables.smallScreen()) { int newWidth = icon.getWidth() * 320 / 480; int newHeight = icon.getHeight() * 240 / 360; icon = ImageUtils.resizeBitmap(icon, newWidth, newHeight); } userImage = new BitmapField(icon); userImage.setBackground(BackgroundFactory.createSolidBackground(0xf7f7f7)); userImage.setBorder( BorderFactory.createSimpleBorder( new XYEdges(1, 1, 1, 1), new XYEdges(Color.GRAY, Color.GRAY, Color.GRAY, Color.GRAY), Border.STYLE_SOLID)); add(userImage); }
public PassLockInput() { super(USE_ALL_WIDTH); passField = new CustomPasswordField("", "Password", 30, FIELD_LEFT | PasswordEditField.NO_NEWLINE); fontSetting.setPoint(Font.PLAIN, 7); passField.setFont(fontSetting.getFont()); passField.setBackground(BackgroundFactory.createSolidBackground(Color.WHITE)); add(passField); Bitmap icon = Bitmap.getBitmapResource("icon_lock.png"); if (Variables.smallScreen()) { int newWidth = icon.getWidth() * 320 / 480; int newHeight = icon.getHeight() * 240 / 360; icon = ImageUtils.resizeBitmap(icon, newWidth, newHeight); } passImage = new BitmapField(icon); passImage.setBackground(BackgroundFactory.createSolidBackground(0xf7f7f7)); passImage.setBorder( BorderFactory.createSimpleBorder( new XYEdges(1, 1, 1, 1), new XYEdges(Color.GRAY, Color.GRAY, Color.GRAY, Color.GRAY), Border.STYLE_SOLID)); add(passImage); }
public void setUpAssets() { int w = Display.getWidth(); int h = Display.getHeight(); String res = w + "x" + h; System.out.println("res__________" + res); splash = Bitmap.getBitmapResource("img/splash_" + res + ".png"); main = Bitmap.getBitmapResource("img/bkg_main.jpg"); btn = Bitmap.getBitmapResource(button); if (splash == null) { splash = Bitmap.getBitmapResource(defSplash); } bkg_splash = BackgroundFactory.createBitmapBackground(splash); bkg_main = BackgroundFactory.createBitmapBackground(main); }
public mkpyLabelLabelField(String title, String value, long style, int color, int backcolor) { super( HorizontalFieldManager.NO_HORIZONTAL_SCROLL | HorizontalFieldManager.NO_VERTICAL_SCROLL | HorizontalFieldManager.USE_ALL_WIDTH); lblTitle = new mkpyLabelField(title, style | BitmapField.FIELD_VCENTER, color, backcolor); lblTitle.setFont(this.getFont().derive(Font.BOLD)); this.setBackground(BackgroundFactory.createSolidBackground(backcolor)); this.add(lblTitle); lblValue = new mkpyLabelField( value, style | LabelField.FIELD_VCENTER | LabelField.ELLIPSIS, color, backcolor); this.add(lblValue); }
public ProfileScreen(ProfileInfoScreenManager _profileInfo) { super(Manager.USE_ALL_HEIGHT | Manager.NO_VERTICAL_SCROLL | Manager.NO_VERTICAL_SCROLLBAR); profileInfo = _profileInfo; Manager mainManager = getMainManager(); mainManager.setBackground(BackgroundFactory.createBitmapBackground(Images.screen_background)); backButton = new TabbedButton("Back", 6, 100, 36); backButton.setRVAlue(10); backButton.setChangeListener(AirCrewApp.backButtonListener); homeButton = new TabbedButton("Home", 6, 100, 36); homeButton.setRVAlue(10); setTitle(new ScreenBannar("My Profile", 40, backButton, homeButton)); mvrm = new VerticalFieldManager(Manager.VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR); nameField = new CompositeTextBox("Username", "", true); emailIdField = new CompositeTextBox("email", "", true); passwordField = new CompositePasswordBox("Password", "", true); confirmPasswordField = new CompositePasswordBox("Confirm Password", "", true); airlineField = new CompositeObjectChoiceField("Airlines", airlines, 0); designationField = new CompositeTextBox("Designation", "", true); genderField = new CompositeObjectChoiceField("Gender", gender, 0); locationField = new CompositeTextBox("Location", "", true); CompositeFieldManager manager = new CompositeFieldManager(Manager.VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR); manager.add(nameField); manager.add(emailIdField); manager.add(passwordField); manager.add(confirmPasswordField); manager.add(airlineField); manager.add(designationField); manager.add(genderField); manager.add(locationField); mvrm.add(manager); saveButton = new TabbedButton("Save", 7, 470, 40); saveButton.setRVAlue(12); mvrm.add(saveButton); mvrm.add(new SpaceField(10)); add(mvrm); }
/** * Applies a visual style to a Manager to make it appear like a distinct group. * * @param manager The Manager to transform. * @param title The title of the group. If null or empty, no label will be added. * @return Reference to the same Manager object that was passed as the manager parameter. */ public static Manager makeGroup(Manager manager, String title) { if ((title != null) && (title != "")) { manager.add(createGroupLabel(title)); } manager.setMargin(new XYEdges(3, 3, 0, 3)); manager.setPadding(new XYEdges(5, 5, 5, 5)); manager.setBackground(BackgroundFactory.createSolidBackground(Color.WHITE)); manager.setBorder( BorderFactory.createBevelBorder( new XYEdges(2, 2, 2, 2), new XYEdges( COLOR_GROUP_BEZEL_OUTER, COLOR_GROUP_BEZEL_OUTER, COLOR_GROUP_BEZEL_OUTER, COLOR_GROUP_BEZEL_OUTER), new XYEdges( COLOR_GROUP_BEZEL_INNER, COLOR_GROUP_BEZEL_INNER, COLOR_GROUP_BEZEL_INNER, COLOR_GROUP_BEZEL_INNER))); return manager; }
public CambiarPuntosMap() { if (Display.getWidth() == 320) { getMainManager() .setBackground( BackgroundFactory.createBitmapBackground( Bitmap.getBitmapResource("background_320.png"))); tFuente = 17; tFuente2 = 20; veinticinco = 10; veinte = 10; trecientoscuarentaysiete = 170; setenta = 35; hr = Bitmap.getBitmapResource("hr_line_3.png"); leftHr = 10; btnMapa = Bitmap.getBitmapResource("btnMapa_320.png"); btnMapa1 = Bitmap.getBitmapResource("btnMapa1_320.png"); btnAgregarMapa = Bitmap.getBitmapResource("btnAgregarMapa_320.png"); btnAgregarMapa1 = Bitmap.getBitmapResource("btnAgregarMapa1_320.png"); } if (Display.getWidth() == 360) { getMainManager() .setBackground( BackgroundFactory.createBitmapBackground( Bitmap.getBitmapResource("background_360.png"))); tFuente = 20; tFuente2 = 23; veinticinco = 10; veinte = 10; trecientoscuarentaysiete = 403; setenta = 35; hr = Bitmap.getBitmapResource("hr_line_3.png"); leftHr = 30; btnMapa = Bitmap.getBitmapResource("btnMapa_320.png"); btnMapa1 = Bitmap.getBitmapResource("btnMapa1_320.png"); btnAgregarMapa = Bitmap.getBitmapResource("btnAgregarMapa_320.png"); btnAgregarMapa1 = Bitmap.getBitmapResource("btnAgregarMapa1_320.png"); } if (Display.getWidth() == 480) { getMainManager() .setBackground( BackgroundFactory.createBitmapBackground( Bitmap.getBitmapResource("background_480.png"))); tFuente = 20; tFuente2 = 23; veinticinco = 10; veinte = 10; trecientoscuarentaysiete = 291; setenta = 35; hr = Bitmap.getBitmapResource("hr_line.png"); leftHr = 0; btnMapa = Bitmap.getBitmapResource("btnMapa_320.png"); btnMapa1 = Bitmap.getBitmapResource("btnMapa1_320.png"); btnAgregarMapa = Bitmap.getBitmapResource("btnAgregarMapa_320.png"); btnAgregarMapa1 = Bitmap.getBitmapResource("btnAgregarMapa1_320.png"); } if (Display.getWidth() == 640) { getMainManager() .setBackground( BackgroundFactory.createBitmapBackground(Bitmap.getBitmapResource("background.png"))); tFuente = 35; tFuente2 = 40; } try { FontFamily ffFont1 = FontFamily.forName("Arial"); fLite = ffFont1.getFont(Font.SANS_SERIF_STYLE, tFuente); fTitle = ffFont1.getFont(Font.SANS_SERIF_STYLE, tFuente2); // hr = Bitmap.getBitmapResource("hr_line.png"); // getMainManager().setBackground(BackgroundFactory.createBitmapBackground(Bitmap.getBitmapResource("background.png"))); VerticalFieldManager logoHfm = new VerticalFieldManager(VerticalFieldManager.FIELD_HCENTER); logoHfm.setBackground( BackgroundFactory.createLinearGradientBackground(0xe68241, 0xe68241, 0xd16f2f, 0xd16f2f)); logoHfm.setMargin(0, 0, 0, 0); ColorRichText emailCrt = new ColorRichText( Strings.CHANGECONFIG, 0xffffff, RichTextField.FIELD_HCENTER | RichTextField.TEXT_ALIGN_HCENTER); emailCrt.setFont(fTitle); emailCrt.setMargin(veinticinco, 0, veinticinco, 0); logoHfm.add(emailCrt); VerticalField footerLogoHfm = new VerticalField(Display.getWidth(), veinte, VerticalFieldManager.FIELD_HCENTER); footerLogoHfm.setBackground( BackgroundFactory.createLinearGradientBackground(0x9cbe4f, 0x7a9b3c, 0x7a9b3c, 0x9cbe4f)); ColorRichText introCrt = new ColorRichText( "Elige tus puntos favoritos", 0xffffff, RichTextField.FIELD_HCENTER | RichTextField.TEXT_ALIGN_HCENTER); introCrt.setFont(fTitle); introCrt.setMargin(25, 0, 25, 0); footerLogoHfm.add(introCrt); logoHfm.add(footerLogoHfm); add(logoHfm); VerticalField allContentFiltro = new VerticalField( Display.getWidth(), trecientoscuarentaysiete, HorizontalField.FIELD_HCENTER | VerticalField.VERTICAL_SCROLL | VerticalField.VERTICAL_SCROLLBAR); Object[] municipioO = new Object[] {"one", "two", "three"}; ObjectChoiceField municipioOcf = new FullWidthChoiceField(); municipioOcf.setChoices(municipioO); municipioOcf.setMargin(0, 70, 0, 70); VerticalFieldManager municipioVfm = new VerticalFieldManager( VerticalFieldManager.FIELD_HCENTER | HorizontalFieldManager.FIELD_HCENTER); LabelField municipioLf = new LabelField("Municipio", LabelField.FIELD_HCENTER); municipioLf.setFont(fLite); municipioLf.setMargin(15, 0, 5, 0); municipioVfm.add(municipioLf); // |/ DrawStyle.HCENTER)); municipioVfm.add(municipioOcf); hrBf = new BitmapField(hr); hrBf.setMargin(20, 0, 0, leftHr); municipioVfm.add(hrBf); allContentFiltro.add(municipioVfm); /**/ Object[] establecimientoO = new Object[] {"one", "two", "three"}; ObjectChoiceField establecimientoOcf = new FullWidthChoiceField(); establecimientoOcf.setChoices(establecimientoO); establecimientoOcf.setMargin(0, 70, 0, 70); VerticalFieldManager establecimientoVfm = new VerticalFieldManager( VerticalFieldManager.FIELD_HCENTER | HorizontalFieldManager.FIELD_HCENTER); LabelField establecimientoLf = new LabelField("Establecimiento", LabelField.FIELD_HCENTER); establecimientoLf.setFont(fLite); establecimientoLf.setMargin(15, 0, 5, 0); establecimientoVfm.add(establecimientoLf); // |/ DrawStyle.HCENTER)); establecimientoVfm.add(establecimientoOcf); hrBf = new BitmapField(hr); hrBf.setMargin(20, 0, 0, leftHr); establecimientoVfm.add(hrBf); allContentFiltro.add(establecimientoVfm); HorizontalFieldManager botonesHfc = new HorizontalFieldManager(HorizontalFieldManager.FIELD_HCENTER); // botonesHfc.setMargin(0, 50, 0, 0); BitmapButtonField btnMapaUser = new BitmapButtonField(btnMapa, btnMapa1, Field.FIELD_HCENTER); btnMapaUser.setChangeListener( new FieldChangeListener() { public void fieldChanged(Field field, int context) { UiApplication.getUiApplication().pushScreen(new ListaEstablecimiebtosMap()); } }); btnMapaUser.setMargin(20, 10, 0, 0); BitmapButtonField btnAgregarMapaUser = new BitmapButtonField(btnAgregarMapa, btnAgregarMapa1, Field.FIELD_HCENTER); btnAgregarMapaUser.setChangeListener( new FieldChangeListener() { public void fieldChanged(Field field, int context) { UiApplication.getUiApplication().pushScreen(new ListaEstablecimiebtosMap()); } }); btnAgregarMapaUser.setMargin(20, 10, 0, 0); botonesHfc.add(btnMapaUser); botonesHfc.add(btnAgregarMapaUser); allContentFiltro.add(botonesHfc); add(allContentFiltro); } catch (Exception e) { // TODO: handle exception System.out.println(e.getMessage()); add(new RichTextField(e.getMessage())); } }
public SearchView(HomeScreen homeScreen) { this.homeScreen = homeScreen; manager = new VerticalFieldManager(Manager.NO_VERTICAL_SCROLL) { public boolean keyChar(char c, int status, int time) { if (!searchField.isFocus()) { String oldText = searchField.getText(); searchField.setFocus(); String newText = c == Keypad.KEY_DELETE ? oldText : oldText + c; searchField.setText(newText.trim()); return true; } else if (c == Keypad.KEY_ESCAPE) { if (searchField.getText().length() > 0) { searchField.setText(""); return true; } } return super.keyChar(c, status, time); } }; searchField = new BasicEditField(Field.USE_ALL_WIDTH) { public boolean navigationClick(int status, int time) { if (getText().trim().length() > 0) { SearchView.this.homeScreen.fireActionSearch(); return true; } return super.navigationClick(status, time); } public boolean keyChar(char c, int status, int time) { if (c == Keypad.KEY_ENTER) { if (getText().trim().length() > 0) { SearchView.this.homeScreen.fireActionSearch(); return true; } } else if (getText().length() == 0 && c == Keypad.KEY_SPACE) { return true; } return super.keyChar(c, status, time); } public void paint(Graphics g) { if (getText().length() == 0) { g.setColor(0xbbbbbb); g.drawText(" Search", 0, 0); } else { g.setColor(0); super.paint(g); } } }; // int defaultFontHeight = Font.getDefault().getHeight(); // searchField.setFont(Font.getDefault().derive(Font.PLAIN, defaultFontHeight+8)); Border border = BorderFactory.createRoundedBorder(new XYEdges(4, 4, 4, 4)); searchField.setBorder(border); searchField.setBackground(BackgroundFactory.createSolidBackground(0xffffff)); manager.add(searchField); manager.add(new SeparatorField()); // manager.setBackground(HomeScreen.mainBackground); listField = new ListField(0, Manager.USE_ALL_HEIGHT) { public boolean navigationClick(int status, int time) { if (SearchView.this.listData.size() > 0) { int index = getSelectedIndex(); if (isMoreButton(index)) { increaseListFieldSize(); invalidate(); return true; } ProgramData data = (ProgramData) SearchView.this.listData.elementAt(index); data.isFavorite = !data.isFavorite; if (data.isFavorite) { FavoritePersistent.addFavorite(data.id); PIMEvent.addEvent(data); } else { FavoritePersistent.removeFavorite(data.id); PIMEvent.removeEvent(data); } invalidate(); return true; } return super.navigationClick(status, time); } public void paint(Graphics g) { int ty = getContentTop() + getContentHeight() / 2 - g.getFont().getHeight() / 2; if (ThaiTVSchedule.isFetching()) { ThaiTVSchedule.paintFetching(g, ty); } else if (this.getSize() < 1) { g.setColor(0); int x = (getWidth() - g.getFont().getAdvance("No data")) / 2; g.drawText("No data", x, ty); } else { super.paint(g); } } public boolean isFocusable() { return !ThaiTVSchedule.isFetching(); } }; // listField.setBackground(HomeScreen.mainBackground); listField.setRowHeight(ScheduleScreen.LIST_HEIGHT); listField.setCallback(this); listData = new Vector(); listField.setSize(0); listField.setFont(Font.getDefault().derive(Font.PLAIN, 20)); VerticalFieldManager _vfm = new VerticalFieldManager(Manager.VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR); _vfm.add(listField); manager.add(_vfm); // autoFocus(); }
public Questions(String currentUser, int week) { // current user this.currentUser = currentUser; // set week this.week = week; // set title setTitle("Questions"); // background defaultBg = BackgroundFactory.createLinearGradientBackground( Color.WHITE, Color.LIGHTSKYBLUE, Color.WHITE, Color.GRAY); // main manager mainManager = (VerticalFieldManager) getMainManager(); mainManager.setBackground(defaultBg); // create buttons goBack = new ButtonField("Go back", ButtonField.FIELD_HCENTER); // create reader object reader = new ReadFile(); // read the question file and return its contents test = reader.readTextFile("Questions2.txt"); // process the information process_Qfile(test); // create and set the question objects CreateAndSetQuestionObj(); // create Question list questions_list = CreateQList(); // drop-down list questionsList = new ObjectChoiceField("This week's Questions: ", questions_list); // set margins questionsList.setMargin(20, 0, 0, 0); goBack.setMargin(30, 0, 0, 0); // add buttons to the listener questionsList.setChangeListener(this); goBack.setChangeListener(this); // create image and overwrite the paint method of verticalFieldManager // backgroundImage = Bitmap.getBitmapResource("beach4 copy1.jpg"); backgroundImage = Bitmap.getBitmapResource("beach5 copy copy.jpg"); mainManager = new VerticalFieldManager( VerticalFieldManager.USE_ALL_WIDTH | VerticalFieldManager.USE_ALL_HEIGHT) { public void paint(Graphics graphics) { graphics.drawBitmap(0, 0, 480, 510, backgroundImage, 0, 0); super.paint(graphics); } }; this.add(mainManager); // add components mainManager.add(questionsList); mainManager.add(goBack); // decide which panel should display displayAnswer(); }