Download presentation
Presentation is loading. Please wait.
Published byRebekah Cougill Modified over 10 years ago
1
J2ME Form Nesneleri Melih Sakarya
2
Form Nesnesi Form form= new Form("Giris"); display.setCurrent(form);
3
Form Nesneleri Canvas ChoiceGroup DateField Display Displayable Font Form Gauge Graphics Image ImageItem Item List Screen StringItem TextBox TextField Ticker
4
Form() public void setTitle(String title); public String getTitle( ); public void setTicker(Ticker ticker); public Ticker getTicker( );
5
TextField TextField textFieldName= new TextField(Title,Text,MaxLength, Constraints); ad.getString();ad.setString(String);
6
ChoiceGroup ChoiceGroup choices = new ChoiceGroup( “Label", Choice.EXCLUSIVE); choices.append("Bay",null);choices.append("Bayan",null);
7
DateField DateField date = new DateField(“Tarih", DateField.DATE);
8
Image Image image = Image.createImage("/Duke.png");
9
Form Nesneleri Form form= new Form("Giris"); TextField user= new TextField("Username:","",20,TextField.ANY); TextField pass= new TextField("Password:","",20,TextField.PASSWORD); ChoiceGroup cinsiyet=new ChoiceGroup("Cinsiyet", ChoiceGroup.EXCLUSIVE); cinsiyet.append("Bay",null);cinsiyet.append("Bayan",null); DateField tarih=new DateField("Dogum Tarihi",DateField.DATE); form.append(tarih);form.append(cinsiyet);form.append(user);form.append(pass);display.setCurrent(form);
10
List List list = new List(“Liste", Choice.EXCLUSIVE); list.append(“A", null); list.append(“Bl", null);
11
Formlar Arasi Gecisler Dispaly.getDisplay(this).setCurrent(formAdi);
12
Canvas public class DemoCanvas extends Canvas { public class DemoCanvas extends Canvas { Image image; Image image; public DemoCanvas (Image image){ public DemoCanvas (Image image){ this.image=image; this.image=image; } public void paint(Graphics g) { public void paint(Graphics g) { g.setColor(255, 255, 255); g.setColor(255, 255, 255); g.fillRect(0, 0, getWidth(), getHeight()); g.fillRect(0, 0, getWidth(), getHeight()); g.drawImage(image,10,10,Graphics.TOP|Graphics.LEFT); g.drawImage(image,10,10,Graphics.TOP|Graphics.LEFT); } }
13
Canvas public class MyCanvas extends Canvas { public void paint(Graphics g) { g.setColor(255, 0, 0); g.fillRect(0, 0, getWidth(), getHeight( )); g.setColor(255, 255, 255); g.drawString("Hello World!", 0, 0, g.TOP | g.LEFT); }
14
Konumlama
15
Cizim Metodlari drawImagedrawStringdrawRectdrawRoundRectdrawLinedrawArcfillRectfillRoundRectfillArc
16
Renk Formatlari setColor (255, 0, 0)Kırmızı setColor (0, 255, 0) Yeşil setColor (0, 0, 255) Mavi setColor (128, 0, 0) Koyu Kırmızı setColor (255, 255, 0) Sarı setColor (0, 0, 0) Siyah setColor (255, 255, 255) Beyaz setColor (128, 128, 128) Gri
17
Canvas import javax.microedition.midlet.*; import javax.microedition.midlet.*; import javax.microedition.lcdui.*; import javax.microedition.lcdui.*; public class CanvasTest extends MIDlet{ public class CanvasTest extends MIDlet{ public void startApp(){ public void startApp(){ TestCanvas canvas=new TestCanvas(); TestCanvas canvas=new TestCanvas(); Display.getDisplay(this).setCurrent(canvas); Display.getDisplay(this).setCurrent(canvas); } public void pauseApp(){} public void pauseApp(){} public void destroyApp(boolean unconditional){} public void destroyApp(boolean unconditional){} public class TestCanvas extends Canvas{ public class TestCanvas extends Canvas{ public void paint(Graphics g){ public void paint(Graphics g){ g.setColor(255,255,255); g.setColor(255,255,255); g.fillRect(0,0,getWidth(),getHeight()); g.fillRect(0,0,getWidth(),getHeight()); g.setColor(0,0,0); g.setColor(0,0,0); g.drawRect(10,10,50,50); g.drawRect(10,10,50,50); } } }
18
import java.io.*; import javax.microedition.midlet.*; import javax.microedition.lcdui.*; class ImageDemoCanvas extends Canvas { Image image; Image image; public ImageDemoCanvas () { public ImageDemoCanvas () { try { try { image = Image.createImage ("/logo.png"); image = Image.createImage ("/logo.png"); } catch (IOException e) { catch (IOException e) { throw new RuntimeException ("Unable to load Image: "+e); throw new RuntimeException ("Unable to load Image: "+e); } } public void paint (Graphics g) { public void paint (Graphics g) { g.setGrayScale (255); g.setGrayScale (255); g.fillRect (0, 0, getWidth (), getHeight ()); g.fillRect (0, 0, getWidth (), getHeight ()); g.drawImage (image, 0, 0, Graphics.TOP | Graphics.LEFT); g.drawImage (image, 0, 0, Graphics.TOP | Graphics.LEFT); g.drawImage (image, getWidth () / 2, getHeight () / 2, g.drawImage (image, getWidth () / 2, getHeight () / 2, Graphics.HCENTER | Graphics.VCENTER); Graphics.HCENTER | Graphics.VCENTER); g.drawImage (image, getWidth (), getHeight (), g.drawImage (image, getWidth (), getHeight (), Graphics.BOTTOM | Graphics.RIGHT); Graphics.BOTTOM | Graphics.RIGHT); }}
20
import javax.microedition.lcdui.*; public class FontCanvas extends Canvas { public void paint(Graphics g) { g.setColor(0xffffff); g.fillRect(0, 0, getWidth(), getHeight( )); g.setColor(0x000000); g.setFont(Font.getFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_LARGE)); g.drawString("System Font", 0, 0, g.LEFT | g.TOP); g.setFont(Font.getFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_MEDIUM)); g.drawString("Medium Size", 0, 15, g.LEFT | g.TOP); g.setFont(Font.getFont(Font.FACE_SYSTEM, Font.STYLE_BOLD, Font.SIZE_MEDIUM)); g.drawString("Bold Style", 0, 30, g.LEFT | g.TOP); g.setFont(Font.getFont(Font.FACE_SYSTEM, Font.STYLE_ITALIC, Font.SIZE_MEDIUM)); g.drawString("Italic Style", 0, 45, g.LEFT | g.TOP); g.setFont(Font.getFont(Font.FACE_SYSTEM, Font.STYLE_UNDERLINED, Font.SIZE_MEDIUM)); g.drawString("Underlined Style", 0, 60, g.LEFT | g.TOP); }}
21
Extend Edilen Canvasi Kullanmak import javax.microedition.midlet.*; import javax.microedition.lcdui.*; public class FontMidlet extends MIDlet { public FontMidlet( ) { // constructor } public void startApp( ) { Canvas canvas = new FontCanvas( ); Display display = Display.getDisplay(this); display.setCurrent(canvas);} public void pauseApp( ) { } public void destroyApp(boolean unconditional) { }
22
SORULAR ???
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.