jalalx
پنج شنبه 30 اردیبهشت 1389, 08:53 صبح
سلام به جامعه ی جاوا کارهای فارسی زبان(!)
من می خوام یه دکمه درست کنم برای یه نرم افزار، باید بتونه فکوس رو قبول کنه، من یه C# کارم اما تو Java تازه کارم. کسی میتونه یه کمکی کنه؟ ممنون می شم!:چشمک:
کدی که تا آلان نوشتم اینه اما متن روشو نشون نمی ده...
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
/*
* Button.java
*
* Created on May 20, 2010, 7:44 AM
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
/**
*
* @author Jalal
*/
public class Button extends CustomItem{
private int x, y, width, height;
private String text;
public Button(String title) {
this(title, 0, 0, 20, 20);
}
public Button(String title, int x, int y, int width, int height) {
super("");
setX(x);
setY(y);
setWidth(width);
setHeight(height);
}
// CustomItem abstract methods.
public int getMinContentWidth() { return width; }
public int getMinContentHeight() { return height; }
public int getPrefContentWidth(int width) {
return getMinContentWidth();
}
public int getPrefContentHeight(int height) {
return getMinContentHeight();
}
public void paint(Graphics g, int w, int h) {
g.drawRect(x, y, width, height);
g.drawString(text, x, y, 0);
}
public String getText(){
return text;
}
public void setText(String text){
this.text = text;
}
public int getX() {
return x;
}
public void setX(int x) {
this.x = x;
}
public int getY() {
return y;
}
public void setY(int y) {
this.y = y;
}
public int getWidth() {
return width;
}
public void setWidth(int width) {
this.width = width;
}
public int getHeight() {
return height;
}
public void setHeight(int height) {
this.height = height;
}
}
من می خوام یه دکمه درست کنم برای یه نرم افزار، باید بتونه فکوس رو قبول کنه، من یه C# کارم اما تو Java تازه کارم. کسی میتونه یه کمکی کنه؟ ممنون می شم!:چشمک:
کدی که تا آلان نوشتم اینه اما متن روشو نشون نمی ده...
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
/*
* Button.java
*
* Created on May 20, 2010, 7:44 AM
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
/**
*
* @author Jalal
*/
public class Button extends CustomItem{
private int x, y, width, height;
private String text;
public Button(String title) {
this(title, 0, 0, 20, 20);
}
public Button(String title, int x, int y, int width, int height) {
super("");
setX(x);
setY(y);
setWidth(width);
setHeight(height);
}
// CustomItem abstract methods.
public int getMinContentWidth() { return width; }
public int getMinContentHeight() { return height; }
public int getPrefContentWidth(int width) {
return getMinContentWidth();
}
public int getPrefContentHeight(int height) {
return getMinContentHeight();
}
public void paint(Graphics g, int w, int h) {
g.drawRect(x, y, width, height);
g.drawString(text, x, y, 0);
}
public String getText(){
return text;
}
public void setText(String text){
this.text = text;
}
public int getX() {
return x;
}
public void setX(int x) {
this.x = x;
}
public int getY() {
return y;
}
public void setY(int y) {
this.y = y;
}
public int getWidth() {
return width;
}
public void setWidth(int width) {
this.width = width;
}
public int getHeight() {
return height;
}
public void setHeight(int height) {
this.height = height;
}
}