PDA

View Full Version : چطور میشه یک صفحه fullscreen در j2me ساخت



Mehran_Asghari
پنج شنبه 19 بهمن 1385, 09:24 صبح
با سلام خدمت تمامی دوستان
من یک sampel در مورد اینکه یک صفحه fullscreen در j2me داشته باشم میخوام
اگه از دوستان کسی میدونه کمک کنه
ممنونم

zehs_sha
پنج شنبه 19 بهمن 1385, 09:55 صبح
تا اونجا که من می دونم صفحه برنامه ای که اجرا می شود full screen هست ؟؟؟

rezaTavak
پنج شنبه 19 بهمن 1385, 10:38 صبح
باید از canvas استفاده کنید.

Mehran_Asghari
پنج شنبه 19 بهمن 1385, 21:54 عصر
باید از canvas استفاده کنید.

من یه چیزهای درباره canvas شنیدم و سورسهایی هم پیدا کردم ولی مشکلم حل نشد یه مثال واقعی و آماده کامپایل میخوام .

ehsant
جمعه 20 بهمن 1385, 10:55 صبح
اگه wtk رو نصب کرده باشی خودش کلی نمونه داره

rezaTavak
جمعه 20 بهمن 1385, 17:41 عصر
باید از midlet2.0 به بالا استفاده کنید:





import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import java.util.*;

/**
* Test the FullScreen functionallity
*
* This code is part of the Tips & Tricks section at
* www.SonyEricsson.com/developer
*
* COPYRIGHT All rights reserved Sony Ericsson Mobile Communications AB 2004.
* The software is the copyrighted work of Sony Ericsson Mobile Communications AB.
* The use of the software is subject to the terms of the end-user license
* agreement which accompanies or is included with the software. The software is
* provided "as is" and Sony Ericsson specifically disclaim any warranty or
* condition whatsoever regarding merchantability or fitness for a specific
* purpose, title or non-infringement. No warranty of any kind is made in
* relation to the condition, suitability, availability, accuracy, reliability,
* merchantability and/or non-infringement of the software provided herein.
*
* Written by Jöns Weimarck, 2004
*/
public class FullScreen extends MIDlet implements CommandListener {


private Command exitCommand;
private Command toggleCommand;
private TestCanvas myCanvas;
private boolean fullscreen=false;

public void startApp () {
exitCommand = new Command ("Exit",Command.EXIT,0);
toggleCommand = new Command ("Toggle FullScreen",Command.SCREEN,0);

myCanvas = new TestCanvas();
myCanvas.setFullScreenMode(fullscreen);

myCanvas.addCommand (exitCommand);
myCanvas.addCommand (toggleCommand);
myCanvas.setCommandListener (this);

Display.getDisplay (this).setCurrent (myCanvas);
}


public void pauseApp (){}
public void destroyApp (boolean b){}


public void commandAction (Command cc, Displayable d) {
System.out.println("Inside commandAction");
if (cc == exitCommand) {
System.out.println("Exitting");
notifyDestroyed();
}else{
fullscreen = (fullscreen==true ? false: true);
myCanvas.setFullScreenMode(fullscreen);
}
}


public class TestCanvas extends Canvas{

public void paint(Graphics g){
int myHeight= getHeight();
int myWidth= getWidth();
g.setColor(0xffffff);
g.fillRect(0,0,getWidth(),getHeight());

g.setColor(0xffAAAA);
g.fillRect(0,0,getWidth(),getHeight());
g.setColor(0x000000);


g.drawString("Fullscreen: " + fullscreen, 0,10 , Graphics.TOP | Graphics.LEFT) ;
g.drawString("Canvas Height: " + myHeight, 0,30 , Graphics.TOP | Graphics.LEFT) ;
g.drawString("Canvas Width: " + myWidth, 0,50 , Graphics.TOP | Graphics.LEFT) ;

}
}
}

Mehran_Asghari
شنبه 21 بهمن 1385, 00:27 صبح
با تشکر از رهنمایی بسیار خوب شما.
ممنونم

majidhabibi
دوشنبه 06 فروردین 1386, 00:54 صبح
واقعا خوب بود
ممنونم

lord_akinak
دوشنبه 07 خرداد 1386, 18:15 عصر
بد بختانه روی تمام گوشی ها کار نمی کنه
مثلا در K750 اولین باری که صفحه رندر می شه fullscreen نیست ولی بعدا که چندبار رندر شد full میشه
خوده sun هم گفته این متد تظمینی نیست یه همین خاطر توی j2me ورژن جدید 2.5 Beta این متد رو برداشتن!!