当前位置: 首页>>代码示例>>Java>>正文


Java Graphics.setColor方法代码示例

本文整理汇总了Java中javax.microedition.lcdui.Graphics.setColor方法的典型用法代码示例。如果您正苦于以下问题:Java Graphics.setColor方法的具体用法?Java Graphics.setColor怎么用?Java Graphics.setColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.microedition.lcdui.Graphics的用法示例。


在下文中一共展示了Graphics.setColor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import javax.microedition.lcdui.Graphics; //导入方法依赖的package包/类
/**
 * ���������ʼ��
 * @param score ����
 * @throws IOException
 */
public void init(int score) throws IOException
{
	/*��Ϸ����:42,23
	gameover:42,38
	������:38,58
	����ͼƬ:45,107*/
	gameovertip=Image.createImage("/gameovertip.GIF");
	endtip=Image.createImage("/endtip.GIF");
	scorebg=Image.createImage("/scorebg.GIF");
	gameoverbg=Image.createImage("/gameoverbg.GIF");
	
	Graphics gra=super.getGraphics();
	gra.setColor(255, 255, 255);
	gra.fillRect(0, 0, sw, sh);
	gra.drawImage(endtip, 42, 23,Graphics.LEFT|Graphics.TOP);
	gra.drawImage(gameovertip, 42, 38,Graphics.LEFT|Graphics.TOP);
	gra.drawImage(scorebg, 38, 58,Graphics.LEFT|Graphics.TOP);
	gra.drawImage(gameoverbg, 45, 107,Graphics.LEFT|Graphics.TOP);
	flushGraphics();
	repaint();
	super.ShowScore(score);
	System.out.println("��������������");
}
 
开发者ID:cabbage89,项目名称:danceGame,代码行数:29,代码来源:CanvasOver.java

示例2: paint

import javax.microedition.lcdui.Graphics; //导入方法依赖的package包/类
/**
 * Draw the item.
 */
protected void paint(final Graphics g, final int w, final int h) {
    int y = 0;

    String loginStatus = "";
    if (session.isLoggedIn()) {
        loginStatus = "Logged in as " + session.getUsername();
    }
    else {
        loginStatus = "Not logged in";
    }

    g.setColor(VisualStyles.COLOR_FOREGROUND);
    g.setFont(FONT_TEXT);
    g.drawString(loginStatus, w - H_SPACE * 2, y, Graphics.TOP
        | Graphics.RIGHT);

    g.setColor(VisualStyles.COLOR_FOREGROUND_DIM);
    if (separatorImage != null) {
        y = height - separatorImage.getHeight() - V_SPACE;
        g.drawImage(separatorImage, 0, y, Graphics.TOP | Graphics.LEFT);
    }
}
 
开发者ID:mozilla,项目名称:pluotsorbet,代码行数:26,代码来源:LoginStatusItem.java

示例3: paint

import javax.microedition.lcdui.Graphics; //导入方法依赖的package包/类
/**
 * @see CommentItem#drawContent(javax.microedition.lcdui.Graphics, int, int) 
 */
public void paint(final Graphics g, final int w, final int h) {
    int x = H_SPACE + xIndent;
    int y = V_SPACE;

    g.setColor(VisualStyles.COLOR_HIGHLIGHTED_FOREGROUND);
    g.drawLine(xIndent, 0, xIndent, h);

    g.setColor(VisualStyles.COLOR_FOREGROUND);
    g.setFont(FONT_AUTHOR);

    final int fontHeight = FONT_AUTHOR.getHeight();
    for (int i = 0; i < bodyLines.size(); i++) {
        g.drawString((String) bodyLines.elementAt(i), x, y, Graphics.TOP
            | Graphics.LEFT);
        y += fontHeight;
    }
}
 
开发者ID:mozilla,项目名称:pluotsorbet,代码行数:21,代码来源:MoreCommentsItem.java

示例4: paint

import javax.microedition.lcdui.Graphics; //导入方法依赖的package包/类
/**
 * Paints the Scrollbar. This method should be called from CanvasTextBox
 * paint method.
 */
public void paint(Graphics gfx, int x, int y) {
    int height = this.owner.getHeight();

    gfx.setColor(this.backgroundColor);
    gfx.fillRoundRect(
            x + this.margin, y,
            Scrollbar.width - 2 * this.margin, height,
            this.cornersDiameter, this.cornersDiameter);

    this.updateThumb();
    gfx.setColor(this.thumbColor);
    gfx.fillRoundRect(
            x + this.margin + 1, y + this.thumbY + 1,
            Scrollbar.width - 2 * this.margin - 2, this.thumbHeight - 2,
            this.cornersDiameter, this.cornersDiameter);
}
 
开发者ID:mozilla,项目名称:pluotsorbet,代码行数:21,代码来源:Scrollbar.java

示例5: paint

import javax.microedition.lcdui.Graphics; //导入方法依赖的package包/类
/**
    * Paints the label, currentState and scrollbar.
    */
   public void paint(Graphics gfx) {
       if (BlogWriter.isAshaPlatform()) {
           gfx.setColor(0x8D8C8C);
           gfx.fillRect(0, 0, getWidth(), getHeight());
       }

	gfx.setColor(this.currentState.labelColor);
	gfx.drawString(this.label, this.margin, this.margin, Graphics.TOP | Graphics.LEFT);

	int textEditorY = this.labelFont.getHeight() + 2 * this.margin;
	this.currentState.paint(gfx,(this.controlWidth - this.currentState.width) / 2, textEditorY);

	if (this.scrollbar != null) {
		this.scrollbar.paint(gfx, this.textEditor.getWidth()
				+ this.textEditorMargin, textEditorY
				+ this.textEditorBorderMargin);
	}
	if (this.controls != null && this.isFocused()) {
		this.controls.paint(gfx, (this.controlWidth - this.currentState.width) / 2 + this.currentState.width, textEditorY-1);
	}
}
 
开发者ID:mozilla,项目名称:pluotsorbet,代码行数:25,代码来源:CanvasTextBox.java

示例6: drawImage

import javax.microedition.lcdui.Graphics; //导入方法依赖的package包/类
private void drawImage(Graphics g, int x, int y, int offX, int offY) throws IOException {
    Image img = TileCacheManager.loadImage(zoom, x, y, mapSource, null);
    if (img != null) {
        g.drawImage(img, offX, offY, Graphics.TOP | Graphics.LEFT);
    } else {
        // If img IS null, then a repaint() is later called
        g.setColor(0, 0, 0);
        g.drawString("Loading...", offX, offY, Graphics.TOP | Graphics.LEFT);

        TileCacheManager.loadImage(zoom, x, y, mapSource, this);
    }
}
 
开发者ID:cli,项目名称:worldmap-classic,代码行数:13,代码来源:Map.java

示例7: paint

import javax.microedition.lcdui.Graphics; //导入方法依赖的package包/类
public void paint(Graphics g) {
  int width = getWidth();
  int height = getHeight();

  // Draw a green border around the VideoControl.
  g.setColor(0x00ff00);
  g.drawRect(0, 0, width - 1, height - 1);
  g.drawRect(1, 1, width - 3, height - 3);
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:10,代码来源:CameraCanvas.java

示例8: paint

import javax.microedition.lcdui.Graphics; //导入方法依赖的package包/类
/**
 * Draw the item.
 */
protected void paint(final Graphics g, final int w, final int h) {
    final String dateStr = DatePrettyPrinter.prettyPrint(link.getCreated());
    final String numCommentsStr = "" + link.getNumComments() + " comments";
    final int ncHeight = FONT_SEPARATOR.getHeight() + SEPARATOR_V_SPACE;

    int x = H_SPACE;
    int y = V_SPACE;

    g.setColor(VisualStyles.COLOR_FOREGROUND);
    g.setFont(FONT_TEXT);
    g.drawString("by " + link.getAuthor(), x, y, Graphics.TOP
        | Graphics.LEFT);
    g.drawString(dateStr, w - H_SPACE * 2, y, Graphics.TOP
        | Graphics.RIGHT);

    // Draw left and right part of the separator, then the score in the middle
    y = height - ncHeight - V_SPACE / 2;

    g.setColor(VisualStyles.COLOR_FOREGROUND_DIM);
    if (separatorImage != null) {
        g.drawImage(separatorImage, w / 2, y + ncHeight / 2, Graphics.TOP
            | Graphics.HCENTER);
    }
    g.setFont(FONT_SEPARATOR);
    g.drawString(numCommentsStr, w / 2, y - 4, Graphics.TOP
        | Graphics.HCENTER);
}
 
开发者ID:mozilla,项目名称:pluotsorbet,代码行数:31,代码来源:LinkMetadataItem.java

示例9: paint

import javax.microedition.lcdui.Graphics; //导入方法依赖的package包/类
/**
   * Draws the item.
   * 
   * @param g Graphics context.
   * @param viewX Top-left x-coordinate of the current view area (grid coordinates, not screen) 
   * @param viewY Top-left y-coordinate of the current view area (grid coordinates, not screen)
   */
  public void paint(Graphics g, int viewX, int viewY){
if (Log.TEST) Log.note("[GridItem#paint]-->");
  	// Calculate actual drawing coordinates from the view coordinates
int translatedX = x - viewX;
  	int translatedY = y - viewY;
  	
      // First draw the underlying rectangle, and get color for text drawing
      if (selected) {
          g.setColor(display.getColor(Display.COLOR_HIGHLIGHTED_BACKGROUND));
          // Draw highlighted background
          g.fillRect(translatedX, translatedY, width, height);
          g.setColor(display.getColor(Display.COLOR_HIGHLIGHTED_BORDER));
          // Draw border
          g.drawRect(translatedX, translatedY, width, height);
          // Set color for text drawing
          g.setColor(display.getColor(Display.COLOR_HIGHLIGHTED_FOREGROUND));
      } else {
      	//g.setColor(display.getColor(Display.COLOR_BORDER));
      	//g.setColor(display.getColor(Display.COLOR_HIGHLIGHTED_FOREGROUND));
              g.setColor(~display.getColor(Display.COLOR_BACKGROUND));

      	// Draw border
      	g.drawRect(translatedX, translatedY, width, height);
      	// Set color for text drawing
          g.setColor(display.getColor(Display.COLOR_FOREGROUND));
      }
      
      drawContents(g, translatedX + V_PAD, translatedY + H_PAD,
      		width - 2 * H_PAD, height - 2 * V_PAD);
      }
 
开发者ID:mozilla,项目名称:pluotsorbet,代码行数:38,代码来源:GridItem.java

示例10: paint

import javax.microedition.lcdui.Graphics; //导入方法依赖的package包/类
/**
 * Draw the item.
 */
protected void paint(Graphics g, int w, int h) {
    int x = VisualStyles.COMMENT_H_SPACE;
    int y = VisualStyles.COMMENT_V_SPACE;

    g.setColor(VisualStyles.COLOR_FOREGROUND);
    g.setFont(font);
    for (int i = 0, len = textLines.size(); i < len; i++) {
        g.drawString((String) textLines.elementAt(i), x, y, Graphics.TOP
            | Graphics.LEFT);
        y += font.getHeight();
    }
}
 
开发者ID:mozilla,项目名称:pluotsorbet,代码行数:16,代码来源:TextItem.java

示例11: paint

import javax.microedition.lcdui.Graphics; //导入方法依赖的package包/类
/**
 * Paint the state. Should be called from Button's paint method.
 */
public void paint(Graphics gfx, String text) {
    gfx.drawImage(
            background,
            owner.getWidth() / 2, owner.getHeight() / 2,
            Graphics.VCENTER | Graphics.HCENTER);
    gfx.setColor(0x000000);
    gfx.drawRect(0, 0, owner.getWidth() - 1, owner.getHeight() - 1);
    gfx.setColor(this.labelColor);
    gfx.drawString(
            text,
            owner.getWidth() / 2, (owner.getHeight() / 3) * 2,
            Graphics.BASELINE | Graphics.HCENTER);
}
 
开发者ID:mozilla,项目名称:pluotsorbet,代码行数:17,代码来源:Button.java

示例12: paint

import javax.microedition.lcdui.Graphics; //导入方法依赖的package包/类
public void paint(Graphics g) {
    if (pressed) {
        g.setColor(backgroundColorPressed);
    } else {
        g.setColor(backgroundColor);
    }
    g.fillRoundRect(left, top, width, height, cornersDiameter, cornersDiameter);
    g.setColor(color);
    g.drawRoundRect(left, top, width, height, cornersDiameter, cornersDiameter);
    g.drawString(text, left + width / 2, top + (height - g.getFont().getHeight()) / 2, Graphics.HCENTER | Graphics.TOP);
}
 
开发者ID:mozilla,项目名称:pluotsorbet,代码行数:12,代码来源:Controls.java

示例13: paint

import javax.microedition.lcdui.Graphics; //导入方法依赖的package包/类
protected void paint(Graphics g) {
    g.setColor(0x00FFFFFF);
    g.fillRect(0, 0, getWidth(), getHeight());

    synchronized (paintedLock) {
        painted = true;
        paintedLock.notify();
    }
}
 
开发者ID:mozilla,项目名称:pluotsorbet,代码行数:10,代码来源:ContentHandlerMIDlet.java

示例14: paint

import javax.microedition.lcdui.Graphics; //导入方法依赖的package包/类
protected void paint( Graphics g ){
           g.setColor(0, 0, 0);
           g.fillRect(0, 0, getWidth(), getHeight());
	g.drawImage( iImage, x , y, Graphics.TOP | Graphics.LEFT );
	if( x + iImageWidth - getWidth() < 0 )
		g.drawImage( iImage, x + iImageWidth, y, Graphics.TOP | Graphics.LEFT );

}
 
开发者ID:mozilla,项目名称:pluotsorbet,代码行数:9,代码来源:PanoramaCanvas.java

示例15: drawGPSDot

import javax.microedition.lcdui.Graphics; //导入方法依赖的package包/类
private void drawGPSDot(Graphics g, int x, int y) {
    if (this.gpsPos.hasLocationProvider()) {
        for (int n = 2; n < zoom * 8 / this.gpsPos.getSatellites(); n += 6) {
            g.setColor(0, 25, 255);
            g.drawArc(x - (n >> 1), y - (n >> 1), n, n, 0, 360);
        }
    }
}
 
开发者ID:cli,项目名称:worldmap-classic,代码行数:9,代码来源:Map.java


注:本文中的javax.microedition.lcdui.Graphics.setColor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。