SucessDialog.java
资源名称:J2ME.rar [点击查看]
上传用户:sygbg6
上传日期:2020-12-29
资源大小:4884k
文件大小:2k
源码类别:
游戏
开发平台:
Java
- package cn.com.imageanalyze.customform.dialog;
- import java.io.IOException;
- import java.io.InputStream;
- import javax.microedition.lcdui.Command;
- import javax.microedition.lcdui.CommandListener;
- import javax.microedition.lcdui.Displayable;
- import javax.microedition.lcdui.Image;
- import javax.microedition.lcdui.ImageItem;
- import javax.microedition.media.Manager;
- import javax.microedition.media.MediaException;
- import javax.microedition.media.Player;
- import javax.microedition.midlet.MIDlet;
- import cn.com.imageanalyze.customform.Parent;
- /**
- * 成功dialog
- * @author Administrator
- *
- */
- public class SucessDialog extends Dialog{
- public SucessDialog(String arg0, Parent Parent) {
- super(arg0, Parent);
- // TODO Auto-generated constructor stub
- }
- Command c1 = new Command("确定", Command.OK, 1);
- static Player player = null;
- private String Content;
- public void setContent(String content) {
- Content = content;
- }
- public void paintSelf() {
- // TODO Auto-generated method stub
- // TODO Auto-generated method stub
- Image img;
- try {
- img = Image.createImage("/photo.jpg");
- // int[] ttt = cn.com.imageanalyze.util.SimpleImageTrans.trans(img, 320, 240);
- // Image nimg = Image.createRGBImage(ttt, 320, 240, false);
- ImageItem ii = new ImageItem("",img,ImageItem.LAYOUT_CENTER,"");
- this.append(ii);
- } catch (IOException e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- }
- InputStream is = this.getClass().getResourceAsStream("/sound.wav");// wave_test_dec.wav
- try {
- player = Manager.createPlayer(is, "audio/x-wav");
- player.realize();
- player.start();
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (MediaException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- super.paintSelf();
- }
- public void clickConfirm() {
- // TODO Auto-generated method stub
- if(player != null)
- try {
- player.stop();
- player.close();
- } catch (MediaException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- }