14.02.2012 / 00:12 | |
treut  Пользователь
Сейчас: Offline
Имя: Treut Откуда: World Wide Web Регистрация: 25.10.2011
| Night_Death, А import javax.microedition.lcdui.*; Разве не надо
|
14.02.2012 / 00:24 | |
treut  Пользователь
Сейчас: Offline
Имя: Treut Откуда: World Wide Web Регистрация: 25.10.2011
| И строк в стартАпп вида Class_canvas a = new Class_canvas();
....
Display di = Display.getDisplay(this);
di.setCurrent(a);
|
14.02.2012 / 10:19 | |
treut  Пользователь
Сейчас: Offline
Имя: Treut Откуда: World Wide Web Регистрация: 25.10.2011
| Здравствуйте! Помогите пожалуйста найти ошибки тут. Компиль пишет что ожидается оператор "(" в строке while(true) { первым символом. import javax.microedition.lcdui.*;
public class Canva extends Canvas implements Runnable {
int position = 10;
/**
* constructor
*/
public Canva() {
super();
}
public void start() {
Thread t = new Thread(this);
t.start();
}
public void run {
while(true) {
position ++;
repaint();
try {
Thread.sleep(20);
}
catch(java.lang.InterruptedException zxz) {
}
}
}
/**
* paint
*/
public void paint(Graphics g) {
int x = g.getClipWidth();
int y = g.getClipHeight();
g.setColor(0xffffff);
g.fillRect(0, 0, x, y);
g.setColor(0,0,200);
g.fillRect(position, 40, 20, 20);
}
}
|
14.02.2012 / 10:35 | |
Morti  Пользователь
Сейчас: Offline
Имя: Сергей Регистрация: 31.01.2012
| treut, run()
|
14.02.2012 / 10:49 | |
treut  Пользователь
Сейчас: Offline
Имя: Treut Откуда: World Wide Web Регистрация: 25.10.2011
| Morti, Thank you very much  |
14.02.2012 / 16:53 | |
Night_Death  Пользователь
Сейчас: Offline
Имя: Павел Откуда: Гомель Регистрация: 19.12.2010
| treut, в этом примере не используются классы из пакета javax.microedition.lcdui. Я дал лишь пример выхода из приложения, а пишите вы там что хотите и как хотите.
|
14.02.2012 / 16:58 | |
treut  Пользователь
Сейчас: Offline
Имя: Treut Откуда: World Wide Web Регистрация: 25.10.2011
| Скажите пожалуйста вот есть например для треда А потом Тут ^ ведь по 1 пикселю добавляется к позиции, а можно сделать что бы например по 5 рх добавлялось каждый раз к позиции? |
14.02.2012 / 17:00 | |
aNNiMON Супервизор
Сейчас: Offline
Имя: Витёк Регистрация: 11.01.2010
| treut, в чем проблема: position += 5
__________________
 let live |
14.02.2012 / 22:45 | |
treut  Пользователь
Сейчас: Offline
Имя: Treut Откуда: World Wide Web Регистрация: 25.10.2011
| Хочу сделать что бы при при открытии программы что нибудь показалось на 4 сек. И на экране появилось другое, но программа перескакивает через тред и сразу показывает экран который должен появиться через 4 сек. Пишу так: import javax.microedition.lcdui.*;
public class Canva extends Canvas implements Runnable {
int position = 0;
public Canva() {
super();
setFullScreeMode(true);
}
public void start() {
Thread t = new Thread(this);
t.start();
}
public void run {
while(true) {
position += 240;
repaint();
try {
Thread.sleep(4000);
}
catch(java.lang.InterruptedException zxz) {
}
}
}
public void paint(Graphics g) {
int x = g.getClipWidth();
int y = g.getClipHeight();
g.setColor(0,255,0);
g.fillRect(0, 0, x, y);
g.setColor(0,0,200);
g.fillRect(position, 0, w, h);
}
}
|
14.02.2012 / 23:22 | |
aNNiMON Супервизор
Сейчас: Offline
Имя: Витёк Регистрация: 11.01.2010
| treut, метод start() надо вызвать.
__________________
 let live |