本文整理匯總了Java中javax.microedition.lcdui.Image.createImage方法的典型用法代碼示例。如果您正苦於以下問題:Java Image.createImage方法的具體用法?Java Image.createImage怎麽用?Java Image.createImage使用的例子?那麽恭喜您, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.microedition.lcdui.Image的用法示例。
在下文中一共展示了Image.createImage方法的24個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於我們的係統推薦出更棒的Java代碼示例。
示例1: getListRowImage
點讚 3
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;
}
開發者ID:NotesTeam,項目名稱:TaskBook-J2ME,代碼行數:18,
示例2: getCategoryImage
點讚 3
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;
}
開發者ID:NotesTeam,項目名稱:TaskBook-J2ME,代碼行數:19,
示例3: init
點讚 3
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("��������������");
}
開發者ID:cabbage89,項目名稱:danceGame,代碼行數:29,
示例4: PaintCanvas
點讚 3
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();
}
開發者ID:aNNiMON,項目名稱:JECP,代碼行數:21,
示例5: GameCanvasLFImpl
點讚 3
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());
}
開發者ID:mozilla,項目名稱:pluotsorbet,代碼行數:24,
示例6: Screen
點讚 3
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);
}
開發者ID:mozilla,項目名稱:pluotsorbet,代碼行數:17,
示例7: MyCanvas
點讚 2
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);//��ʼ����Ϸ����
}
開發者ID:cabbage89,項目名稱:danceGame,代碼行數:40,
示例8: MyCanvas
點讚 2
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();//��ʼ����Ϸ����
}
開發者ID:cabbage89,項目名稱:danceGame,代碼行數:36,
示例9: createImages
點讚 2
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");
}
}
開發者ID:WernerLDev,項目名稱:Beatmaker,代碼行數:14,
示例10: getImageItemForScreen
點讚 2
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;
}
}
開發者ID:dimagi,項目名稱:commcare-j2me,代碼行數:34,
示例11: start
點讚 2
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();
}
開發者ID:WernerLDev,項目名稱:Beatmaker,代碼行數:30,
示例12: start
點讚 2
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);
}
開發者ID:dimagi,項目名稱:commcare-j2me,代碼行數:13,
示例13: ButtonState
點讚 2
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.");
}
}
開發者ID:mozilla,項目名稱:pluotsorbet,代碼行數:11,
示例14: loadImage
點讚 2
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);
}
開發者ID:cli,項目名稱:worldmap-classic,代碼行數:17,
示例15: createImage
點讚 2
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;
}
開發者ID:mozilla,項目名稱:pluotsorbet,代碼行數:9,
示例16: readImage
點讚 2
import javax.microedition.lcdui.Image; //導入方法依賴的package包/類
/**
* Reads next frame image
*/
protected void readImage() {
ix = readShort(); // (sub)image position & size
iy = readShort();
iw = readShort();
ih = readShort();
int packed = read();
lctFlag = (packed & 0x80) != 0; // 1 - local color table flag
interlace = (packed & 0x40) != 0; // 2 - interlace flag
// 3 - sort flag
// 4-5 - reserved
lctSize = 2 << (packed & 7); // 6-8 - local color table size
if (lctFlag) {
lct = readColorTable(lctSize); // read table
act = lct; // make local table active
} else {
act = gct; // make global table active
if (bgIndex == transIndex) {
bgColor = 0;
}
}
int save = 0;
if (transparency) {
save = act[transIndex];
act[transIndex] = 0; // set transparent color if specified
}
if (act == null) {
status = STATUS_FORMAT_ERROR; // no color table defined
}
if (err()) {
return;
}
decodeImageData(); // decode pixel data
skip();
if (err()) {
return;
}
frameCount++;
// create new image to receive frame data
image = Image.createImage(width, height);
setPixels(); // transfer pixel data to image
frames.addElement(new GifFrame(image, delay)); // add image to frame
// list
if (transparency) {
act[transIndex] = save;
}
resetFrame();
}
開發者ID:cabbage89,項目名稱:danceGame,代碼行數:63,
示例17: ImageME
點讚 2
import javax.microedition.lcdui.Image; //導入方法依賴的package包/類
public ImageME(InputStream is) throws IOException {
image = Image.createImage(is);
if (is != null) is.close();
}
開發者ID:aNNiMON,項目名稱:JECP,代碼行數:5,
示例18: populateEntries
點讚 2
import javax.microedition.lcdui.Image; //導入方法依賴的package包/類
private void populateEntries() {
Vector entriesVec = new Vector();
FormIndex index = FormIndex.createBeginningOfFormIndex();
FormDef form = model.getForm();
int prevDepth = 0;
while (!index.isEndOfFormIndex()) {
if (index.isInForm() && model.isIndexRelevant(index)) {
String text = "";
boolean isHeader = false;
Image img = null;
if (model.getEvent(index) == FormEntryController.EVENT_QUESTION) {
FormEntryPrompt prompt = model.getQuestionPrompt(index);
text = getText(prompt);
} else if (model.getEvent(index) == FormEntryController.EVENT_PROMPT_NEW_REPEAT) {
FormEntryCaption[] hierachy = model.getCaptionHierarchy(index);
text = "Add "
+ (index.getElementMultiplicity() == 0 ? "a "
: "another ")
+ hierachy[hierachy.length - 1].getLongText() + "?";
try {
img = Image.createImage(Localization.get("plussign"));
} catch (IOException ioe) {
img = null;
Logger.exception(ioe);
}
} else if ((model.getEvent(index) == FormEntryController.EVENT_GROUP)
|| (model.getEvent(index) == FormEntryController.EVENT_REPEAT)) {
text = getHeaderText(model.getCaptionHierarchy(index));
isHeader = true;
}
if (!text.equals("")) {
Style style = isHeader ? StyleSheet
.getStyle(Constants.STYLE_HEADER) : StyleSheet
.getStyle(Constants.STYLE_PROMPT);
String spacer="";
int i = isHeader?-1:0;
while (i < index.getDepth() - 2) {
//ctsims : Huh?
//spacer = "――" + spacer;
spacer = "> > " + spacer;
i++;
}
text=img==null?spacer+text:text;
entriesVec.addElement(new Entry(text, img, style, index));
}
}
prevDepth = index.getDepth();
index = model.incrementIndex(index);
}
entries = new Entry[entriesVec.size()];
entriesVec.copyInto(entries);
}
開發者ID:dimagi,項目名稱:commcare-j2me,代碼行數:55,
示例19: LoginScreen
點讚 2
import javax.microedition.lcdui.Image; //導入方法依賴的package包/類
public LoginScreen(Display display) {
super(display);
try {
this.userNameTextBox = new CanvasTextBox(
this, "Login", TextField.ANY, this.maxLoginLength);
this.userNameTextBox.setTextEditorListener(this);
this.passwordTextBox = new CanvasTextBox(
this, "Password", TextField.PASSWORD, this.maxLoginLength);
this.passwordTextBox.setTextEditorListener(this);
} catch (IllegalStateException e1) {
// TODO Auto-generated catch block
this.parentDisplay.setCurrent(
new Alert("e1 " + e1),
this);
//e1.printStackTrace();
}
//Disable Password box. It will be enabled once username is not empty.
this.passwordTextBox.setEnabled(false);
try {
this.exitButton = new Button(
this, "Exit",
new Runnable() {
public void run() {
// When Exit is tapped, close the application
removeItems();
Display.getDisplay(parent).setCurrent(null);
parent.notifyDestroyed();
}
});
this.loginButton = new Button(
this, "Log in",
new Runnable() {
public void run() {
// When Login is tapped, create a new screen and set it current
if(BlogWriter.isAshaPlatform())
removeItems();
EditScreen editScreen = new EditScreen(parentDisplay);
editScreen.setParent(parent);
parentDisplay.setCurrent(editScreen);
}
});
// Disable Login button - it is enabled once username and password are entered
this.loginButton.setEnabled(false);
} catch (Exception ex) {
this.parentDisplay.setCurrent(
new Alert("Cannot create controls."),
this);
}
// Create the logo image
try {
this.logoImage = Image.createImage("midlets/blogwriter/images/LogoImage.png");
} catch (IOException e) {
this.parentDisplay.setCurrent(
new Alert("Cannot create graphics."), this);
}
// Set the default position of items and buttons
this.layoutControls();
this.userNameTextBox.setVisible(true);
if (!BlogWriter.isFullTouch() && !BlogWriter.isAshaPlatform()) {
this.userNameTextBox.setFocused(true);
}
this.passwordTextBox.setVisible(true);
}
開發者ID:mozilla,項目名稱:pluotsorbet,代碼行數:70,
示例20: createImage
點讚 2
import javax.microedition.lcdui.Image; //導入方法依賴的package包/類
public static javax.microedition.lcdui.Image createImage(byte[] b, int i1, int i2) {
return Image.createImage(0,0);
}
開發者ID:Orange-OpenSource,項目名稱:matos-profiles,代碼行數:4,
示例21: loadImage
點讚 2
import javax.microedition.lcdui.Image; //導入方法依賴的package包/類
private Image loadImage(String url)
{
Image image = null;
if (image == null)
{
try
{
StreamConnection connection = ProtocolFactory.getInstance().getConnection(url);
InputStream is = connection.openInputStream();
ByteArrayOutputStream bos = new ByteArrayOutputStream();
byte[] buf = new byte[1024];
int bytesRead;
do
{
bytesRead = is.read(buf);
if (bytesRead > 0)
{
bos.write(buf, 0, bytesRead);
}
}
while (bytesRead >= 0);
buf = bos.toByteArray();
//#debug
System.out.println("Image requested: " + url);
image = Image.createImage(buf, 0, buf.length);
// this.imageCache.put(url, image);
return image;
}
catch (Exception e)
{
// TODO: Implement proper error handling.
//#debug debug
e.printStackTrace();
return null;
}
}
return image;
}
開發者ID:okoskimi,項目名稱:Xfolite,代碼行數:48,
示例22: imageCreateFromByteArray
點讚 2
import javax.microedition.lcdui.Image; //導入方法依賴的package包/類
public Object imageCreateFromByteArray(byte[] data, int offset, int length) {
return Image.createImage(data, offset, length);
}
開發者ID:mozilla,項目名稱:pluotsorbet,代碼行數:4,
示例23: loadImageInternal
點讚 2
import javax.microedition.lcdui.Image; //導入方法依賴的package包/類
private Image loadImageInternal(String url)
{
Image image = null; // (Image) this.imageCache.get(url);
if (image == null)
{
try
{
StreamConnection connection = ProtocolFactory.getInstance().getConnection(url);
InputStream is = connection.openInputStream();
ByteArrayOutputStream bos = new ByteArrayOutputStream();
byte[] buf = new byte[1024];
int bytesRead;
do
{
bytesRead = is.read(buf);
if (bytesRead > 0)
{
bos.write(buf, 0, bytesRead);
}
}
while (bytesRead >= 0);
buf = bos.toByteArray();
//#debug
System.out.println("Image requested: " + url);
image = Image.createImage(buf, 0, buf.length);
// this.imageCache.put(url, image);
return image;
}
catch (Exception e)
{
// TODO: Implement proper error handling.
//#debug debug
e.printStackTrace();
return null;
}
}
return image;
}
開發者ID:okoskimi,項目名稱:Xfolite,代碼行數:48,
示例24: getImage
點讚 1
import javax.microedition.lcdui.Image; //導入方法依賴的package包/類
public javax.microedition.lcdui.Image getImage() { return Image.createImage( (Image) null); }
開發者ID:Orange-OpenSource,項目名稱:matos-profiles,代碼行數:2,
注:本文中的javax.microedition.lcdui.Image.createImage方法示例整理自Github/MSDocs等源碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。