public void drawListRow(ListField list, Graphics g, int index, int y, int w) { Font font = g.getFont(); int xPos = 30; int yPos = y + (list.getRowHeight() - imagee1.getHeight()) / 2; int yPosTxt = y + (list.getRowHeight() - font.getHeight()) / 2; if (g.isDrawingStyleSet(Graphics.DRAWSTYLE_FOCUS)) { g.setBackgroundColor(0x005A6971); // g.setBackgroundColor(0x005A6971); // g.drawRoundRect(0, 0, 630, 80, 15, 15); g.clear(); } else { g.setColor(Color.WHITE); // g.drawRoundRect(0, 0, 630, 80, 15, 15); } for (int i = 0; i < bit.length; i++) { image = bit[index]; g.drawBitmap(5, yPos + 3, image.getWidth(), image.getHeight(), image, 0, 0); } g.setFont(Constants.fontBold); xPos = xPos + image.getWidth(); String text = (String) listElements.elementAt(index); g.drawText(text, xPos, yPosTxt); g.setFont(Constants.fontVerySmall); // for (int i = 0; i < bit.length; i++) { // xPos = 30 + image.getWidth(); // String textSubText = Constants.selectedBranch; // g.drawText(textSubText, xPos, yPosTxt + 25); // } xPos = 30 + image.getWidth(); switch (index) { case 0: String textSubText = Constants.selectedBranch; g.drawText(textSubText, xPos, yPosTxt + 25); break; case 1: String textProcessText = Constants.selectedProcess; g.drawText(textProcessText, xPos, yPosTxt + 25); break; case 2: String textLocationText = Constants.selectedLocation; g.drawText(textLocationText, xPos, yPosTxt + 25); break; } g.drawBitmap(580, yPos + 3, arrowImage.getWidth(), arrowImage.getHeight(), arrowImage, 0, 0); }
// Similar to TextFields layout() protected void layout(int width, int height) { if (width < 0 || height < 0) throw new IllegalArgumentException(); // We'll take all we can get _totalWidth = width; // The largest of the two image heights _totalHeight = Math.max(_imageSlider.getHeight(), _imageThumb.getHeight()); setExtent(_totalWidth, _totalHeight); }
public BitmapButtonField(Bitmap normalState, Bitmap focusState, long style) { super(Field.FOCUSABLE | style); if ((normalState.getWidth() != focusState.getWidth()) || (normalState.getHeight() != focusState.getHeight())) { throw new IllegalArgumentException("Image sizes don't match"); } _bitmaps = new Bitmap[] {normalState, focusState}; }
// Bitmap grey = Const.getGrey(); public void paint(Graphics g) { int xPts[] = {0, 0, getPreferredWidth(), getPreferredWidth()}; int yPts[] = {0, getPreferredHeight(), getPreferredHeight(), 0}; g.setColor(2500134); g.drawFilledPath(xPts, yPts, null, null); // g.drawTexturedPath(xPts,yPts,null,null,0,this.getTop(),Fixed32.ONE,0,0,Fixed32.ONE,grey); if (focus) { g.drawBitmap(6, 0, button_select.getWidth(), button_select.getHeight(), button_select, 0, 0); } else { g.drawBitmap( 6, 0, button_thumbnail.getWidth(), button_thumbnail.getHeight(), button_thumbnail, 0, 0); } }
private void paintSliderBackground(Graphics g, Bitmap left, Bitmap middle, Bitmap right) { int sliderHeight = _imageSlider.getHeight(); int sliderBackYOffset = (_totalHeight - sliderHeight) >> 1; // Left g.drawBitmap(0, sliderBackYOffset, _xLeftBackMargin, sliderHeight, left, 0, 0); // lefttop // Middle g.tileRop( _rop, _xRightBackMargin, sliderBackYOffset, _totalWidth - _xLeftBackMargin - _xRightBackMargin, sliderHeight, middle, 0, 0); // top // Right g.drawBitmap( _totalWidth - _xRightBackMargin, sliderBackYOffset, _xRightBackMargin, sliderHeight, right, 0, 0); // lefttop }
public SliderField( Bitmap thumb, Bitmap sliderBackground, Bitmap sliderBackgroundFocus, int numStates, int initialState, int xLeftBackMargin, int xRightBackMargin, long style) { super(style); if (initialState > numStates || numStates < 2) {} _imageThumb = thumb; _imageSlider = sliderBackground; _imageSliderFocus = sliderBackgroundFocus; _numStates = numStates; setState(initialState); _xLeftBackMargin = xLeftBackMargin; _xRightBackMargin = xRightBackMargin; _rop = _imageSlider.hasAlpha() ? Graphics.ROP_SRC_ALPHA : Graphics.ROP_SRC_COPY; _thumbWidth = thumb.getWidth(); _thumbHeight = thumb.getHeight(); initBitmaps(); }
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); }
private void drawBtnStyle(Graphics gfx) { final int initialColor = gfx.getColor(); // draw border gfx.setColor(0x424242); gfx.drawLine(w - 1, 0, w - 1, h - 3); gfx.drawLine(0, h - 1, w - 1, h - 1); gfx.setColor(Color.BLACK); gfx.drawLine(w - 2, 0, w - 2, h - 2); gfx.drawLine(0, h - 2, w - 1, h - 2); gfx.setColor(initialColor); // corners are equal in size, so we can use just one value for both corners final int cornerWidth = BTN_STYLE_LEFT_CORNER.getWidth(); final int middleWidth = w - 2 * cornerWidth - 2; // height is equal for all three pieces final int height = BTN_STYLE_LEFT_CORNER.getHeight(); // draw left corner gfx.drawBitmap(0, 0, cornerWidth, height, BTN_STYLE_LEFT_CORNER, 0, 0); final EncodedImage middle = ImageUtils.resize(BTN_STYLE_MIDDLE, middleWidth + 1, height, false); // draw middle gfx.drawImage(cornerWidth, 0, middleWidth, height, middle, 0, 0, 0); // draw right corner gfx.drawBitmap(cornerWidth + middleWidth, 0, cornerWidth, height, BTN_STYLE_RIGHT_CORNER, 0, 0); }
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); }
/** * for drawing the Record with its Cell Title and Values * * @param graphics * @param b */ private void drawRecord(Graphics graphics, boolean haveFocus) { // graphics.setColor(Color.BLACK); // graphics.fillRoundRect(10, 2, Display.getWidth() - 10, height + 5, // 10, // 10); // graphics.drawRoundRect(10, 2, Display.getWidth() - 10, height + 5, // 10, // 10); int color = Color.BLACK; int[] colors = drawFousLostColors; int[] X_PTS = {getWidth(), getWidth(), getPreferredWidth(), getPreferredWidth()}; int[] Y_PTS = {height, getPreferredHeight(), getPreferredHeight(), height}; if (haveFocus) { colors = drawFousGainColors; color = Color.WHITE; } graphics.drawShadedFilledPath(X_PTS, Y_PTS, null, colors, null); graphics.setColor(color); // for placing the arrow icon int image_height = (height / 2) - 8; int img_x_position = total_Width - 18; graphics.drawBitmap( img_x_position, image_height, arrowBitmap.getHeight(), arrowBitmap.getWidth(), arrowBitmap, 0, 0); int halfWidth = (getWidth() / 2) - RIGHT_MARGIN; int yPosition = 0; // Draw each cell for (int i = 0; i < record.getCells().size(); i++) { Cell cell = (Cell) record.getCells().elementAt(i); // Draw the title of the cell String text = cell.getTitle().trim(); // take the value of the cell to draw String value = cell.getValue().trim(); int numberOfRowsForTitle = drawText(text, value, graphics, 0, yPosition); int numberOfRowsForValue = drawText(value, value, graphics, halfWidth, yPosition); if (numberOfRowsForTitle == 1 && numberOfRowsForValue == 1) { yPosition += CELL_HEIGHT - MULTIPLE_CELLS; } else { yPosition += CELL_HEIGHT - MULTIPLE_CELLS; yPosition += SECOND_CELL_HEIGHT; } } }
private void copy(Bitmap src, int x, int y, int width, int height, Bitmap dest) { int[] argbData = new int[width * height]; src.getARGB(argbData, 0, width, x, y, width, height); for (int tx = 0; tx < dest.getWidth(); tx += width) { for (int ty = 0; ty < dest.getHeight(); ty += height) { dest.setARGB(argbData, 0, width, tx, ty, width, height); } } }
protected void paint(Graphics g) { g.setFont(fontSetting.getFont()); boolean focus = g.isDrawingStyleSet(Graphics.DRAWSTYLE_FOCUS); int textColor = Color.BLACK; if (focus) { g.setColor(Color.GREEN); g.fillRect(0, 0, 5, getHeight()); } if (locked) { textColor = Color.GRAY; g.drawBitmap( getWidth() - 5 - lock.getWidth(), (getHeight() - lock.getHeight()) / 2, lock.getWidth(), lock.getHeight(), lock, 0, 0); } else { if (focus) { g.drawBitmap( getWidth() - 5 - focusArrow.getWidth(), (getHeight() - focusArrow.getHeight()) / 2, focusArrow.getWidth(), focusArrow.getHeight(), focusArrow, 0, 0); } else { g.drawBitmap( getWidth() - 5 - normalArrow.getWidth(), (getHeight() - normalArrow.getHeight()) / 2, normalArrow.getWidth(), normalArrow.getHeight(), normalArrow, 0, 0); } } g.drawBitmap( 25, (getHeight() - image.getHeight()) / 2, image.getWidth(), image.getHeight(), image, 0, 0); g.setColor(textColor); g.drawText(title, 5 + 20 + image.getWidth() + 20, (getHeight() - g.getFont().getHeight()) / 2); }
private void drawBitmap(Graphics gfx) { final int width = imageBmp.getWidth(); final int height = imageBmp.getHeight(); final int x = paddingLeft + ((desiredImgWidth - width) >> 1); final int y = paddingTop + ((desiredImgHeight - height) >> 1); gfx.drawBitmap(x, y, width, height, imageBmp, 0, 0); final int initialColor = gfx.getColor(); gfx.setColor(Color.GRAY); gfx.drawRect(x, y, width, height); gfx.setColor(initialColor); }
public void drawListRow(ListField list, Graphics g, int index, int y, int w) { Font font = g.getFont(); int xPos = 30; // int yPos = y + (list.getRowHeight() - bit[1].getHeight()) / 2; int yPos = y + (list.getRowHeight() - imagee2.getHeight()) / 2; int yPosTxt = y + (list.getRowHeight() - font.getHeight()) / 2; // Bitmap imageBackground = Bitmap // .getBitmapResource("button_for_thumbnails_inactive.png"); // if (list.getSelectedIndex() != index) { // g.drawBitmap(0, 0, 640, 80, imageBackground, 0, 0); // } if (g.isDrawingStyleSet(Graphics.DRAWSTYLE_FOCUS)) { g.setBackgroundColor(0x005A6971); // g.drawRoundRect(0, 0, 630, 80, 15, 15); g.clear(); } else { g.setColor(Color.WHITE); // g.drawRoundRect(0, 0, 630, 80, 15, 15); } // for (int i = 0; i < bit.length; i++) { // image = bit[index]; // g.drawBitmap(5, yPos + 3, image.getWidth(), image.getHeight(), // image, 0, 0); // } g.drawBitmap(5, yPos + 3, imagee2.getWidth(), imagee2.getHeight(), imagee2, 0, 0); xPos = xPos + imagee2.getWidth(); String text = (String) listElements.elementAt(index); g.drawText(text, xPos, yPosTxt + 3); g.drawBitmap(580, yPos + 7, arrowImage.getWidth(), arrowImage.getHeight(), arrowImage, 0, 0); }
public void run() { int ask = -1; if (undo != null) ask = Dialog.ask( "What Filter?", new String[] {"GrayScale", "Negative", "Sephia", "Termal", "Undo Filter"}, 0); else ask = Dialog.ask( "What Filter?", new String[] {"GrayScale", "Negative", "Sephia", "Termal"}, 0); if (ask < 4) { undo = new int[gbr.getWidth() * gbr.getHeight()]; gbr.getARGB(undo, 0, gbr.getWidth(), 0, 0, gbr.getWidth(), gbr.getHeight()); FilterImg.doit(gbr, ask); } else if (ask == 4) { if (undo != null) { gbr.setARGB(undo, 0, gbr.getWidth(), 0, 0, gbr.getWidth(), gbr.getHeight()); undo = null; } } latar.invalidate(); }
/** * Cuts up the background image and margins you provide to make the left, center, and right * bitmaps */ public void initBitmaps() { int height = _imageSlider.getHeight(); _imageSliderLeft = new Bitmap(_xLeftBackMargin, height); _imageSliderCenter = new Bitmap(_imageSlider.getWidth() - _xRightBackMargin - _xLeftBackMargin, height); _imageSliderRight = new Bitmap(_xRightBackMargin, height); copy(_imageSlider, 0, 0, _xLeftBackMargin, height, _imageSliderLeft); copy( _imageSlider, _xLeftBackMargin, 0, _imageSlider.getWidth() - _xRightBackMargin - _xLeftBackMargin, height, _imageSliderCenter); copy( _imageSlider, _imageSlider.getWidth() - _xRightBackMargin, 0, _xRightBackMargin, height, _imageSliderRight); _imageSliderFocusLeft = new Bitmap(_xLeftBackMargin, height); _imageSliderFocusCenter = new Bitmap(_imageSlider.getWidth() - _xRightBackMargin - _xLeftBackMargin, height); _imageSliderFocusRight = new Bitmap(_xRightBackMargin, height); copy(_imageSliderFocus, 0, 0, _xLeftBackMargin, height, _imageSliderFocusLeft); copy( _imageSliderFocus, _xLeftBackMargin, 0, _imageSlider.getWidth() - _xRightBackMargin - _xLeftBackMargin, height, _imageSliderFocusCenter); copy( _imageSliderFocus, _imageSlider.getWidth() - _xRightBackMargin, 0, _xRightBackMargin, height, _imageSliderFocusRight); }
public LessonListField(String title, String imageFile) { super(USE_ALL_WIDTH | FOCUSABLE); myCounter = counter++; this.title = title; image = Bitmap.getBitmapResource(imageFile); int newWidth = Display.getWidth() / 2; if (Variables.smallScreen()) { newWidth = Display.getWidth() * 4 / 10; } if (image.getWidth() > newWidth) { int newHeight = newWidth * image.getHeight() / image.getWidth(); image = ImageUtils.resizeBitmap(image, newWidth, newHeight); } normalArrow = Bitmap.getBitmapResource("next_inactive_btn.png"); focusArrow = Bitmap.getBitmapResource("next_active_btn.png"); lock = Bitmap.getBitmapResource("small_lock.png"); fontSetting.setPoint(Font.PLAIN, 7); }
public void paint(Graphics g) { // Calculate the slider position int sliderHeight = _imageSlider.getHeight(); int sliderBackYOffset = (_totalHeight - sliderHeight) >> 1; // Determine a Background Color for the slider int backgroundColor = _defaultBackgroundColour; if (_backgroundSelectedColours != null || _backgroundColours != null) { if (_selected) { backgroundColor = _backgroundSelectedColours != null ? _backgroundSelectedColours[getState()] : _defaultSelectColour; } else if (g.isDrawingStyleSet(Graphics.DRAWSTYLE_FOCUS)) { backgroundColor = _backgroundColours != null ? _backgroundColours[getState()] : _defaultHoverColour; } else { backgroundColor = _defaultBackgroundColour; } } g.setColor(backgroundColor); g.fillRect(1, sliderBackYOffset + 1, _totalWidth - 2, sliderHeight - 2); if (g.isDrawingStyleSet(Graphics.DRAWSTYLE_FOCUS)) { paintSliderBackground( g, _imageSliderFocusLeft, _imageSliderFocusCenter, _imageSliderFocusRight); } else { paintSliderBackground(g, _imageSliderLeft, _imageSliderCenter, _imageSliderRight); } // Calculate the thumb position int thumbXOffset = ((_totalWidth - _thumbWidth) * _currentState) / _numStates; // Draw the thumb g.drawBitmap( thumbXOffset, (_totalHeight - _thumbHeight) >> 1, _thumbWidth, _thumbHeight, _imageThumb, 0, 0); }
/** * Field implementation. * * @see net.rim.device.api.ui.Field#paint(Graphics) */ protected void paint(Graphics graphics) { // First draw the background colour and picture switch (Display.getWidth()) { case 480: graphics.drawBitmap(12, 10, dbmp.getWidth(), dbmp.getHeight(), dbmp, 0, 0); graphics.drawBitmap(167, 10, ibmp.getWidth(), ibmp.getHeight(), ibmp, 0, 0); graphics.drawBitmap(324, 10, tbmp.getWidth(), tbmp.getHeight(), tbmp, 0, 0); graphics.setFont(font); graphics.setColor(Color.DARKSLATEGRAY); graphics.drawText(_dboc, 18, 40); graphics.drawText(_iboc, 173, 40); graphics.drawText(_tboc, 330, 40); break; case 360: graphics.drawBitmap(15, 10, dbmp.getWidth(), dbmp.getHeight(), dbmp, 0, 0); graphics.drawBitmap(185, 10, ibmp.getWidth(), ibmp.getHeight(), ibmp, 0, 0); graphics.setFont(font); graphics.setColor(Color.DARKSLATEGRAY); graphics.drawText(_dboc, 28, 40); graphics.drawText(_iboc, 198, 40); graphics.drawBitmap(15, 65, tbmp.getWidth(), tbmp.getHeight(), tbmp, 0, 0); graphics.drawText(_tboc, 130, 95); break; default: graphics.drawBitmap(15, 9, dbmp.getWidth(), dbmp.getHeight(), dbmp, 0, 0); graphics.drawBitmap(166, 10, ibmp.getWidth(), ibmp.getHeight(), ibmp, 0, 0); graphics.setFont(font); graphics.setColor(Color.DARKSLATEGRAY); graphics.drawText(_dboc, 18, 40); graphics.drawText(_iboc, 172, 40); graphics.drawBitmap(15, 65, tbmp.getWidth(), tbmp.getHeight(), tbmp, 0, 0); graphics.drawText(_tboc, 110, 95); break; } }
public EditorScreen(final Bitmap gbr, String path, String filename) { super(NO_VERTICAL_SCROLL); this.path = path; this.filename = filename; this.gbr = gbr; this.g = Graphics.create(gbr); UiApplication.getUiApplication().requestForeground(); latar = new VerticalFieldManager( VERTICAL_SCROLL | HORIZONTAL_SCROLL | USE_ALL_WIDTH | USE_ALL_HEIGHT) { protected void paint(Graphics graphics) { graphics.drawBitmap(0, 0, gbr.getWidth(), gbr.getHeight(), gbr, 0, 0); graphics.drawRect(0, 0, gbr.getWidth(), gbr.getHeight()); super.paint(graphics); } }; this.gbrfield = new gbrField(gbr.getWidth(), gbr.getHeight()); latar.add(gbrfield); gbrfield.setText("Jalak_Harupat"); add(latar); addMenuItem(addText); addMenuItem(addArrow); addMenuItem(addimg); addMenuItem(addFilter); addMenuItem(addhelp); addMenuItem(saveclose); addMenuItem(about); if (DBStor.getSettings() == null) { UiApplication.getUiApplication() .invokeLater( new Runnable() { public void run() { Dialog.alert("this is editor Screen, Click menu to do something."); } }); DBStor.setSettings(new Settings()); } setDirty(true); }
public static Bitmap rotateImage(Bitmap oldB, int angle) { try { int w = oldB.getWidth(); int h = oldB.getHeight(); double angRad = (angle % 360) * (Math.PI / 180); Bitmap newB = new Bitmap(w, h); int[] oldD = new int[w * h]; int[] newD = new int[w * h]; oldB.getARGB(oldD, 0, w, 0, 0, w, h); int axisX = w / 2; int axisY = h / 2; for (int x = 0; x < oldD.length; x++) { int oldX = x % w; int oldY = x / w; int op = oldX - axisX; int adj = oldY - axisY; double oldT = MathUtilities.atan2(op, adj); double rad = Math.sqrt((op * op) + (adj * adj)); double newT = oldT + angRad; int newX = (int) MathUtilities.round((rad * Math.sin(newT)) + (double) axisX); int newY = (int) MathUtilities.round((rad * Math.cos(newT)) + (double) axisY); if (newX < 0 || newY < 0 || newX >= w || newY >= h) { newD[x] = 0x00000000; } else { newD[x] = oldD[(newY * w) + newX]; } } newB.setARGB(newD, 0, w, 0, 0, w, h); return newB; } catch (Exception e) { } return null; }
protected void paint(Graphics g) { g.setColor(TITLE_COLOR); Font titleFont = Utils.getFontBold(FONT_SIZE); g.setFont(titleFont); int textWidht = Display.getWidth() - TEXT_ANCHOR - PADDING_RIGHT; if (title == null) { title = TextUtils.wrapText(newsItem.getTitle(), textWidht, titleFont); } int yOff = 0; for (int i = 0; i < title.size(); i++) { if (title.size() > 2 && i == 1) { g.drawText( title.elementAt(i).toString() + "...", TEXT_ANCHOR, PADDING_TOP + i * titleFont.getHeight()); yOff += g.getFont().getHeight(); break; } else { g.drawText( title.elementAt(i).toString(), TEXT_ANCHOR, PADDING_TOP + i * titleFont.getHeight()); yOff += g.getFont().getHeight(); } } Font textFont = Utils.getFont(FONT_SIZE); g.setColor(PRETEXT_COLOR); g.setFont(textFont); if (text == null) { text = TextUtils.wrapText(newsItem.getBody(), textWidht, textFont); } int titleHeight = PADDING_TOP + title.size() * titleFont.getHeight(); int contentHeight = getPreferredHeight() - (PADDING_TOP); for (int i = 0; i < text.size(); i++) { if (yOff + g.getFont().getHeight() >= getPreferredHeight() - 2 * PADDING_TOP) { g.drawText( (String) text.elementAt(i) + "...", TEXT_ANCHOR, titleHeight + i * textFont.getHeight()); } else { g.drawText((String) text.elementAt(i), TEXT_ANCHOR, titleHeight + i * textFont.getHeight()); } yOff += g.getFont().getHeight(); if (yOff >= getPreferredHeight() - 2 * PADDING_TOP) { break; } } if (newsImage != null) { try { g.drawBitmap( PADDING_LEFT, PADDING_TOP, newsImage.getWidth(), newsImage.getHeight(), newsImage, 0, 0); } catch (Exception e) { drawDummyPhoto(g); } } else { drawDummyPhoto(g); } }
protected void layout(int width, int height) { setExtent(width, image.getHeight() + 10); }
public void drawListRow(ListField listField, Graphics g, int index, int y, int width) { if (isMoreButton(index)) { Font bold = Font.getDefault().derive(Font.BOLD); g.setFont(bold); String strMore = "More"; int xx = (width - bold.getAdvance(strMore)) / 2; int yy = y + (ScheduleScreen.LIST_HEIGHT - bold.getHeight()) / 2; if (listField.getSelectedIndex() == index) { g.setColor(0); g.drawText(strMore, xx + 1, yy + 1); g.setColor(0xffffff); g.drawText(strMore, xx, yy); } else { g.setColor(0); g.drawText(strMore, xx, yy); } return; } ProgramData data = (ProgramData) listData.elementAt(index); // if(!listField.isFocus() || index!=listField.getSelectedIndex()){ // for(int x=0; x<Display.getWidth(); x+= ScheduleScreen.LIST_BACKGROUND.getWidth()) // g.drawBitmap(x, y, ScheduleScreen.LIST_BACKGROUND.getWidth(), // ScheduleScreen.LIST_BACKGROUND.getHeight(), ScheduleScreen.LIST_BACKGROUND, 0, 0); // } if (!listField.isFocus() || index != listField.getSelectedIndex()) { for (int x = 0; x < Display.getWidth(); x += ScheduleScreen.LIST_BACKGROUND.getWidth()) g.drawBitmap( x, y, ScheduleScreen.LIST_BACKGROUND.getWidth(), ScheduleScreen.LIST_BACKGROUND.getHeight(), ScheduleScreen.LIST_BACKGROUND, 0, 0); } Bitmap thumb = TVApi.getChannelThumbnail(data.channelId); if (thumb != null) { int padding = (ScheduleScreen.LIST_HEIGHT - thumb.getHeight()) / 2; int ty = y + padding; int tx = padding; g.drawBitmap(tx, ty, thumb.getWidth(), thumb.getHeight(), thumb, 0, 0); g.setColor(0); g.drawText(data.beginTime + " - " + data.endTime, tx + thumb.getWidth() + tx, ty); Bitmap favorite = data.isFavorite ? ScheduleScreen.LIST_FAVORITE_ON : ScheduleScreen.LIST_FAVORITE_OFF; int titleMaxWidth = width - thumb.getWidth() - favorite.getWidth() - (padding * 4); g.drawText( data.title, tx + thumb.getWidth() + tx, ty + thumb.getHeight(), DrawStyle.BASELINE | DrawStyle.ELLIPSIS, titleMaxWidth); g.drawBitmap( width - padding - favorite.getWidth(), y + (ScheduleScreen.LIST_HEIGHT - favorite.getHeight()) / 2, favorite.getWidth(), favorite.getHeight(), favorite, 0, 0); } }