Archive for May, 2009

Full Screen Sample

Wednesday, 05 May 2009

package p3131p;import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Graphics;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;public class P3130M extends MIDlet {
public P3130M() { }
protected void destroyApp(boolean arg0) throws MIDletStateChangeException {}
protected void pauseApp() {}
protected void startApp() throws MIDletStateChangeException {
Canvas canvas=new MyScreen();
Display display=Display.getDisplay(this);
display.setCurrent(canvas);
canvas.setFullScreenMode(true); // FullScreen
}
class MyScreen extends Canvas{
public void paint(Graphics g){
g.setColor(100,200,100);
g.fillRect(0,0,getWidth(), getHeight());
} } }


MIDP Key Codes And gameAction()

Monday, 05 May 2009

DOWN, FIRE, GAME_A, GAME_B, GAME_C, GAME_D, KEY_NUM0, KEY_NUM1, KEY_NUM2, KEY_NUM3, KEY_NUM4, KEY_NUM5, KEY_NUM6, KEY_NUM7, KEY_NUM8, KEY_NUM9, KEY_POUND, KEY_STAR, LEFT, RIGHT, UP.
——
And a sample gameAction() code:

package p3129pa;
import java.util.Random;import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Graphics;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;public class P3129 extends MIDlet implements CommandListener{private Command exitCommand;
Display display;
Displayable d;
public P3129() { }
protected void destroyApp(boolean arg0) throws MIDletStateChangeException {}
protected void pauseApp() {}
protected void startApp() throws MIDletStateChangeException {
Display display=Display.getDisplay(this);d=new GameActionCanvas();
exitCommand=new Command("Q",Command.EXIT,1);
d.addCommand(exitCommand);
d.setCommandListener(this);
display.setCurrent(d);
}
public void commandAction(Command c, Displayable s){notifyDestroyed();}
class GameActionCanvas extends Canvas{
int width=0;
int height=0;
int left=0;
int right=0;
int i=1;
int y=1;
int renk=112233;
String str="JAPON BALII";
public void paint(Graphics g){
width=getWidth();
height=getHeight();
left=g.getClipX();
right=g.getClipY();
g.setColor(renk);
g.fillRect(0,0, width-1, height-1);
g.setGrayScale(0);
g.drawRect(0, 0, width-1, height-1);
g.drawString(str+" ("+String.valueOf(i)+","+String.valueOf(y)+")",50+i,50+ y, Graphics.TOP | Graphics.LEFT);
}
Random random=new Random();
protected void keyPressed(int keyCode){
int gameAction=getGameAction(keyCode); //Game Action
switch(gameAction){
case UP:str="Up";y--;break;
case DOWN:str="Down";y++;break;
case LEFT:str="Left";i--;break;
case RIGHT:str="Right";i++;break;
case FIRE:str="Renk";renk=Math.abs(random.nextInt()%999999);break;
case GAME_A:str="1. Bomb";;break;
case GAME_B:str="2. Bomb";break;
case GAME_C:str="3. Bomb";break;
case GAME_D:str="4. Bomb";break;
default:str="japon balıı"; break;
}
repaint();
}
protected void keyRepeated(int keyCode){
int gameAction2=getGameAction(keyCode);switch(gameAction2){
case UP:str="Up";y--;break;
case DOWN:str="Down";y++;break;
case LEFT:str="Left";i--;break;
case RIGHT:str="Right";i++;break;
case FIRE:str="Renk";renk=Math.abs(random.nextInt(999999));break;
}
repaint();
} } }

You can downlad jad file: P3129.jad


Random Integer in J2ME

Saturday, 05 May 2009

import java.util.Random;
:
Random random=new Random();
int rand=Math.abs(random.nextInt()% Big Number);
:

Big Number is the upper limit of the random value. Sample:

import java.util.Random;
:
Random random=new Random();
int renk=Math.abs(random.nextInt()%9999);
:


Windows Vista Tools and Paths

Thursday, 05 May 2009

About Windows C:\Windows\system32\winver.exe
System Information C:\Windows\System32\msinfo32.exe
Remote Assistance C:\Windows\System32\msra.exe
System Restore C:\Windows\System32\rstrui.exe
Computer Management C:\Windows\System32\compmgmt.msc
Event Viewer C:\Windows\System32\eventvwr.exe
Programs C:\Windows\System32\appwiz.cpl
Security Center C:\Windows\System32\wscui.cpl
System Properties C:\Windows\System32\control.exe system
Internet Options C:\Windows\System32\inetcpl.cpl
Internet Protocol Configuration C:\Windows\System32\cmd.exe /k %windir%\system32\ipconfig.exe
Performance Monitor C:\Windows\System32\perfmon.exe
Task Manager C:\Windows\System32\taskmgr.exe
Disable UAC C:\Windows\System32\cmd.exe /k %windir%\System32\reg.exe ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA /t REG_DWORD /d 0 /f
Enable UAC C:\Windows\System32\cmd.exe /k %windir%\System32\reg.exe ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA /t REG_DWORD /d 1 /f
Command Prompt C:\Windows\System32\cmd.exe
Registry Editor C:\Windows\System32\regedt32.exe


J2ME Software Developing

Wednesday, 05 May 2009

Download these files:

  1. J2SE SDK ( jdk-6u13-windows-….exe ) : http://java.sun.com/javase/downloads/index.jsp
  2. Eclipse ( eclipse-SDK-….zip ) : http://www.eclipse.org/downloads/index.php
  3. J2ME Wireless Toolkit for CLDC ( sun_java_wireless_toolkit-….-win.exe ) : http://java.sun.com/products/sjwtoolkit/
  4. Eclipse J2ME Plugin ( eclipseme.feature_…._site.zip ) : http://eclipseme.org/

Installation steps:

  • J2SE SDK, run and follow the instructions.
  • Eclipse, just extract the eclipse-SDK….zip file.
  • J2ME Wireless Toolkit, run and follow the instructions.
  • Eclipse J2ME Plug-In for installation, run Eclipse. From the “Eclipse Help” menu, select “Software Updates…”. Press the “Add Site…” button. You will see the “Add Site” dialog. Select the “ZIP” file and press “Open” button. And then press “OK” button. And press the “Install” button. And follow the instructions.

From the Eclipse “Window” menu, select “Preferences”. And then select J2ME. Find the “WTK Root:” press the “Browse”.
Find the “Wireless Toolkit” directory. Such as “C:\WTK2.5.2_01″. Apply.


Ben mi gideyim?

Monday, 05 May 2009

Askerden döndüm. Dünyada önemli bir değişiklik göremedim. Herşey aynı. Askerlik insanı değiştirir derler. Değişime uğrayacak kadar uzun süre kalmadım. Harp sanatını öğrendim. Hedefi 12′den vurmak için illa ki özel bir yetenek gerekmiyormuş. Tüfeğe hakimiyet esaslarını öğrenip uygulamak yeterli.  Güzel günlerdi yaşadıklarım. Artık benim de “Hiç unutmam bi gün…” diye başlayan bir çok hikayem var. :)

Nöbetten düşenler nöbete gidenleri gördükleri zaman “Ben mi gideyim bu şafaktan sonra?” der, dalga geçerler. Bizimle geçtiler. Tabi ki biz de geçtik. Bizden sonrakiler de geçecek. Asıl askerlik şimdi başlıyor.

Askerlik bitti hayata devam… ;)


  • "I am a dreamer. Seriously, I'm living on another planet."
  • Lütfü Hoca

  • Categories

  • Archives