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 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(); }