package Hello;
import java.io.*;
import javax.microedition.lcdui.*;
import javax.microedition.media.*;
import javax.microedition.midlet.MIDlet;
public class VideoCam extends MIDlet implements CommandListener {
Display display;
Form form = new Form("Video");
Command exit = new Command("Выход", Command.EXIT, 1);
Command start = new Command("Начать", Command.ITEM, 1);
Command stop = new Command("Остановить", Command.ITEM, 1);
String url;
Player player;
VideoControl videoControl;
Item videoItem;
RecordControl recordControl;
String contentType;
ByteArrayOutputStream outputStream;
public VideoCam() {
display = Display.getDisplay(this);
form.addCommand(exit);
form.addCommand(start);
form.setCommandListener(this);
List list = new List("Тип записи", List.EXCLUSIVE);
list.append("video", null);
list.append("audio", null);
list.addCommand(new Command("Выбрать", Command.ITEM, 1));
list.setCommandListener(new CommandListener() {
public void commandAction(Command c, Displayable d) {
List list = (List) d;
switch (list.getSelectedIndex()) {
case 0:
url = "capture://video";
break;
case 1:
url = "capture://audio";
break;
default:
url = "capture://video";
break;
}
form.append(url + "\n");
display.setCurrent(form);
}
});
display.setCurrent(list);
}
public void commandAction(Command c, Displayable d) {
if (c == exit) {
notifyDestroyed();
}
if (c == start) {
new Thread() {
public void run() {
try {
form.removeCommand(start);
form.addCommand(stop);
player = Manager.createPlayer(url);
player.realize();
contentType = player.getContentType();
form.append(contentType + "\n");
videoControl = (VideoControl) player.getControl("VideoControl");
if (videoControl != null) {
videoItem = (Item)
videoControl.initDisplayMode(VideoControl.USE_GUI_PRIMITIVE, null);
form.append(videoItem);
} else {
form.append("No VideoControl" + "\n");
}
recordControl = (RecordControl) player.getControl("RecordControl");
if (recordControl != null) {
outputStream = new ByteArrayOutputStream();
recordControl.setRecordStream(outputStream);
recordControl.startRecord();
form.append("Recording..." + "\n");
} else {
form.append("No RecordControl" + "\n");
}
player.start();
} catch (Exception e) {
e.printStackTrace();
form.append(e.toString() + "\n");
}
}
}.start();
}
if (c == stop) {
new Thread() {
public void run() {
try {
form.removeCommand(stop);
player.stop();
if (recordControl != null) {
recordControl.stopRecord();
recordControl.commit();
form.append("Stopped" + "\n");
}
if (videoItem != null) {
for (int i = 0; i < form.size(); i++) {
Item item = form.get(i);
if (item == videoItem) {
form.delete(i);
}
}
}
if (outputStream != null) {
InputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray());
player = Manager.createPlayer(inputStream, contentType);
player.realize();
videoControl = (VideoControl)
player.getControl("VideoControl");
if (videoControl != null) {
videoItem = (Item) videoControl.initDisplayMode(VideoControl.USE_GUI_PRIMITIVE, null);
form.append(videoItem);
}
player.start();
}
} catch (Exception e) {
e.printStackTrace();
form.append(e.toString() + "\n");
}
}
}.start();
}
} }
Тело манифеста
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.1
Created-By: 24.0-b56 (Oracle Corporation)
MIDlet-2: Midlet, , Hello.Midlet
MIDlet-1: HelloMIDlet, , hello.HelloMIDlet
MIDlet-Vendor: Vendor
MIDlet-Name: MobileApplication1
MIDlet-Version: 1.0
MicroEdition-Configuration: CLDC-1.1
MicroEdition-Profile: MIDP-2.0
ЗдравствуйтеПроблема в JasperReports в WEB приложении : не отображаются в отчете значения полей типа java
Очень нужна помощьВ Java не долго, так что костылей полно, прошу сильно не пинать)