protected void paint(Graphics g) { g.setColor(COLOR_WHITE); g.fillRect(0, 0, getWidth(), getHeight()); Font f1 = Font.getFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_LARGE); Font f2 = Font.getFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_SMALL); int px = getWidth() / 2; g.setColor(COLOR_BLUE); g.setFont(f1); g.drawString( Locale.getInst().getStr(Locale.SPLASH_TOP), px, 0, Graphics.TOP | Graphics.HCENTER); g.setFont(f2); g.drawString( Locale.getInst().getStr(Locale.SPLASH_BOTTOM), px, getHeight(), Graphics.BOTTOM | Graphics.HCENTER); if (logo != null) { g.drawImage(logo, getWidth() / 2, getHeight() / 2, Graphics.HCENTER | Graphics.VCENTER); } }
public void systemShowInf(String infStr) { g.setColor(128, 255, 255); g.fillRect(disWidth + 50, disHeight + 166, 80, 15); g.setColor(0, 0, 0); g.drawString(infStr, disWidth + 55, disHeight + 166, 0); flushGraphics(); }
protected void paint(Graphics g) { g.setColor(0xFAFAFA); g.fillRect(0, 0, getWidth(), getHeight()); g.setColor(0xDDDDDD); g.setStrokeStyle(Graphics.SOLID); g.drawLine(0, 0, getWidth(), 0); if (!pressedField) { g.setColor(0xE5E5E5); } else { pressedField = false; g.setColor(0xBCBCBC); } if (selected == Main.STATION_LIST_VIEW) { g.fillRect(0, 1, getWidth() / 2, getHeight() / 2); } else if (selected == Main.FAVORITE_LIST_VIEW) { g.fillRect(getWidth() / 2 + 1, 1, getWidth(), getHeight() / 2); } else if (selected == Main.MAP_SEARCH_VIEW) { g.fillRect(0, getHeight() / 2 + 1, getWidth() / 2, getHeight()); } else if (selected == Main.GEOCODING_SEARCH_VIEW) { g.fillRect(getWidth() / 2 + 1, getHeight() / 2 + 1, getWidth(), getHeight()); } g.setColor(0x000000); g.setFont(Font.getFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_SMALL)); g.drawImage(imageStationListView, 60, 40, Graphics.HCENTER | Graphics.VCENTER); g.drawString(Main.STATION_LIST_VIEW_TITLE, 60, 80, Graphics.HCENTER | Graphics.TOP); g.drawImage(imageFavoriteListView, 180, 40, Graphics.HCENTER | Graphics.VCENTER); g.drawString(Main.FAVORITE_LIST_VIEW_TITLE, 180, 80, Graphics.HCENTER | Graphics.TOP); g.drawImage(imageMapSearchView, 60, 160, Graphics.HCENTER | Graphics.VCENTER); g.drawString(Main.MAP_SEARCH_VIEW_TITLE, 60, 200, Graphics.HCENTER | Graphics.TOP); g.drawImage(imageGeocodingSearchView, 180, 160, Graphics.HCENTER | Graphics.VCENTER); g.drawString(Main.GEOCODING_SEARCH_VIEW_TITLE, 180, 200, Graphics.HCENTER | Graphics.TOP); }
/* * Draw statusbar with a stored graphic later, and add date and status icons * for gps, battery, net and cell status. */ protected void paintStatusBar(Graphics g) { if (screenOrientation() == PORTRAIT) { int x = 0; int y = getHeight() - HEIGHT_STATUSBAR; int width = getWidth(); int height = getHeight(); g.setClip(x, y, width, height); g.setColor(COLOR_STATUSBAR_BG); g.fillRect(x, y, width, height); g.setColor(COLOR_OUTLINE); g.drawLine(0, y, width, y); g.drawLine(30, y, 30, height); g.drawLine(getWidth() - 30, y, width - 30, height); g.setColor(COLOR_TEXT); g.drawString("VIEW", 15, height, Graphics.HCENTER | Graphics.BOTTOM); g.drawString("MENU", width - 15, height, Graphics.HCENTER | Graphics.BOTTOM); g.drawString( DateUtils.getDateTimeStr(), width >> 1, height, Graphics.HCENTER | Graphics.BOTTOM); } else { // fixme: Put some effort here later. g.setColor(COLOR_TEXT); g.drawString("Landscape view not implemented", 0, 40, Graphics.TOP | Graphics.LEFT); } }
/** paint */ public void paint(Graphics g) { g.setFont(MainCanvas.nameFont); g.setColor(255, 255, 255); g.fillRect(0, 0, getWidth(), getHeight()); UIPainter.paintBackground(g); int i; for (i = 0; i < myTools.size(); i++) { if (se == i) { g.setColor(0, 0, 0); g.fillRect( 0, i * MainCanvas.nameFont.getHeight(), getWidth(), MainCanvas.nameFont.getHeight()); g.setColor(255, 255, 255); g.drawString( "" + JustPaint.c.brs[((Integer) myTools.elementAt(i)).intValue()], 5, i * MainCanvas.nameFont.getHeight(), Graphics.LEFT | Graphics.TOP); } else { g.setColor(0, 0, 0); g.drawString( "" + JustPaint.c.brs[((Integer) myTools.elementAt(i)).intValue()], 5, i * MainCanvas.nameFont.getHeight(), Graphics.LEFT | Graphics.TOP); } } UIPainter.paintLeftSoft(g, "Добавить"); UIPainter.paintRightSoft(g, "Отмена"); }
void displayCharacterMap(Graphics g) { if (currentChars != null) { g.setColor(0xffffff); g.fillRect(0, getHeight() - inputHeight - 2, getWidth(), inputHeight + 2); g.setColor(0x000000); g.drawLine(0, getHeight() - inputHeight - 2, getWidth(), getHeight() - inputHeight - 2); for (int i = 0; i < currentChars.length; i++) { char ch = currentChars[i]; if (isUppercase) { ch = String.valueOf(currentChars[i]).toUpperCase().charAt(0); } // TODO: if i*12 > getWidth() ? g.drawChar(ch, i * 12, getHeight() - inputHeight, Graphics.LEFT | Graphics.TOP); if (currentChars[currentKeyStep] == currentChars[i]) { g.drawRect( i * 12 - 2, getHeight() - inputHeight - 2, inputFont.charWidth(ch) + 4, inputHeight + 4); } } } }
protected void paint(Graphics g) { int w = getWidth(), h = getHeight(); g.setClip(0, 0, w, h); g.setColor(bgColor); g.fillRect(0, 0, w, h); g.setColor(fgColor); String msg = null; switch (state) { case INITIALIZING: msg = "Initializing..."; break; case FAILED: msg = "Failed"; break; case PAUSED: msg = "Paused"; break; case LOADING: msg = "Loading..."; break; } if (msg != null) { g.drawString(msg, w >> 1, h >> 1, Graphics.HCENTER | Graphics.BASELINE); } else { int x = 0, col = 0, y = 0, row = 0, di = curLine; while (di < data.length) { char c = (char) data[di++]; if (c == 0) { y += charHeight; row++; x = 0; col = 0; if (row == screenRows) return; continue; } if (col++ < curColumn) continue; boolean longline = false; if (col == curColumn + screenColumns) { while (di < data.length) if (data[di++] == 0) { di--; break; } else { longline = true; } } int cx = (c & 15) * charWidth; int cy = ((c >> 4) - 2) * charHeight; g.setClip(x, y, charWidth, charHeight); if (longline) { g.setColor(llColor); g.fillRect(x, y, charWidth, charHeight); g.setColor(fgColor); } g.drawImage(font, x - cx, y - cy, Graphics.TOP | Graphics.LEFT); x += charWidth; } } }
void displayStatus(Graphics g) { if (statusString != null) { g.setColor(0xffffff); g.fillRect(0, getHeight() - inputHeight - 2, getWidth(), inputHeight + 2); g.setColor(0x000000); g.drawLine(0, getHeight() - inputHeight - 2, getWidth(), getHeight() - inputHeight - 2); g.drawString(statusString, 0, getHeight() - inputHeight - 2, Graphics.LEFT | Graphics.TOP); } }
/*-------------------------------------------------- * Paint the text representing the key code *-------------------------------------------------*/ protected void paint(Graphics g) { // Clear the background (to white) g.setColor(255, 255, 255); g.fillRect(0, 0, getWidth(), getHeight()); // Set color and draw text // Draw with black pen g.setColor(0, 0, 0); // Close to the center g.drawImage(image, mX, mY, Graphics.HCENTER | Graphics.VCENTER); }
public void paint(Graphics g) { if (startFlag == 0) { g.setColor(0, 0, 0); g.fillRect(0, 0, getWidth(), getHeight()); g.setColor(255, 255, 255); g.drawString("Loading Terrain....0%", getWidth() / 2, 0, Graphics.TOP | Graphics.HCENTER); startFlag = 1; } else { drawGround(g); } }
/* (non-Javadoc) * @see de.enough.polish.ui.Item#paintContent(int, int, int, int, javax.microedition.lcdui.Graphics) */ protected void paintContent(int x, int y, int leftBorder, int rightBorder, Graphics g) { // set the color according to the style if (this.style != null) { g.setColor(this.style.getFontColor()); } else { g.setColor(0x000000); } // draw the keys g.drawString(getKeys(this.keyboard.isShift()), x, y, Graphics.LEFT | Graphics.TOP); }
/** 区别黑字白字 用法:H>>6黑字 H原值白字 */ public static final void String_Splash_Paint(Graphics g, String str, int W, int H) { if (Paint_Index++ % 10 < 5) { if (H > 1000) { // 区别黑字白字 g.setColor(0x000000); g.drawString(str, W >> 1, H >> 7, Graphics.TOP | Graphics.HCENTER); } else { g.setColor(0xFFFFFF); g.drawString(str, W >> 1, H >> 1, Graphics.TOP | Graphics.HCENTER); } } }
void displayCurrentCommand(Graphics g) { g.setColor(0xffffff); g.fillRect(0, getHeight() - inputHeight - 2, getWidth(), inputHeight + 2); g.setColor(0x000000); g.drawLine(0, getHeight() - inputHeight - 2, getWidth(), getHeight() - inputHeight - 2); g.drawString( "Ctrl" + " + " + currentCharCommand, 0, getHeight() - inputHeight, Graphics.LEFT | Graphics.TOP); }
protected void paint(Graphics g) { int width = this.getWidth(); // Fill in the background White g.setColor(0xFFFFFF); // White g.fillRect(0, 0, width, this.getHeight()); int y = yPos; y += MARGIN; if (this.logo != null) { g.drawImage(this.logo, width / 2, y, Graphics.TOP | Graphics.HCENTER); y += logo.getHeight() + MARGIN; } g.setColor(0x0); // Black // Write the title "About" final Font titleFont = Font.getFont(Font.FACE_SYSTEM, Font.STYLE_BOLD | Font.STYLE_UNDERLINED, Font.SIZE_LARGE); /* * TODO: currently paints ALL the text, even if there is (a lot) more * than can fit on the screen. (must do this first time to assess * 'height', but shouldn't need to do it for any other repaint */ for (int i = 0; i < TITLES.length; i++) { final int basicFontHeight = DEFAULT_SIMPLE_FONT.getHeight(); final int titleFontHeight = titleFont.getHeight(); // Write out the 'message' heading g.setFont(titleFont); final String title = TITLES[i]; int stringWidth = g.getFont().stringWidth(title); g.drawString(title, (width - stringWidth) / 2, y, 0); y += titleFontHeight; // Write out the 'message' text. g.setFont(DEFAULT_SIMPLE_FONT); for (int j = 0; j < this.formattedMessages[i].length; j++) { final String message = this.formattedMessages[i][j]; stringWidth = g.getFont().stringWidth(message); g.drawString(message, (width - stringWidth) / 2, y, 0); y += basicFontHeight; } y += basicFontHeight; } // Set the total-Height the first time if (firstTime) { totalHeight = y + MARGIN; firstTime = false; } }
/** * Metoda wyswietlajaca okreg obrazujacy postep wykrywania urzadzen * * @param g Referencja do obiektu klasy Graphics, ktory pozwala na narysowanie pasku postepu * @param progress Liczba z zakresu 0 - 359: zakres luku */ public void showInquiryProgress(Graphics g, int progress) { int c = g.getColor(); g.setColor(255, 255, 255); g.drawArc(screenWidth - 25, screenHeight - 57, 10, 16, 0, progress); g.setColor(c); bluetoothLogoSmallSprite.setPosition(screenWidth - 24, screenHeight - 56); bluetoothLogoSmallSprite.paint(g); }
void displayCursor(Graphics g) { int x = getCursorX(); int y = getCursorY(); if (x >= 0 && x <= vectorLines.elementAt(y).toString().length()) { if (isSelected(x, y)) { g.setColor(0xffffff); } else { g.setColor(0x000000); } g.drawLine(caretLeft, (y) * inputHeight, caretLeft, (y + 1) * inputHeight); } }
private void showLoad() { int sx, sy; String ss = "正在加载资源, 请稍后......"; Graphics g = engine.getGraphics(); sx = (engine.getScreenWidth() - engine.getFont().stringWidth(ss)) / 2; sy = (engine.getScreenHeight() - engine.getFont().getHeight()) / 2; g.setClip(0, 0, engine.getScreenWidth(), engine.getScreenHeight()); g.setColor(0); g.fillRect(0, 0, engine.getScreenWidth(), engine.getScreenHeight()); g.setColor(-1); g.drawString(ss, sx, sy, 0); engine.flushGraphics(); }
void displayScrollBar(Graphics g) { int x = getCursorX(); int y = getCursorY(); g.setColor(0xffffff); g.fillRect(getWidth() - 5, 0, 5, getHeight()); g.setColor(0x000000); g.drawLine(getWidth() - 5, 0, getWidth() - 5, getHeight()); int hScrollMin = inputHeight; int yScroll = (((linesOnScreen - 1) * y) * inputHeight) / getLinesCount(); g.fillRect(getWidth() - 5, yScroll, 5, hScrollMin); }
public static int draw(final Graphics g, final int x, final int y, final char ch) { if (ch >= '0' && ch <= '9') { int iy = (ch - '0') * fh; g.drawRegion(dig, 0, iy, fw, fh, 0, x, y, 0); return fw + 2; } else if (ch == hrs) { g.drawRegion(dig, 0, 360, fw - 2, fh, 0, x, y, 0); } else if (ch == min) { g.drawRegion(dig, 0, 396, fw - 2, fh - 3, 0, x, y + 1, 0); } else if (ch == sec) { g.drawRegion(dig, 0, 429, fw - 2, fh - 3, 0, x, y + 1, 0); } else if (ch == kh) { g.drawRegion(dig, 0, 462, fw - 2, fh - 3, 0, x, y + 1, 0); } else if (ch == km) { g.drawRegion(dig, 0, 525, fw - 2, fh - 3, 0, x, y + 1, 0); } else { g.setColor(0); if (ch == ':') { g.fillRect(x, y + 7, 5, 5); g.fillRect(x, y + 23, 5, 5); } else if (ch == '.') { g.fillRect(x + 1, y + fh - 5, 5, 5); return 7; } else if (ch == '_') { g.fillRect(x + 1, y + fh - 5, fw, 5); return fw + 2; } else return fw; } return fw - 4; }
protected void paint(Graphics g) { g.setColor(255, 255, 255); g.fillRect(0, 0, 400, 400); g.setColor(0, 0, 255); g.drawString("Loading", getWidth() / 2, getHeight() / 2, Graphics.BASELINE | Graphics.HCENTER); try { CustomFont.initialise(getClass().getResourceAsStream("/img/Font2.png")); } catch (IOException ex) { ErrorLog.add(ex); } Ecran.NOBx = 20; Ecran.NOBy = 20; ErrorLog.setBounds(getWidth(), getHeight()); parent.e = new Ecran(parent); parent.getDisplay().setCurrent(parent.e); }
public void paint(Graphics g) { try { g.fillRect(0, 0, getWidth(), getHeight()); g.setColor(0xffffff); g.drawString("SCORE: " + iScore, 0, 0, Graphics.TOP | Graphics.LEFT); g.setColor(0x000000); GD.getGameOver() .setPosition( ((getWidth() - GD.getGameover().getWidth()) / 2), ((getHeight() - GD.getGameover().getHeight()) / 2)); GD.getGameOver().paint(g); } catch (Exception ex) { System.out.print(ex); } }
public void drawMenu() { try { if (page == 3) { setFont(16); g.drawString(nickname, disWidth + 80, disHeight + 15, 0); } // 判斷在遊戲說明時,防止文字超出螢幕,當超出螢幕時放到下一頁面 if (page == 1) { setFont(0); g.setColor(255, 255, 255); for (int i = 0; gameUserInfCount < gameUserInf.length; gameUserInfCount++, i += 17) { if (gameUserInfCount % 5 != 4) // 遊戲說明 g.drawString(gameUserInf[gameUserInfCount], disWidth + 10, disHeight + 70 + i, 0); else { // 顯示還有下一頁的文字 g.drawString(gameUserInf[gameUserInfCount], disWidth + 135, disHeight + 70 + i, 0); gameUserInfCount++; break; } } flushGraphics(); } changeMeun(); flushGraphics(); } catch (Exception e) { e.printStackTrace(); } }
public static void fillArcWithBorder( Graphics g, int x, int y, int width, int height, int startAngle, int arcAngle, int innerColor, int outerColor) { g.setColor(outerColor); g.fillArc(x, y, width, height, startAngle, arcAngle); g.setColor(innerColor); g.fillArc(x + 2, y + 2, width - 4, height - 4, startAngle, arcAngle); }
protected void doPaintAxis(final Graphics g) { if (scaleSizeInPixel == 0 || mapBackground != null) { return; } final Font font = Font.getFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_SMALL); g.setFont(font); g.setColor(0x00000000); final int textBottom = height - 4 - SCALE_HEIGTH; int left = 0; for (int i = 0; i < scaleConfiguration.labelLocation.length; i++) { final float location = scaleConfiguration.labelLocation[i]; final float value = scaleConfiguration.labelValue[i]; String label = Utils.floatToString(value, true); if (location == 0) { left = (font.stringWidth(label) / 2) + 2; } else if (location == 1) { label += " " + scaleConfiguration.unit; } g.drawString( label, left + (int) (scaleSizeInPixel * location), textBottom, Graphics.BOTTOM | Graphics.HCENTER); } g.drawRect(left, height - 2 - SCALE_HEIGTH, scaleSizeInPixel, SCALE_HEIGTH); g.fillRect(left, height - 2 - SCALE_HEIGTH, scaleSizeInPixel / 2, SCALE_HEIGTH); }
private void paint_Confirm(Graphics g) { int h = 50; Painter.drawDialog(g, 0, gd.screenHeight - h, gd.screenWidth, h, Painter.DIALOG_DEEP); g.setColor(Color.black); if (gd.player.bag.get( gd.bag_tabIndex == 0 ? Bag.ITEM : Bag.EQUIP, gd.player.bag.getList(gd.bag_tabIndex == 0 ? Bag.ITEM : Bag.EQUIP)[gd.bag_curIndex]) != null) { if (gd.bag_tabIndex == 0) { g.drawString( "是否要使用物品\"" + (gd.gameObjectManager.getItem(gd.player.bag.getList(Bag.ITEM)[gd.bag_curIndex]) .name) + "\"", gd.screenWidth / 2, gd.screenHeight - h + (h - g.getFont().getHeight()) / 2, Graphics.TOP | Graphics.HCENTER); } else { g.drawString( "是否要将装备\"" + (gd.gameObjectManager.getEquip(gd.player.bag.getList(Bag.EQUIP)[gd.bag_curIndex]) .name) + "\"穿上", gd.screenWidth / 2, gd.screenHeight - h + (h - g.getFont().getHeight()) / 2, Graphics.TOP | Graphics.HCENTER); } } }
protected final void draw( final Graphics pG, final int pOffsetX, final int pOffsetY, final boolean pRemovable) { // Upper triangle pG.fillTriangle( mCenterX + pOffsetX, mTopY + pOffsetY, mLeftX + pOffsetX, mUpperTriangleBottomY + pOffsetY, mRightX + pOffsetX, mUpperTriangleBottomY + pOffsetY); // Lower triangle pG.fillTriangle( mCenterX + pOffsetX, mBottomY - 1 + pOffsetY, mLeftX + pOffsetX, mLowerTriangleTopY + pOffsetY, mRightX + pOffsetX, mLowerTriangleTopY + pOffsetY); // Top left corner pG.setColor(pRemovable ? mColorDrawDarker : mColorDrawLighter); pG.drawLine( mCenterX + pOffsetX, mTopY + pOffsetY, mLeftX + pOffsetX, mUpperTriangleBottomY + pOffsetY); // Top right corner pG.drawLine( mCenterX + pOffsetX, mTopY + pOffsetY, mRightX + pOffsetX, mUpperTriangleBottomY + pOffsetY); // Bottom left corner pG.drawLine( mCenterX + pOffsetX, mBottomY - 1 + pOffsetY, mLeftX + pOffsetX, mLowerTriangleTopY + 1 + pOffsetY); // Bottom right corner pG.setColor(pRemovable ? mColorDrawLighter : mColorDrawDarker); pG.drawLine( mCenterX + pOffsetX, mBottomY - 1 + pOffsetY, mRightX + pOffsetX, mLowerTriangleTopY + 1 + pOffsetY); }
public Image colImage(int color) { Image img = Image.createImage(Font.getDefaultFont().getHeight(), Font.getDefaultFont().getHeight()); Graphics g = img.getGraphics(); g.setColor(color); g.fillRect(0, 0, img.getWidth(), img.getHeight()); return img; }
// 畫出所輸入的字 public void showBufferString() { if (page == 0) { drawUser_pass(); } else if (page == 2) { g.setColor(255, 255, 255); g.drawString(nickname, disWidth + 60, disHeight + 115, 0); } }
// 顯示畫面 public void drawDisplay() { g = getGraphics(); g.setColor(0, 0, 0); g.drawRect(disWidth - 1, disHeight - 1, 176 + 1, 208 + 1); layMa.paint(g, disWidth, disHeight); g.drawString(getWidth() + "|" + getHeight(), 0, 0, 0); flushGraphics(); }
// } public void drawCursor(Graphics g, int width, int height) { int x = xCursor * imgWidth; g.setColor(ColorScheme.LIST_BGND); g.fillRect(0, 0, width, height); g.translate(x, 0); super.drawCursor(g, imgWidth, lineHeight); g.translate(-x, 0); }