一个简单的XML for J2ME

作者:wuhua
空间:htt://wuhua.3geye.net
转载请保留上面的信息(请尊重知识产品)谢谢

 

相信大家都用过Kxml的东西了,不过个人感觉kxml还是大了些。现在介绍一个比kxml跟简介的xml的类。对于一些小项目,或者对xml解释要求不是很高的项目来说却是个不错的选择。

下面看看那代码与Demo吧。

Java代码 复制代码
  1. package org.gggeye.easymf.xml;  
  2.   
  3. import java.util.Enumeration;  
  4. import java.util.Vector;  
  5.   
  6. /** 
  7.  *  
  8.  * @author wuhua 
  9.  * <a href="http://wuhua.3geye.net">我的博客</a> 
  10.  * 
  11.  */  
  12.    
  13. public class XMLParser {  
  14.     private XMLNode root=null;  
  15.     private XMLNode exeNode=null;  
  16.     private int offset=0;  
  17.     private String xml="";  
  18.     private int xmlLength=0;  
  19.     private String version="1.1";  
  20.     private String encoding="UTF-8";  
  21.     public XMLParser(String xml){  
  22.         this.xml=xml;  
  23.         this.xmlLength=xml.length();  
  24.     }  
  25.     public char getNextCharacter(){  
  26.         char rt= xml.charAt(offset);  
  27.         offset++;  
  28.         return rt;  
  29.           
  30.     }  
  31.     /** *//** 
  32.      * 判断下一字符是否为指定字符token 
  33.      * @param token 
  34.      * @return 
  35.      */  
  36.     private boolean match(char token){  
  37.         for(int i=offset;i<this.xmlLength;i++){  
  38.             char tc=xml.charAt(i);  
  39.             if (tc!=' '){  
  40.                 if (tc==token){  
  41.                    return true;  
  42.                 }else{  
  43.                    return false;  
  44.                 }  
  45.             }  
  46.         }  
  47.         return false;  
  48.     }  
  49.       
  50.     private String getDescription(){  
  51.         skipSpace();  
  52.         StringBuffer desc=new StringBuffer();  
  53.         while(offset<this.xmlLength-2){  
  54.             char tc1=this.getNextCharacter();  
  55.             if (tc1=='-'){  
  56.                 if ((xml.charAt(offset)=='-')&&(xml.charAt(offset+1)=='>')){  
  57.                     offset+=2;  
  58.                     return desc.toString();  
  59.                 }      
  60.             }else{  
  61.                 desc.append(tc1);  
  62.             }  
  63.         }  
  64.         return null;  
  65.           
  66.     }  
  67.     /** *//** 
  68.      * 获取Node名称 
  69.      * @return 
  70.      */  
  71.     private String getNodeName(){  
  72.         skipSpace();  
  73.         char[] name=new char[120];//   
  74.         int i=0;  
  75.         while(i<120){  
  76.             char tc=getNextCharacter();  
  77.             if ((tc==' ')||(tc=='>')||(tc=='/')){  
  78.                 if (i>0)  
  79.                     return new String(name).trim();  
  80.             }else {     
  81.                 name[i]=tc;  
  82.                 i++;  
  83.                 if (i>120){  
  84.                     System.err.println("NODE NAME长度只能小于120");  
  85.                     return null;  
  86.                 }  
  87.             }  
  88.         }  
  89.         return null;  
  90.     }  
  91.       
  92.     /** *//** 
  93.      * 获取属性信息 
  94.      * 
  95.      */  
  96.     private void getAttributes(){  
  97.         skipSpace();  
  98.         StringBuffer name=new StringBuffer();  
  99.         StringBuffer value=new StringBuffer();  
  100.         boolean isAttribute=false;  
  101.         while(offset<this.xmlLength){  
  102.             char tc1=this.getNextCharacter();  
  103.             if (tc1=='='){  
  104.                 skipSpace();  
  105.                 char tc2=this.getNextCharacter();  
  106.                 if (tc2=='"'){//获取属性值  
  107.                     isAttribute=true;  
  108.                     while(offset<this.xmlLength){  
  109.                         char tc3=this.getNextCharacter();  
  110.                         if (tc3=='"'){  
  111.                             this.exeNode.setAttribute(name.toString(),value.toString());  
  112.                             this.skipSpace();  
  113.                             value.delete(0,value.length());  
  114.                             name.delete(0,name.length());  
  115.                             break;  
  116.                         }else  
  117.                             value.append(tc3);  
  118.                     }  
  119.                 }      
  120.             }else if (tc1=='/'){  
  121.                 skipSpace();  
  122.                 char tc2=this.getNextCharacter();  
  123.                 if (tc2!='>'){  
  124.                     System.err.println("/必须使用>来封闭");  
  125.                 }else{  
  126.                     this.exeNode=this.exeNode.getParent();  
  127.                     break;  
  128.                 }  
  129.             }else if (tc1=='>'){  
  130.                 break;  
  131.             }else{  
  132.                 name.append(tc1);  
  133.             }  
  134.         }          
  135.     }  
  136.   
  137.     private int skipSpace(){  
  138.         int skipCount=0;  
  139.         while(offset<xml.length()){  
  140.             char tc=xml.charAt(offset);  
  141.             if ((tc!=' ')&&(tc!=' ')&&(tc!=' ')){  
  142.                 return skipCount;  
  143.             }else{  
  144.                 offset++;  
  145.                 skipCount++;  
  146.             }  
  147.         }  
  148.         return skipCount;  
  149.     }  
  150.     private String getValue(){  
  151.         StringBuffer value=new StringBuffer();  
  152.         value.append(xml.charAt(offset-1));  
  153.         while(offset<xml.length()){  
  154.             char tc=this.getNextCharacter();  
  155.             value.append(tc);  
  156.             if (xml.charAt(offset)=='<'){  
  157.                 return value.toString().trim();  
  158.             }  
  159.         }  
  160.         return null;          
  161.     }  
  162.     private void getXMLHeader(){  
  163.         this.skipSpace();  
  164.         if ((this.xml.charAt(offset)=='<')&&(this.xml.charAt(offset+1)=='?')){  
  165.                  int idx=this.xml.indexOf("version");  
  166.                  if (idx>0){  
  167.                      boolean start=false;  
  168.                      StringBuffer tmp=new StringBuffer();  
  169.                      for(int i=idx+8;i<this.xmlLength;i++){  
  170.                          char tc=this.xml.charAt(i);  
  171.                           if (tc=='"'){  
  172.                               if (start==false){  
  173.                                   start=true;  
  174.                               }else{  
  175.                                   break;  
  176.                               }  
  177.                           }else{  
  178.                               if (start)  
  179.                                  tmp.append(tc);  
  180.                           }  
  181.                      }  
  182.                      this.version=tmp.toString();  
  183.                        
  184.                  }  
  185.                  idx=this.xml.indexOf("encoding");  
  186.                  if (idx>0){  
  187.                      boolean start=false;  
  188.                      StringBuffer tmp=new StringBuffer();  
  189.                      for(int i=idx+9;i<this.xmlLength;i++){  
  190.                         char tc=this.xml.charAt(i);  
  191.                          if (tc=='"'){  
  192.                             if (start==false){  
  193.                                 start=true;  
  194.                             }else{  
  195.                                 break;  
  196.                             }  
  197.                          }else{  
  198.                             if (start)  
  199.                                tmp.append(tc);  
  200.                          }  
  201.                      }  
  202.                      this.encoding=tmp.toString();  
  203.                  }  
  204.                  int end=this.xml.indexOf("?>");  
  205.                  offset=end+2;  
  206.             }      
  207.               
  208.     }  
  209.     public XMLNode parse(){  
  210.         getXMLHeader();  
  211.         while(offset<this.xmlLength){  
  212.             this.skipSpace();  
  213.             char token=getNextCharacter();  
  214.             if (token=='<'){  
  215.               if (match('!')){  
  216.                   getNextCharacter();  
  217.                      char tc=getNextCharacter();  
  218.                      if (tc=='-'){  
  219.                         tc=getNextCharacter();  
  220.                         if (tc=='-'){  
  221.                            //System.out.println("注释行");  
  222.                            String desc=getDescription();  
  223.                            if (this.exeNode!=null)  
  224.                             this.exeNode.setDescription(desc);  
  225.                         }else{  
  226.                            System.err.println("语法错误在"+offset);     
  227.                            return null;  
  228.                         }     
  229.                      }   
  230.                }else if (match('/')){  
  231.                      String nodeName=this.getNodeName();  
  232.                      if (exeNode.getName().equalsIgnoreCase(nodeName))  
  233.                            exeNode=exeNode.getParent();  
  234.                      else{  
  235.                            System.err.println("期望封闭标签为:"+exeNode.getName()+",实际标签为:"+nodeName);  
  236.                            return null;                      
  237.                      }  
  238.                }else{  
  239.                   String name=this.getNodeName();  
  240.                   XMLNode newNode=new XMLNode(name);  
  241.                   if (root==null){  
  242.                      root=newNode;  
  243.                      exeNode=root;  
  244.                   }else{  
  245.                      exeNode.addChild(newNode);  
  246.                      exeNode=newNode;  
  247.                   }  
  248.                   char tc=this.xml.charAt(offset-1);  
  249.                   if (tc==' ')  
  250.                        getAttributes();  
  251.                   else{  
  252.                        if (tc!='>')  
  253.                           System.err.println(exeNode.getName()+"期待关闭");  
  254.                   }  
  255.                }  
  256.             }else{  
  257.                 exeNode.setValue(getValue());  
  258.             }  
  259.         }  
  260.         return root;  
  261.               
  262.     }  
  263.     public static void main(String[] args){  
  264.         String xml="<?xml version=/"1.0/" encoding=/"GB2312/"?>" +  
  265.                 "<!--注释行--><root desc=/"一个测试的例子/"><book name=/"test/" " +  
  266.                 "value=/"我的/"/><book name=/"跌而/">我的值</book></root>";  
  267.         XMLParser parser=new XMLParser(xml);  
  268.         XMLNode root=parser.parse();  
  269.         System.out.println(root.getName());  
  270.           
  271.         Vector nodes = root.getChildNodes();  
  272.         load(nodes);  
  273.           
  274.           
  275.        // System.out.println(root.toString());  
  276.     }  
  277.       
  278.     static void load(Vector _nodes){  
  279.            
  280.          System.out.println(_nodes);  
  281.            
  282.          for(int i=0; i<_nodes.size(); i++){  
  283.              XMLNode tNode = (XMLNode) _nodes.elementAt(i);  
  284.              System.out.println(tNode.getName());  
  285.              Enumeration keys=tNode.getAttributes().keys();  
  286.                 while(keys.hasMoreElements()){  
  287.                     String key=(String)keys.nextElement();  
  288.                       
  289.                     String value= tNode.getAttribute(key);  
  290.                     System.out.println(" "+ key+ "=" + value + " ");  
  291.                 }  
  292.                 System.out.println(tNode.getValue());  
  293.          }  
  294.     }  
  295. }  
package org.gggeye.easymf.xml;  import java.util.Enumeration; import java.util.Vector;  /**  *   * @author wuhua  * <a href="http://wuhua.3geye.net">我的博客</a>  *  */   public class XMLParser {     private XMLNode root=null;     private XMLNode exeNode=null;     private int offset=0;     private String xml="";     private int xmlLength=0;     private String version="1.1";     private String encoding="UTF-8";     public XMLParser(String xml){         this.xml=xml;         this.xmlLength=xml.length();     }     public char getNextCharacter(){         char rt= xml.charAt(offset);         offset++;         return rt;              }     /** *//**      * 判断下一字符是否为指定字符token      * @param token      * @return      */     private boolean match(char token){         for(int i=offset;i<this.xmlLength;i++){             char tc=xml.charAt(i);             if (tc!=' '){                 if (tc==token){                    return true;                 }else{                    return false;                 }             }         }         return false;     }          private String getDescription(){         skipSpace();         StringBuffer desc=new StringBuffer();         while(offset<this.xmlLength-2){             char tc1=this.getNextCharacter();             if (tc1=='-'){                 if ((xml.charAt(offset)=='-')&&(xml.charAt(offset+1)=='>')){                     offset+=2;                     return desc.toString();                 }                 }else{                 desc.append(tc1);             }         }         return null;              }     /** *//**      * 获取Node名称      * @return      */     private String getNodeName(){         skipSpace();         char[] name=new char[120];//          int i=0;         while(i<120){             char tc=getNextCharacter();             if ((tc==' ')||(tc=='>')||(tc=='/')){                 if (i>0)                     return new String(name).trim();             }else {                    name[i]=tc;                 i++;                 if (i>120){                     System.err.println("NODE NAME长度只能小于120");                     return null;                 }             }         }         return null;     }          /** *//**      * 获取属性信息      *      */     private void getAttributes(){         skipSpace();         StringBuffer name=new StringBuffer();         StringBuffer value=new StringBuffer();         boolean isAttribute=false;         while(offset<this.xmlLength){             char tc1=this.getNextCharacter();             if (tc1=='='){                 skipSpace();                 char tc2=this.getNextCharacter();                 if (tc2=='"'){//获取属性值                     isAttribute=true;                     while(offset<this.xmlLength){                         char tc3=this.getNextCharacter();                         if (tc3=='"'){                             this.exeNode.setAttribute(name.toString(),value.toString());                             this.skipSpace();                             value.delete(0,value.length());                             name.delete(0,name.length());                             break;                         }else                             value.append(tc3);                     }                 }                 }else if (tc1=='/'){                 skipSpace();                 char tc2=this.getNextCharacter();                 if (tc2!='>'){                     System.err.println("/必须使用>来封闭");                 }else{                     this.exeNode=this.exeNode.getParent();                     break;                 }             }else if (tc1=='>'){                 break;             }else{                 name.append(tc1);             }         }             }      private int skipSpace(){         int skipCount=0;         while(offset<xml.length()){             char tc=xml.charAt(offset);             if ((tc!=' ')&&(tc!=' ')&&(tc!=' ')){                 return skipCount;             }else{                 offset++;                 skipCount++;             }         }         return skipCount;     }     private String getValue(){         StringBuffer value=new StringBuffer();         value.append(xml.charAt(offset-1));         while(offset<xml.length()){             char tc=this.getNextCharacter();             value.append(tc);             if (xml.charAt(offset)=='<'){                 return value.toString().trim();             }         }         return null;             }     private void getXMLHeader(){         this.skipSpace();         if ((this.xml.charAt(offset)=='<')&&(this.xml.charAt(offset+1)=='?')){                  int idx=this.xml.indexOf("version");                  if (idx>0){                      boolean start=false;                      StringBuffer tmp=new StringBuffer();                      for(int i=idx+8;i<this.xmlLength;i++){                          char tc=this.xml.charAt(i);                           if (tc=='"'){                               if (start==false){                                   start=true;                               }else{                                   break;                               }                           }else{                               if (start)                                  tmp.append(tc);                           }                      }                      this.version=tmp.toString();                                        }                  idx=this.xml.indexOf("encoding");                  if (idx>0){                      boolean start=false;                      StringBuffer tmp=new StringBuffer();                      for(int i=idx+9;i<this.xmlLength;i++){                         char tc=this.xml.charAt(i);                          if (tc=='"'){                             if (start==false){                                 start=true;                             }else{                                 break;                             }                          }else{                             if (start)                                tmp.append(tc);                          }                      }                      this.encoding=tmp.toString();                  }                  int end=this.xml.indexOf("?>");                  offset=end+2;             }                      }     public XMLNode parse(){         getXMLHeader();         while(offset<this.xmlLength){             this.skipSpace();             char token=getNextCharacter();             if (token=='<'){               if (match('!')){                   getNextCharacter();                      char tc=getNextCharacter();                      if (tc=='-'){                         tc=getNextCharacter();                         if (tc=='-'){                            //System.out.println("注释行");                            String desc=getDescription();                            if (this.exeNode!=null)                             this.exeNode.setDescription(desc);                         }else{                            System.err.println("语法错误在"+offset);                               return null;                         }                         }                 }else if (match('/')){                      String nodeName=this.getNodeName();                      if (exeNode.getName().equalsIgnoreCase(nodeName))                            exeNode=exeNode.getParent();                      else{                            System.err.println("期望封闭标签为:"+exeNode.getName()+",实际标签为:"+nodeName);                            return null;                                          }                }else{                   String name=this.getNodeName();                   XMLNode newNode=new XMLNode(name);                   if (root==null){                      root=newNode;                      exeNode=root;                   }else{                      exeNode.addChild(newNode);                      exeNode=newNode;                   }                   char tc=this.xml.charAt(offset-1);                   if (tc==' ')                        getAttributes();                   else{                        if (tc!='>')                           System.err.println(exeNode.getName()+"期待关闭");                   }                }             }else{                 exeNode.setValue(getValue());             }         }         return root;                  }     public static void main(String[] args){         String xml="<?xml version=/"1.0/" encoding=/"GB2312/"?>" +         		"<!--注释行--><root desc=/"一个测试的例子/"><book name=/"test/" " +         		"value=/"我的/"/><book name=/"跌而/">我的值</book></root>";         XMLParser parser=new XMLParser(xml);         XMLNode root=parser.parse();         System.out.println(root.getName());                  Vector nodes = root.getChildNodes();         load(nodes);                          // System.out.println(root.toString());     }          static void load(Vector _nodes){     	      	 System.out.println(_nodes);     	      	 for(int i=0; i<_nodes.size(); i++){     		 XMLNode tNode = (XMLNode) _nodes.elementAt(i);     		 System.out.println(tNode.getName());     		 Enumeration keys=tNode.getAttributes().keys();     	        while(keys.hasMoreElements()){     	            String key=(String)keys.nextElement();     	                 	            String value= tNode.getAttribute(key);     	            System.out.println(" "+ key+ "=" + value + " ");     	        }     	        System.out.println(tNode.getValue());     	 }     } }

 

Java代码 复制代码
  1. package org.gggeye.easymf.xml;  
  2.   
  3. import java.util.Enumeration;  
  4. import java.util.Hashtable;  
  5. import java.util.Vector;  
  6.   
  7.   
  8.   
  9. /** 
  10.  * XML Node  
  11.  * @author wuhua 
  12.  * <a href="http://wuhua.3geye.net">我的博客</a> 
  13.  * 
  14.  */  
  15.   
  16. public class XMLNode {  
  17.     private String name;  
  18.     private XMLNode parent;  
  19.     private String value;  
  20.     private String description;  
  21.     private Hashtable attributes=new Hashtable();  
  22.     private Vector childNodes=new Vector();  
  23.     public XMLNode(String name){  
  24.         this.name=name;  
  25.     }  
  26.       
  27.     public String getName(){  
  28.         return this.name;  
  29.     }  
  30.     public void setName(String name){  
  31.         this.name=name;  
  32.     }  
  33.     public String getValue(){  
  34.         return this.value;  
  35.     }  
  36.     public void setValue(String value){  
  37.         this.value=value;  
  38.     }  
  39.     public void setAttribute(String name,String value){  
  40.         this.attributes.put(name,value);  
  41.     }  
  42.     public String getAttribute(String attributeName){  
  43.         return (String)attributes.get(attributeName);  
  44.     }  
  45.     public void setDescription(String desc){  
  46.         this.description=desc;  
  47.     }  
  48.     public String getDescription(){  
  49.         return this.description;  
  50.     }  
  51.     public void setParent(XMLNode parent){  
  52.         this.parent=parent;  
  53.     }  
  54.     public XMLNode getParent(){  
  55.         return this.parent;  
  56.     }  
  57.     public void addChild(XMLNode childNode){  
  58.         this.childNodes.addElement(childNode);  
  59.         childNode.setParent(this);   
  60.     }  
  61.       
  62.     public String toString(){  
  63.         StringBuffer xml=new StringBuffer();  
  64.         if ((this.getDescription()!=null)&&(this.getDescription().length()>0))  
  65.            xml.append("<!--"+this.getDescription()+"--> ");  
  66.         xml.append("<");  
  67.         xml.append(this.getName());  
  68.           
  69.         Enumeration keys=this.attributes.elements();  
  70.         while(keys.hasMoreElements()){  
  71.             String key=(String)keys.nextElement();  
  72.             String value=(String)this.attributes.get(key);  
  73.             xml.append(" "+ key+ "=" + value + " ");  
  74.         }  
  75.         if (((this.getValue()==null)||(this.getValue().length()==0))&&(this.childNodes.size()==0)){  
  76.            xml.append(" /> ");  
  77.         }else{  
  78.            xml.append(" >");  
  79.            if ((this.getValue()!=null)&&(this.getValue().length()>0)){  
  80.                    xml.append(this.getValue());  
  81.            }          
  82.            for(int i=0;i<this.childNodes.size();i++)  
  83.              xml.append(((XMLNode)this.childNodes.elementAt(i)).toString());  
  84.            xml.append("</"+this.getName()+"> ");           
  85.         }  
  86.         return xml.toString();  
  87.     }  
  88.   
  89.     public Hashtable getAttributes() {  
  90.         return attributes;  
  91.     }  
  92.   
  93.     public Vector getChildNodes() {  
  94.         return childNodes;  
  95.     }  
  96. }  
package org.gggeye.easymf.xml;  import java.util.Enumeration; import java.util.Hashtable; import java.util.Vector;    /**  * XML Node   * @author wuhua  * <a href="http://wuhua.3geye.net">我的博客</a>  *  */  public class XMLNode {     private String name;     private XMLNode parent;     private String value;     private String description;     private Hashtable attributes=new Hashtable();     private Vector childNodes=new Vector();     public XMLNode(String name){         this.name=name;     }          public String getName(){         return this.name;     }     public void setName(String name){         this.name=name;     }     public String getValue(){         return this.value;     }     public void setValue(String value){         this.value=value;     }     public void setAttribute(String name,String value){         this.attributes.put(name,value);     }     public String getAttribute(String attributeName){         return (String)attributes.get(attributeName);     }     public void setDescription(String desc){         this.description=desc;     }     public String getDescription(){         return this.description;     }     public void setParent(XMLNode parent){         this.parent=parent;     }     public XMLNode getParent(){         return this.parent;     }     public void addChild(XMLNode childNode){         this.childNodes.addElement(childNode);         childNode.setParent(this);      }          public String toString(){         StringBuffer xml=new StringBuffer();         if ((this.getDescription()!=null)&&(this.getDescription().length()>0))            xml.append("<!--"+this.getDescription()+"--> ");         xml.append("<");         xml.append(this.getName());                  Enumeration keys=this.attributes.elements();         while(keys.hasMoreElements()){             String key=(String)keys.nextElement();             String value=(String)this.attributes.get(key);             xml.append(" "+ key+ "=" + value + " ");         }         if (((this.getValue()==null)||(this.getValue().length()==0))&&(this.childNodes.size()==0)){            xml.append(" /> ");         }else{            xml.append(" >");            if ((this.getValue()!=null)&&(this.getValue().length()>0)){                    xml.append(this.getValue());            }                    for(int i=0;i<this.childNodes.size();i++)              xml.append(((XMLNode)this.childNodes.elementAt(i)).toString());            xml.append("</"+this.getName()+"> ");                  }         return xml.toString();     }  	public Hashtable getAttributes() { 		return attributes; 	}  	public Vector getChildNodes() { 		return childNodes; 	} } 

 类就两个。很简单

看看Demo吧。

 

Java代码 复制代码
  1. String _res = Tools.toUTFString(Tools.read(this.getClass().  
  2.                              getResourceAsStream(_url)));  
  3.                      XMLParser tXMLParser = new XMLParser(_res);  
  4.                      XMLNode tXMLNode= tXMLParser.parse();  
  5.                      PlayerItem tMp4 = new PlayerItem(tXMLNode.getAttribute("name"), tXMLNode.getAttribute("encode"));  
  6.                      for(int i=0; i<tXMLNode.getChildNodes().size(); i++){  
  7.                          XMLNode tNode = (XMLNode) tXMLNode.getChildNodes().elementAt(i);  
  8.                            
  9.                          tMp4.addQueue(tNode.getValue());  
  10.                      }  
  11.   
  12.                      PlayerPanel tMP4Panel = new PlayerPanel(tMp4, getPlayerList());  
  13.                      tMP4Panel.show();  
  14.   
  15. 上面的例子是我从自己实现了一个J2ME流媒体播放器抽出来的,大家凑合着看。  
String _res = Tools.toUTFString(Tools.read(this.getClass(). 							 getResourceAsStream(_url))); 					 XMLParser tXMLParser = new XMLParser(_res); 					 XMLNode tXMLNode= tXMLParser.parse(); 					 PlayerItem tMp4 = new PlayerItem(tXMLNode.getAttribute("name"), tXMLNode.getAttribute("encode")); 			    	 for(int i=0; i<tXMLNode.getChildNodes().size(); i++){ 			    		 XMLNode tNode = (XMLNode) tXMLNode.getChildNodes().elementAt(i); 			    		  			    		 tMp4.addQueue(tNode.getValue()); 			    	 }  			    	 PlayerPanel tMP4Panel = new PlayerPanel(tMp4, getPlayerList()); 					 tMP4Panel.show();  上面的例子是我从自己实现了一个J2ME流媒体播放器抽出来的,大家凑合着看。 

 

解释就这么简单。欢迎大家讨论。有啥需要讨论的东西,留言沟通

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值