ºÝºÝߣ

ºÝºÝߣShare a Scribd company logo
Parallelogram by using J2ME
Author
Shahid Masih
MSCIT-F16-44
Shahidmasih08@gmail.com
1. INTRODUCTION
This is our first assignment cores name mobile computing. This
assignment is base on coding in J2ME. J2ME is micro edition of
java which is use for development for smart device. In this , we
write a program make a parallelogram& fill it with particular
colors..
For development this program we use Sun Wireless Toolkit and
JDKfor solving the given problem. With using general
programming concepts of the Java language.
2. J2ME
2.1 What is J2ME?
J2ME stands for Java 2, Micro Edition. This is provide a platform
for developing app or program small & smart deviceswhich have
limited processing power and storage capabilities and intermittent
or fairly low-bandwidth network connections. These include
mobile phones, pagers,wireless devices and set-top boxes among
others.
A Sample Wireless Stack would consist of:
ï‚· Profiles
ï‚· Configurations
ï‚· Java Virtual Machines
ï‚· Host Operating System
2.2 J2ME Profiles
A specification layer above the configuration which describes the
Java configuration for a specific vertical market or device type.
J2ME Profiles
 J2ME Mobile Information Device Profile (MIDP)
 it is platform of J2ME provide basic framework.
 this is the application environment for wireless devices
based on the CLDC
 contains classes for user interface, storage and
networking
 these are profiles for devices based on the CDC, which
are not addressed in this tutorial
 Virtual Machines
The Connected Limited Device Configuration(CLDC) and the
Connected Device Configuration(CDC) each require their own
virtual machine because of their different memory and display
capabilities. The CLDC virtual machine is far smaller than that
required by the CDC and supports less features. The virtual
machine for the CLDC is called the Kilo Virtual Machine (KVM)
and the virtual machine for the CDC is called the CVM.
3. FIGURES/CAPTIONS
3.1
First of all start writing the program code in notepad or in other
writing tool save it anywhere in your computer & save with java
exe.
Figure 1.1
3.2
Open wireless toolkit which you already installed in your
computer.
Figure 1.2
3.1
Create new project and write the project name & class name.
Figure 1.3
3.4
Save your code file in your project location.
Figure 1.4
3.5
Build your code and press run button.
Figure 1.5
4. CODE and out
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class tryangle extends MIDlet {
private Display display;
protected void startApp() {
Display.getDisplay (this).setCurrent (new DemoCanvas ());
}
protected void pauseApp() {
}
protected void destroyApp(boolean unconditional) {
}
}
class DemoCanvas extends Canvas {
public void paint(Graphics g) {
g.setColor(0, 0, 255);
g.fillRect(0,0, getWidth (), getHeight ());
g.setColor(0, 255, 0);
g.fillTriangle(50, 100, 90 , 180 , 160 ,100);
g.fillTriangle(160,100 ,200 ,180 ,90 ,180 );
}
}
Figure 3.6
5. ACKNOWLEDGMENTS
Special thank you Professor Qaisar Farooq Gujjar, for such a
creative work of this assignment.
6. REFERENCES
[1] https://www.roseindia.net/j2me/canvas-draw.shtml
[2] https://www.roseindia.net/j2me/draw-traingle.shtml
[3] https://www.google.com.pk/search?dcr=0&source=hp&q=j2
me+triangles&oq=J2&gs_l=psy-
ab.1.1.35i39k1l2j0l8.34822.36167.0.38683.5.3.0.0.0.0.444.8
37.3-1j1.2.0....0...1.1.64.psy-
ab..3.2.835.0..0i131k1.0.QdSKnTYLXyk
[4] http://www.oracle.com/technetwork/java/javasebusiness/dow
nloads/java-archive-downloads-javame-
419430.html#sun_java_wireless_toolkit-2.5.2_01b-oth-JPR
[5] http://www.oracle.com/technetwork/java/javasebusiness/dow
nloads/java-archive-downloads-javase5-419410.html
[6] https://www.google.com.pk/search?source=hp&q=jdk+for+
windows+8.1+32+bit+filehippo&oq=jdk&gs_l=psy-
ab.3.0.35i39k1j0i131k1j0l4j0i10i1k1j0l3.1566.3749.0.6408.
4.3.0.0.0.0.371.1079.3-3.3.0....0...1.1.64.psy-
ab..1.3.1075.0...0.YoFSE9Elbik.
[7] https://www.thesisscientist.com/docs/LavanaThomson/3ec1b
d4c-020a-4976-9533-f88e4cd384c8.pdf
[8] Yu, Y. T. and Lau, M. F. 2006. A comparison of MC/DC,
MUMCUTand several other coverage criteria for logical
decisions. J. Syst. Softw. 79, 5 (May. 2006), 577-590. DOI=
http://dx.doi.org/10.1016/j.jss.2005.05.030.
[9] Spector, A. Z. 1989. Achieving application requirements. In
Distributed Systems, S. Mullender, Ed. ACM Press Frontier
Series. ACM, New York, NY, 19-33. DOI=
http://doi.acm.org/10.1145/90417.90738.
Columns on Last Page Should Be Made As Close As
Possible to Equal Length

More Related Content

Parallelogram by using j2 me j2me.shahid

  • 1. Parallelogram by using J2ME Author Shahid Masih MSCIT-F16-44 Shahidmasih08@gmail.com 1. INTRODUCTION This is our first assignment cores name mobile computing. This assignment is base on coding in J2ME. J2ME is micro edition of java which is use for development for smart device. In this , we write a program make a parallelogram& fill it with particular colors.. For development this program we use Sun Wireless Toolkit and JDKfor solving the given problem. With using general programming concepts of the Java language. 2. J2ME 2.1 What is J2ME? J2ME stands for Java 2, Micro Edition. This is provide a platform for developing app or program small & smart deviceswhich have limited processing power and storage capabilities and intermittent or fairly low-bandwidth network connections. These include mobile phones, pagers,wireless devices and set-top boxes among others. A Sample Wireless Stack would consist of: ï‚· Profiles ï‚· Configurations ï‚· Java Virtual Machines ï‚· Host Operating System 2.2 J2ME Profiles A specification layer above the configuration which describes the Java configuration for a specific vertical market or device type. J2ME Profiles  J2ME Mobile Information Device Profile (MIDP)  it is platform of J2ME provide basic framework.  this is the application environment for wireless devices based on the CLDC  contains classes for user interface, storage and networking  these are profiles for devices based on the CDC, which are not addressed in this tutorial  Virtual Machines The Connected Limited Device Configuration(CLDC) and the Connected Device Configuration(CDC) each require their own virtual machine because of their different memory and display capabilities. The CLDC virtual machine is far smaller than that required by the CDC and supports less features. The virtual machine for the CLDC is called the Kilo Virtual Machine (KVM) and the virtual machine for the CDC is called the CVM. 3. FIGURES/CAPTIONS 3.1 First of all start writing the program code in notepad or in other writing tool save it anywhere in your computer & save with java exe. Figure 1.1 3.2 Open wireless toolkit which you already installed in your computer. Figure 1.2 3.1
  • 2. Create new project and write the project name & class name. Figure 1.3 3.4 Save your code file in your project location. Figure 1.4 3.5 Build your code and press run button. Figure 1.5 4. CODE and out import javax.microedition.midlet.*; import javax.microedition.lcdui.*; public class tryangle extends MIDlet { private Display display; protected void startApp() { Display.getDisplay (this).setCurrent (new DemoCanvas ()); } protected void pauseApp() { } protected void destroyApp(boolean unconditional) { } } class DemoCanvas extends Canvas { public void paint(Graphics g) { g.setColor(0, 0, 255); g.fillRect(0,0, getWidth (), getHeight ()); g.setColor(0, 255, 0); g.fillTriangle(50, 100, 90 , 180 , 160 ,100); g.fillTriangle(160,100 ,200 ,180 ,90 ,180 ); } } Figure 3.6 5. ACKNOWLEDGMENTS Special thank you Professor Qaisar Farooq Gujjar, for such a creative work of this assignment. 6. REFERENCES [1] https://www.roseindia.net/j2me/canvas-draw.shtml [2] https://www.roseindia.net/j2me/draw-traingle.shtml [3] https://www.google.com.pk/search?dcr=0&source=hp&q=j2 me+triangles&oq=J2&gs_l=psy- ab.1.1.35i39k1l2j0l8.34822.36167.0.38683.5.3.0.0.0.0.444.8 37.3-1j1.2.0....0...1.1.64.psy- ab..3.2.835.0..0i131k1.0.QdSKnTYLXyk [4] http://www.oracle.com/technetwork/java/javasebusiness/dow nloads/java-archive-downloads-javame- 419430.html#sun_java_wireless_toolkit-2.5.2_01b-oth-JPR [5] http://www.oracle.com/technetwork/java/javasebusiness/dow nloads/java-archive-downloads-javase5-419410.html [6] https://www.google.com.pk/search?source=hp&q=jdk+for+ windows+8.1+32+bit+filehippo&oq=jdk&gs_l=psy- ab.3.0.35i39k1j0i131k1j0l4j0i10i1k1j0l3.1566.3749.0.6408. 4.3.0.0.0.0.371.1079.3-3.3.0....0...1.1.64.psy- ab..1.3.1075.0...0.YoFSE9Elbik.
  • 3. [7] https://www.thesisscientist.com/docs/LavanaThomson/3ec1b d4c-020a-4976-9533-f88e4cd384c8.pdf [8] Yu, Y. T. and Lau, M. F. 2006. A comparison of MC/DC, MUMCUTand several other coverage criteria for logical decisions. J. Syst. Softw. 79, 5 (May. 2006), 577-590. DOI= http://dx.doi.org/10.1016/j.jss.2005.05.030. [9] Spector, A. Z. 1989. Achieving application requirements. In Distributed Systems, S. Mullender, Ed. ACM Press Frontier Series. ACM, New York, NY, 19-33. DOI= http://doi.acm.org/10.1145/90417.90738. Columns on Last Page Should Be Made As Close As Possible to Equal Length