本文整理汇总了Java中javax.microedition.lcdui.Image.createImage方法的典型用法代码示例。如果您正苦于以下问题:Java Image.createImage方法的具体用法?Java Image.createImage怎么用?Java Image.createImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.microedition.lcdui.Image
的用法示例。
在下文中一共展示了Image.createImage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getListRowImage
import javax.microedition.lcdui.Image; //导入方法依赖的package包/类
private Image getListRowImage(int priority){
Image image = null;
String path;
if (priority < 3)
path = "/low.png";
else if (priority < 7)
path = "/normal.png";
else
path = "/important.png";
try {
image = Image.createImage(path);
} catch (IOException e) {
e.printStackTrace();
}
return image;
}
示例2: getCategoryImage
import javax.microedition.lcdui.Image; //导入方法依赖的package包/类
private Image getCategoryImage(String id) {
Image image = null;
String path;
if(id.equals("Family"))
path = "/family.png";
else if(id.equals("Work"))
path = "/work.png";
else
path = "/school.png";
try {
image = Image.createImage(path);
} catch (IOException e) {
e.printStackTrace();
}
return image;
}
示例3: init
import javax.microedition.lcdui.Image; //导入方法依赖的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("��������������");
}
示例4: PaintCanvas
import javax.microedition.lcdui.Image; //导入方法依赖的package包/类
public PaintCanvas(ApplicationListener listener, boolean isLandscape) {
this.listener = listener;
this.isLandscape = isLandscape;
setFullScreenMode(true);
width = getWidth();
height = getHeight();
if (isLandscape) {
width = height;
height = getWidth();
}
image = Image.createImage(width, height);
Graphics g = image.getGraphics();
graphics = new JecpGraphics(g);
listener.onStartApp(width, height);
thread = new DrawingThread();
thread.keepRunning = true;
thread.start();
}
示例5: GameCanvasLFImpl
import javax.microedition.lcdui.Image; //导入方法依赖的package包/类
/**
* Create new implementation instance for the given GameCanvas
* @param c GameCanvas instance to create the implementation for
*/
public GameCanvasLFImpl(GameCanvas c) {
owner = c;
graphicsAccess = GameMap.getGraphicsAccess();
/* IMPL_NOTE: The initial off-screen buffer has the same width
* and height as the entire screen. Further resizing will not
* cause memory reallocation until new geometry is bigger than
* the current one. Screen rotation is one of the cases the
* reallocation is needed.
*
* User can override the methods getWidth() and getHeight() of
* GameCanvas, so they should not be used for off-screen buffer
* initial allocation.
*/
offscreenBuffer = Image.createImage(
graphicsAccess.getScreenWidth(),
graphicsAccess.getScreenHeight());
}
示例6: Screen
import javax.microedition.lcdui.Image; //导入方法依赖的package包/类
public Screen(Display display) {
super();
this.setFullScreenMode(true);
this.parentDisplay = display;
updateOrientation();
try {
// Create background image
this.background = Image.createImage("midlets/blogwriter/images/Background.png");
} catch (IOException e) {
this.parentDisplay.setCurrent(
new Alert("Cannot create graphics."), this);
}
VirtualKeyboard.setVisibilityListener(this);
}
示例7: MyCanvas
import javax.microedition.lcdui.Image; //导入方法依赖的package包/类
protected MyCanvas(boolean suppressKeyEvents,boolean hasreadhistory) {
super(suppressKeyEvents);
// TODO Auto-generated constructor stub
try {
bg=Image.createImage("/bg.GIF");
oready=Image.createImage("/oready.GIF");
o1=Image.createImage("/o1.GIF");
o3=Image.createImage("/o3.GIF");
o7=Image.createImage("/o7.GIF");
o9=Image.createImage("/o9.GIF");
lift=Image.createImage("/lift.GIF");
liftbg=Image.createImage("/liftbg.GIF");
pass=Image.createImage("/pass.GIF");
notpass=Image.createImage("/notpass.GIF");
passbg=Image.createImage("/passbg.GIF");
passarea=Image.createImage("/passarea.GIF");
scorearea=Image.createImage("/scorearea.GIF");
n0=Image.createImage("/0.GIF");
n1=Image.createImage("/1.GIF");
n2=Image.createImage("/2.GIF");
n3=Image.createImage("/3.GIF");
n4=Image.createImage("/4.GIF");
n5=Image.createImage("/5.GIF");
n6=Image.createImage("/6.GIF");
n7=Image.createImage("/7.GIF");
n8=Image.createImage("/8.GIF");
n9=Image.createImage("/9.GIF");
ispass=getClass().getResourceAsStream("/pass.wav");
System.out.println("ͼƬ��������ʼ�����...");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
System.out.println("��ȡͼƬ�쳣");
}
init(hasreadhistory); //��ʼ����Ϸ����
}
示例8: MyCanvas
import javax.microedition.lcdui.Image; //导入方法依赖的package包/类
protected MyCanvas(boolean suppressKeyEvents) {
super(suppressKeyEvents);
// TODO Auto-generated constructor stub
try {
bg=Image.createImage("/bg.GIF");
oready=Image.createImage("/oready.GIF");
o1=Image.createImage("/o1.GIF");
o3=Image.createImage("/o3.GIF");
o7=Image.createImage("/o7.GIF");
o9=Image.createImage("/o9.GIF");
lift=Image.createImage("/lift.GIF");
liftbg=Image.createImage("/liftbg.GIF");
pass=Image.createImage("/pass.GIF");
notpass=Image.createImage("/notpass.GIF");
passbg=Image.createImage("/passbg.GIF");
passarea=Image.createImage("/passarea.GIF");
scorearea=Image.createImage("/scorearea.GIF");
n0=Image.createImage("/0.GIF");
n1=Image.createImage("/1.GIF");
n2=Image.createImage("/2.GIF");
n3=Image.createImage("/3.GIF");
n4=Image.createImage("/4.GIF");
n5=Image.createImage("/5.GIF");
n6=Image.createImage("/6.GIF");
n7=Image.createImage("/7.GIF");
n8=Image.createImage("/8.GIF");
n9=Image.createImage("/9.GIF");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
System.out.println("��ȡͼƬ�쳣");
}
init(); //��ʼ����Ϸ����
}
示例9: createImages
import javax.microedition.lcdui.Image; //导入方法依赖的package包/类
public void createImages()
{
try
{
active = Image.createImage("/images/button_in(red).png");
inactive = Image.createImage("/images/button(red).png");
overin = Image.createImage("/images/button_in_over(red).png");
overout = Image.createImage("/images/button_over(red).png");
}
catch (IOException e) {
System.out.println("Images not found");
}
}
示例10: getImageItemForScreen
import javax.microedition.lcdui.Image; //导入方法依赖的package包/类
protected ImageItem getImageItemForScreen(InputStream is) {
Image im = null;
try {
im = Image.createImage(is);
} catch(OutOfMemoryError ome ){
ome.printStackTrace();
Logger.die("GetImageOOM", new RuntimeException(ome.getMessage()));
return null;
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
Logger.die("GetImageioe", e);
}
if(im !=null){
Logger.log("file", "got an image");
int height = scrHeight/2;
int width = scrWidth-16;
//scale
int[] newDimension = ImageUtils.getNewDimensions(im, height, width);
if(newDimension[0] != height || newDimension[1] != width) {
im = ImageUtils.resizeImage(im, newDimension[1], newDimension[0]);
}
Logger.log("file", "resized it");
ImageItem imItem = new ImageItem(null,im, ImageItem.LAYOUT_CENTER | ImageItem.LAYOUT_VCENTER, "Cannot Display Image");
imItem.setLayout(Item.LAYOUT_CENTER);
return imItem;
}else{
return null;
}
}
示例11: start
import javax.microedition.lcdui.Image; //导入方法依赖的package包/类
public synchronized void start()
{
//Afbeeldingen maken voor de achtergrond en het pijltje wat aangeeft op welke positie
//de beatmaker is
try
{
positie = Image.createImage("/images/pijl.png");
bgimage = Image.createImage("/background.jpg");
}
catch (IOException e) {
System.out.println("Images not found");
}
//Knoppen om van instrument te wissen aanmaken
piano = new InstrumentButton(30,4, g, "piano");
gitaar = new InstrumentButton(30,130, g, "gitaar");
drums = new InstrumentButton(30, 260, g, "overig");
play = new PlayKnop(g, 30, 570);
//standaard krijg je de piano voor je neus dus deze zetten we aan
piano.turnOn();
//DIt is om te controlleren op welke pad we geklikt hebben
action = new TouchActions();
createInstruments();
draw();
playLoop();
}
示例12: start
import javax.microedition.lcdui.Image; //导入方法依赖的package包/类
public void start() {
Image image = null;
try {
image = Image.createImage(this.picture);
} catch (Exception e) {
throw new RuntimeException("Busted splash screen image. Fix this");
}
InitializerSplashScreen splashScreen = new InitializerSplashScreen(Display.getInstance(),
image, backgroundColor, null, messageColor, this);
J2MEDisplay.setView(splashScreen);
}
示例13: ButtonState
import javax.microedition.lcdui.Image; //导入方法依赖的package包/类
public ButtonState(CanvasItem owner, String image, int color)
throws Exception {
this.owner = owner;
this.labelColor = color;
try {
this.background = Image.createImage(image);
} catch (IOException e) {
throw new Exception("Unable to load graphics resources.");
}
}
示例14: loadImage
import javax.microedition.lcdui.Image; //导入方法依赖的package包/类
/**
* Inefficient way to read the image data from the InputStream but
* necessary for some servers.
* @param in
* @param out
* @return
* @throws IOException
*/
private Image loadImage(InputStream in, ByteArrayOutputStream out) throws IOException {
int b;
while ((b = in.read()) != -1) {
out.write(b);
}
byte[] buf = out.toByteArray();
return Image.createImage(buf, 0, buf.length);
}
示例15: createImage
import javax.microedition.lcdui.Image; //导入方法依赖的package包/类
public static Image createImage(int width, int height, int argb) {
// Image::createImage(int width, int height)
// in turn calls
// ImageDataFactory::createMutableImageData(ImageData data, int width, int height)
Image image = Image.createImage(width, height);
setPixels(image, argb);
return image;
}