本文整理汇总了Java中net.rim.device.api.ui.Graphics.fillRect方法的典型用法代码示例。如果您正苦于以下问题:Java Graphics.fillRect方法的具体用法?Java Graphics.fillRect怎么用?Java Graphics.fillRect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.rim.device.api.ui.Graphics
的用法示例。
在下文中一共展示了Graphics.fillRect方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: draw
import net.rim.device.api.ui.Graphics; //导入方法依赖的package包/类
public void draw(Graphics g, XYRect rect) {
int[] path = {startColor, startColor, endColor, endColor};
int[] xes = {0x0, rect.width, rect.width, 0};
int[] yes = {0x0, 0x0, rect.height, rect.height};
g.translate(rect.x, rect.y);
g.drawShadedFilledPath(xes, yes, null, path, null);
g.translate(-rect.x, -rect.y);
int oldColor = g.getColor();
if (topBorderHeight > 0) {
g.setColor(topBorderColor);
g.fillRect(rect.x, rect.y, rect.width, topBorderHeight);
}
if (bottomBorderHeight > 0) {
g.setColor(bottomBorderColor);
g.fillRect(rect.x, rect.y - bottomBorderHeight, rect.width, bottomBorderHeight);
}
g.setColor(oldColor);
}
示例2: paint
import net.rim.device.api.ui.Graphics; //导入方法依赖的package包/类
protected void paint(Graphics g) {
if (bitmap != null) {
bitmap.draw(g, 0, 0, getContentWidth(), getContentHeight());
} else if (defaultBitmap != null) {
defaultBitmap.draw(g, 0, 0, getContentWidth(), getContentHeight());
}
if (text != null) {
int h = R.px(10);
int oldAlpha = g.getGlobalAlpha();
int oldColor = g.getColor();
g.setGlobalAlpha(150);
g.fillRect(0, getContentHeight() - h, getContentWidth(), h);
g.setGlobalAlpha(200);
g.setColor(0xEEEEEE);
g.drawText(text, getContentWidth() / 2, getContentHeight() - h / 2, DrawStyle.HCENTER);
g.setGlobalAlpha(oldAlpha);
g.setColor(oldColor);
}
}
示例3: run
import net.rim.device.api.ui.Graphics; //导入方法依赖的package包/类
public void run() {
synchronized (UiApplication.getEventLock()) {
if (_time > 0) {
Bitmap _bmp = new Bitmap(Display.getWidth(),
Display.getHeight());
Graphics g = new Graphics(_bmp);
g.setColor(Color.BLACK);
g.fillRect(0, 0, Display.getWidth(), Display.getHeight());
g.drawBitmap(
((_bmp.getWidth() / 2) - (_img.getWidth() / 2)), 0,
_img.getWidth(), _img.getHeight(), _img, 0, 0);
g.setColor(Color.WHITE);
g.drawText(_time + "s", Display.getWidth() - 60,
Display.getHeight() - 50);
bmp.setBitmap(_bmp);
_time--;
} else {
t.cancel();
quit();
}
}
}
示例4: run
import net.rim.device.api.ui.Graphics; //导入方法依赖的package包/类
public void run() {
synchronized (UiApplication.getEventLock()) {
if (_time > 0) {
Bitmap _bmp = new Bitmap(Display.getWidth(),
Display.getHeight());
Graphics g = new Graphics(_bmp);
g.setColor(Color.BLACK);
g.fillRect(0, 0, Display.getWidth(), Display.getHeight());
g.drawBitmap(
((_bmp.getWidth() / 2) - (_img.getWidth() / 2)), 0,
_img.getWidth(), _img.getHeight(), _img, 0, 0);
g.setColor(Color.WHITE);
g.drawText(_time + "s", Display.getWidth() - 60,
Display.getHeight() - 50);
bmp.setBitmap(_bmp);
_time--;
} else {
t.cancel();
quit();
}
}
}
示例5: createMutableImage
import net.rim.device.api.ui.Graphics; //导入方法依赖的package包/类
public Object createMutableImage(int width, int height, int fillColor) {
Bitmap b = new Bitmap(width, height);
Graphics g = new Graphics(b);
if ((fillColor & 0xff000000) != 0xff000000) {
g.setColor(fillColor & 0xffffff);
int oldAlpha = g.getGlobalAlpha();
g.setGlobalAlpha((fillColor >> 24) & 0xff);
g.clear();
g.setGlobalAlpha(oldAlpha);
} else {
g.setColor(fillColor & 0xffffff);
g.fillRect(0, 0, width, height);
}
return b;
}
示例6: paint
import net.rim.device.api.ui.Graphics; //导入方法依赖的package包/类
protected void paint(Graphics g) {
int oldColor = g.getColor();
try {
g.setColor(color);
g.fillRect(0, 0, getWidth(), getHeight());
} finally {
g.setColor(oldColor);
}
}
示例7: ColorSelector
import net.rim.device.api.ui.Graphics; //导入方法依赖的package包/类
public ColorSelector(int redc, int bluec, int greenc){
super(Dialog.D_OK, "Select a color : ", Dialog.OK, null, Dialog.DEFAULT_CLOSE);
red = new GaugeField("Red : ", 0, 255, redc, GaugeField.VISUAL_STATE_NORMAL);
blue = new GaugeField("Blue : ", 0, 255, bluec, GaugeField.VISUAL_STATE_NORMAL);
green = new GaugeField("Green : ", 0, 255, greenc, GaugeField.VISUAL_STATE_NORMAL);
g = new Graphics(bmp);
g.fillRect(0, 0, 51, 51);
preview.setBitmap(bmp);
this.add(red);
this.add(blue);
this.add(green);
this.add(preview);
}
示例8: AddText
import net.rim.device.api.ui.Graphics; //导入方法依赖的package包/类
private void AddText(int X, int Y, String text) {
Graphics gd = new Graphics(bmpd);
final Graphics g = new Graphics(bmp);
try {
int i;
String txt = new String("");
if (text.equals("") == true) {
Dialog d = new Dialog(Dialog.D_OK_CANCEL,
"Enter a text to add :", Dialog.OK, null,
Dialog.DEFAULT_CLOSE);
inputField = new BasicEditField();
inputField.setChangeListener(new FieldChangeListener() {
public void fieldChanged(Field arg0, int arg1) {
if (g.getFont().getAdvance(inputField.getText()) > Display
.getWidth() - 20) {
inputField
.setMaxSize(inputField.getText().length());
} else {
inputField.setMaxSize(200);
}
}
});
d.add(inputField);
i = d.doModal();
txt = inputField.getText();
caption = txt;
} else {
txt = text;
i = Dialog.OK;
}
Y = Y - 10;
X = (Display.getWidth() / 2) - ((g.getFont().getAdvance(txt)) / 2);
if (i == Dialog.OK) {
g.setColor(Color.BLACK);
g.setGlobalAlpha(128);
gd.setColor(Color.BLACK);
gd.setGlobalAlpha(128);
g.fillRect(0, Y - 4, Display.getWidth(), 45);
gd.fillRect(0, Y - 4, Display.getWidth(), 45);
gd.setColor(currentcolor);
gd.setGlobalAlpha(255);
g.setColor(currentcolor);
g.setGlobalAlpha(255);
g.drawText(txt, X, Y);
gd.drawText(txt, X, Y);
gd.drawBitmap(55, 5, 50, 50, _20img, 0, 0);
gd.drawBitmap(0, Display.getHeight() - 100, 100, 100, _0img, 0,
0);
gd.drawBitmap(Display.getWidth() - 55, 5, 55, 50, _2img, 0, 0);
if (_drawing == false) {
gd.drawBitmap(5, 5, 50, 50, _10img, 0, 0);
} else {
gd.drawBitmap(5, 5, 50, 50, _11img, 0, 0);
}
gd.drawBitmap(Display.getWidth() - 100,
Display.getHeight() - 100, 100, 100, _1img, 0, 0);
actualize();
}
} catch (Exception E) {
}
}