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);
  }
Esempio n. 2
0
 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;
 }
Esempio n. 3
0
  /** 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, "Отмена");
  }
Esempio n. 4
0
  /**
   * Metoda wyswietlajaca pasek postepu nad przyciskami
   *
   * @param g Referencja do obiektu klasy Graphics, ktory pozwala na narysowanie pasku postepu
   * @param current Aktualny czas trwania piosenki, 0 <= progress <= max
   * @param max Calkowity czas trwania piosenki
   */
  public void showProgressBar(Graphics g, int current, int max) {
    int color = g.getColor(); // przechowanie uzywanego koloru
    int progressBarWidth = screenWidth - 25; // szerokosc paska postepu
    int progress = (progressBarWidth * current) / max;

    if (current == -1) // jesli timer jest wylaczony
    progress = 0;

    g.setColor(110, 110, 110); // narysowanie szarej obwodki
    g.drawRect(10, screenHeight - 29 + buttonsLocation, progressBarWidth + 3, 17);

    g.setColor(90, 90, 90); // narysowanie ciemnej obwodki
    g.drawRect(11, screenHeight - 28 + buttonsLocation, progressBarWidth + 1, 15);

    g.setColor(BACKGROUND_COLOR);
    g.fillRect(12, screenHeight - 27 + buttonsLocation, progressBarWidth, 14);

    g.setColor(230, 230, 230);
    g.fillRect(12, screenHeight - 27 + buttonsLocation, progress, 14);

    g.setColor(70, 70, 70);

    if (this.displayedScreen == MainCanvas.PLAYER_SCREEN)
      g.drawString(
          bluetoothPlayer.getCurrentTimeString(),
          screenWidth / 2 - 17,
          screenHeight - 26 + buttonsLocation,
          Graphics.TOP | Graphics.LEFT);

    g.setColor(color);
  }
Esempio n. 5
0
 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;
     }
   }
 }
Esempio n. 6
0
  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);
  }
Esempio n. 7
0
  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);
        }
      }
    }
  }
Esempio n. 8
0
  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);
  }
Esempio n. 9
0
  /*
   * 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);
    }
  }
Esempio n. 10
0
 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();
 }
Esempio n. 11
0
  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);
    }
  }
Esempio n. 12
0
 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 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);
 }
Esempio n. 14
0
 // 删除行,只是简单的把该行置黑
 protected void deleteRow(Graphics g, int y) {
   g.setColor(KetrisCanvas.BACKGROUD);
   g.fillRect(
       KetrisCanvas.GAMEAREA_X + KetrisCanvas.BRICK_WIDTH,
       KetrisCanvas.GAMEAREA_Y + y * KetrisCanvas.BRICK_WIDTH,
       10 * KetrisCanvas.BRICK_WIDTH,
       KetrisCanvas.BRICK_WIDTH);
 }
Esempio n. 15
0
  /**
   * @param xStart
   * @param yStart
   * @param xEnd
   * @param yEnd
   */
  private static boolean drawAxisLine(Graphics g, int x1, int y1, int x2, int y2, int thickness) {

    int l;

    // wenn x Koordinaten, oder y Koordinaten gleich, dann einfach
    // Rechtecke zeichnen.
    if (x1 == x2) {
      l = y2 - y1;
      g.fillRect(x1 - (thickness / 2), y1, thickness - 1, l);
      return true;
    } else if (y1 == y2) {
      l = x2 - x1;
      g.fillRect(x1, y1 - (thickness / 2), l, thickness - 1);
      return true;
    }
    return false;
  }
Esempio n. 16
0
 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);
   }
 }
Esempio n. 17
0
  void displayLines(Graphics g, int yStart) {
    // (1 + 2, depends on font size)

    if (isSelection && (xStartSelection != xEndSelection || yStartSelection != yEndSelection)) {
      for (int y = Math.max(0, yStart);
          y < Math.min(yStart + linesOnScreen + 1 + 2, vectorLines.size());
          y++) {
        String currentLine = vectorLines.elementAt(y).toString();
        int width = 0;

        for (int x = 0; x < currentLine.length(); x++) {
          int previousWidth = (x == 0) ? 0 : inputFont.charWidth(currentLine.charAt(x - 1));
          width += previousWidth;

          if (isSelected(x, y)) {
            g.setColor(0x000000);
            g.fillRect(
                width, y * inputHeight, inputFont.charWidth(currentLine.charAt(x)), inputHeight);

            g.setColor(0xffffff);
            g.drawChar(currentLine.charAt(x), width, y * inputHeight, Graphics.LEFT | Graphics.TOP);
          } else {
            g.setColor(0x000000);
            g.drawChar(currentLine.charAt(x), width, y * inputHeight, Graphics.LEFT | Graphics.TOP);
          }
        }

        if (currentLine.length() == 0) {
          if (isSelected(0, y)) {
            g.setColor(0x000000);
            g.fillRect(0, y * inputHeight, 5, inputHeight);
          }
        }
      }
    } else {
      for (int y = Math.max(0, yStart);
          y < Math.min(yStart + linesOnScreen + 1 + 2, vectorLines.size());
          y++) {
        g.drawString(
            vectorLines.elementAt(y).toString(), 0, y * inputHeight, Graphics.LEFT | Graphics.TOP);
      }
    }
  }
  /**
   * Draw images, starting at the specified Y
   *
   * @param startY
   */
  public void drawGrid(final Graphics g, final int startY) {
    g.setColor(0x000000);
    g.fillRect(0, startY, getWidth(), getHeight() - startY);

    for (int i = 0; i < imageObjectModel.size(); i++) {
      int xPosition = i % 2 * (getWidth() / 2);
      int yPosition = startY + scrollY + ((i - i % 2) / 2) * imageSide;

      if (yPosition > getHeight()) {
        break;
      }

      // If image is in RAM
      if (images.containsKey(imageObjectModel.elementAt(i))) {
        g.drawImage(
            (Image) (images.get(imageObjectModel.elementAt(i))),
            xPosition,
            yPosition,
            Graphics.LEFT | Graphics.TOP);
      } else {
        // If there were no results
        PicasaImageObject picasaImageObject = (PicasaImageObject) imageObjectModel.elementAt(i);

        if (picasaImageObject.thumbUrl.length() == 0) {
          g.setColor(0xFFFFFF);
          g.drawString("No Result.", 0, headerHeight, Graphics.TOP | Graphics.LEFT);

        } else {
          // Start loading the image, draw a placeholder
          PicasaStorage.imageCache.getAsync(
              picasaImageObject.thumbUrl,
              Task.NORMAL_PRIORITY,
              StaticWebCache.GET_ANYWHERE,
              new ImageResult(picasaImageObject));

          g.setColor(0x111111);
          g.fillRect(xPosition, yPosition, imageSide, imageSide);
        }
      }
    }

    drawSpinner(g);
  }
Esempio n. 19
0
  /**
   * Paint the canvas with the current color and controls to change it.
   *
   * @param g the graphics context to draw to the screen.
   */
  protected void paint(Graphics g) {
    int w = getWidth();
    int h = getHeight();

    int sample_w = w - 1;
    int sample_h = h - ((BAR_H + BORDER) * 3);
    int sample_y = BORDER;

    int b_y = sample_y + sample_h + (BORDER * 2);
    int g_y = b_y + BAR_H;
    int r_y = g_y + BAR_H;

    // Fill the background
    g.setColor(0x000000);
    g.fillRect(0, 0, w, h);

    // Fill in the color sample
    g.setColor(rgbColor);
    g.fillRect(BORDER, sample_y, sample_w, sample_h);

    // Draw the color bars
    int blue = (rgbColor >> 0) & 0xff;
    g.setColor(0, 0, 255);
    g.fillRect(20, b_y, blue / 4, 10);

    int green = (rgbColor >> 8) & 0xff;
    g.setColor(0, 255, 0);
    g.fillRect(20, g_y, green / 4, 10);

    int red = (rgbColor >> 16) & 0xff;
    g.setColor(255, 0, 0);
    g.fillRect(20, r_y, red / 4, 10);

    g.setColor(255, 255, 255);
    g.drawString(Integer.toString(blue), 18, b_y - 3, Graphics.RIGHT | Graphics.TOP);
    g.drawString(Integer.toString(green), 18, g_y - 3, Graphics.RIGHT | Graphics.TOP);
    g.drawString(Integer.toString(red), 18, r_y - 3, Graphics.RIGHT | Graphics.TOP);

    if (ndx >= 0) {
      int y = b_y + (ndx * BAR_H);
      g.drawRect(20, y, 63, 10);
    }
  }
Esempio n. 20
0
  /*--------------------------------------------------
   * 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);
  }
Esempio n. 21
0
 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);
 }
Esempio n. 22
0
 public void drawHp(Graphics g, int viewX, int viewY) {
   if (isDeath) return;
   if (showHpCount == 0) return;
   showHpCount++;
   if (showHpCount > 40) showHpCount = 0;
   g.setColor(0, 0, 255);
   g.drawString(
       grade + "",
       getX() - viewX + getWidth() / 2,
       getY() - viewY - 3,
       Graphics.TOP | Graphics.LEFT);
   g.setColor(174, 174, 174);
   g.drawRect(getX() - viewX, getY() - viewY - 2, getWidth(), 2);
   g.setColor(128, 128, 128);
   g.fillRect(getX() - viewX, getY() - viewY - 2, getWidth(), 2);
   g.setColor(255, 0, 0);
   if (hpNow < 0) hpNow = 0;
   int width = hpNow * getWidth() / 100;
   g.fillRect(getX() - viewX, getY() - viewY - 2, width, 2);
 }
Esempio n. 23
0
 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);
   }
 }
Esempio n. 24
0
  /*
   *  (non-Javadoc)
   * @see javax.microedition.lcdui.Canvas#paint(javax.microedition.lcdui.Graphics)
   */
  protected void paint(Graphics g) {

    g.setGrayScale(255);

    // Draw the image - for now start drawing in top left corner of screen
    g.fillRect(0, 0, Constants.SCREEN_WIDTH, Constants.SCREEN_HEIGHT);
    System.out.println("Screen size:" + Constants.SCREEN_WIDTH + ":" + Constants.SCREEN_HEIGHT);

    if (image == null) System.out.println("PhotoViewScreen::paint(): Image object was null.");

    g.drawImage(image, 0, 0, Graphics.TOP | Graphics.LEFT);
  }
Esempio n. 25
0
  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;
    }
  }
Esempio n. 26
0
  protected void paintCache(
      Graphics g, int x, int y, int width, int height, int heading, Cache cache) {

    g.setClip(x, y, width, height);
    g.setColor(COLOR_CACHELIST_BG);
    g.fillRect(x, y, width, height);

    g.drawImage(
        viewResources.getIcon(IC_CACHES_OFFS + cache.type), x, y, Graphics.TOP | Graphics.LEFT);
    g.drawImage(
        viewResources.getIcon(IC_COMPASS_OFFS + heading), width, y, Graphics.TOP | Graphics.RIGHT);

    // Draws a set of squares to indicate cache health based on latest logs
    for (int i = 0; i < cache.lastLogsType.length; i++) {
      g.setColor(COLOR_LOG[cache.lastLogsType[i]]);
      g.fillRect(x + 16, y + (i << 2), 4, 4);
    }

    g.setColor(COLOR_TEXT);
    g.drawString(cache.name, x + 20, y, Graphics.LEFT | Graphics.TOP);
  }
Esempio n. 27
0
 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();
 }
Esempio n. 28
0
  protected void paint(Graphics g) {
    g.setColor(Theme.TWITTER_BLUE_COLOR);
    g.fillRect(0, 0, getWidth(), getHeight());

    if (menu.isActive() == false && statusMenu.isActive() == false) {
      statusList.draw(
          g, statuses, menuBar.getHeight() + verticalScroll + TalkBalloon.textFont.getHeight() / 2);
      menuBar.draw(g, 0);
    } else if (menu.isActive()) {
      menu.draw(g);
    } else if (statusMenu.isActive()) {
      statusMenu.draw(g);
    }
  }
Esempio n. 29
0
  private void render() {
    g.setColor(0xffffffff);
    g.fillRect(0, 0, getWidth(), getHeight());
    g.drawImage(
        background, -kinetic.getWindowX(), -kinetic.getWindowY(), Graphics.LEFT | Graphics.TOP);
    g.drawImage(
        background,
        -kinetic.getWindowX(),
        background.getHeight() - kinetic.getWindowY(),
        Graphics.LEFT | Graphics.TOP);
    closeButton.render(g);

    kinetic.renderDebugData(g);
  }
Esempio n. 30
0
 /** paint the game graphic on the screen. */
 public void paint(Graphics g) throws Exception {
   g.setColor(MazeCanvas.WHITE);
   // paint the background white to cover old game objects
   // that have changed position since last paint.
   // here coordinates are given
   // with respect to the graphics (canvas) origin:
   g.fillRect(0, 0, DISP_WIDTH, DISP_HEIGHT);
   // here coordinates are given
   // with respect to the LayerManager origin:
   setViewWindow(myViewWindowX, myViewWindowY, DISP_WIDTH, DISP_HEIGHT);
   // call the paint funstion of the superclass LayerManager
   // to paint all of the Layers
   paint(g, CANVAS_X, CANVAS_Y);
 }