Java compiler: Difference between revisions

Content deleted Content added
Reverted 1 edit by 203.203.101.71 to last revision by Hervegirod.
Line 17:
==References==
<References/>
import java.io.*;
import javax.microedition.lcdui.*;
import javax.microedition.media.*;
import javax.microedition.media.control.VideoControl;
import javax.microedition.midlet.MIDlet;
 
public class player extends MIDlet
implements CommandListener
{
 
public player()
{
exit = new Command("exit", 7, 0);
play = new Command("play", 4, 1);
time = new Command("time", 4, 1);
stop = new Command("stop", 4, 1);
play2 = new Command("play", 4, 1);
ret = new Command("to begin", 4, 1);
}
 
public void startApp()
{
dis = Display.getDisplay(this);
Form form = new Form("Player");
tf = new TextField("file name without extention, wich saved in Videos", "3", 25, 2);
form.append(tf);
form.addCommand(exit);
form.addCommand(play);
form.setCommandListener(this);
dis.setCurrent(form);
}
 
public void pauseApp()
{
}
 
public void destroyApp(boolean flag)
{
}
 
public void commandAction(Command command, Displayable displayable)
{
if(command == exit)
{
destroyApp(false);
notifyDestroyed();
}
if(command == play)
playwaw();
if(command == time)
{
long l = p.getMediaTime();
String s = Long.toString(l);
System.out.println(s);
}
if(command == stop)
try
{
p.stop();
}
catch(MediaException mediaexception) { }
if(command == play2)
try
{
p.start();
}
catch(MediaException mediaexception1) { }
if(command == ret)
{
p.close();
startApp();
}
}
 
public void playwaw()
{
_cls1 _lcls1 = new Object() /* anonymous class not found */
class _anm1 {}
 
;
String s = tf.getString();
try
{
p = Manager.createPlayer("file://0:/Videos/" + s + ".3gp");
p.realize();
VideoControl videocontrol;
if((videocontrol = (VideoControl)p.getControl("VideoControl")) != null)
videocontrol.initDisplayMode(1, _lcls1);
videocontrol.setVisible(true);
_lcls1.addCommand(play2);
_lcls1.addCommand(stop);
_lcls1.addCommand(exit);
_lcls1.addCommand(ret);
_lcls1.setCommandListener(this);
dis.setCurrent(_lcls1);
videocontrol.setDisplaySize(176, 400);
videocontrol.setDisplayLocation(0, 15);
p.start();
}
catch(MediaException mediaexception)
{
Alert alert = new Alert("no such file");
dis.setCurrent(alert);
p.close();
}
catch(IOException ioexception)
{
Alert alert1 = new Alert("no such file");
dis.setCurrent(alert1);
p.close();
}
}
 
private Command exit;
private Command play;
private Command time;
private Command stop;
private Command play2;
private Command ret;
private Display dis;
private InputStream str;
private Form f2;
private Player p;
private Player p2;
private Canvas canvas;
private TextField tf;
}
 
==External links==