Friday, December 7, 2012

Memperoleh properti sistem yang berkaitan dengan multimedia pada JAVA (J2ME)

import javax.microedition.midlet.*;import javax.microedition.lcdui.*;

public class SistemMedia extends MIDlet
  implements CommandListener {
   
  private Display display;
  private Form form;
  private StringBuffer sb;

  private final Command cmdKeluar =
    new Command("Keluar", Command.EXIT, 1);
 
  public SistemMedia() {
    display = Display.getDisplay(this);
   
    form = new Form("Properti Sistem Media");
       
    form.addCommand(cmdKeluar);
    form.setCommandListener(this);   
  }
   
  public void startApp() {
    sb = getMediaProperties();
    StringItem si = new StringItem(null, sb.toString());
    form.append(si);
    display.setCurrent(form);
  }
   
  public void pauseApp() {
  }
   
  public void destroyApp(boolean unconditional) {
  }
   
  public void commandAction(Command c, Displayable s) {
    if (c == cmdKeluar) {
      destroyApp(false);
      notifyDestroyed();
    }   
  }
 
  private StringBuffer getMediaProperties() {
    StringBuffer temp = new StringBuffer();
    temp.append("Mixing: " +
        System.getProperty("supports.mixing"));
    temp.append("\nAudio Capture: " +
        System.getProperty("supports.audio.capture"));
    temp.append("\nVideo Capture: " +
        System.getProperty("supports.video.capture"));
    temp.append("\nRecording: " +
        System.getProperty("supports.recording"));
    temp.append("\nAudio Encoding: " +
        System.getProperty("audio.encodings"));
    temp.append("\nVideo Encoding: " +
        System.getProperty("video.encodings"));
    temp.append("\nSnapshot: " +
        System.getProperty("video.snapshot.encodings"));
    temp.append("\nMedia Version: " +
        System.getProperty("microedition.media.version"));
    temp.append("\nStreamable content: " +
        System.getProperty("streamable.contents"));
    return temp;
  }
}

No comments:

Post a Comment