smilexample.java~2~

来自「控制手机发送短信程序」· JAVA~2~ 代码 · 共 62 行

JAVA~2~
62
字号
package mms;import java.io.FileInputStream;import java.io.FileNotFoundException;import java.io.IOException;import com.objectxp.mms.message.SMILMessage;import com.objectxp.mms.message.smil.Body;import com.objectxp.mms.message.smil.Head;import com.objectxp.mms.message.smil.Image;import com.objectxp.mms.message.smil.Layout;import com.objectxp.mms.message.smil.RootLayout;import com.objectxp.mms.message.smil.SmilDocument;import com.objectxp.mms.message.smil.Text;import com.objectxp.mms.message.smil.Timer;/** * This example Demonstrates how to construct a SMIL document using jSMS. */public class SmilExample{  public static void main(String[] args) throws FileNotFoundException, IOException  {    // create a new SMIL document    SmilDocument doc = new SmilDocument();    // Head and Body elements    Head head = new Head();    Body body = new Body();    doc.addElement(head);    doc.addElement(body);    Layout layout = new Layout();    RootLayout rl = new RootLayout();    rl.addAttribute(RootLayout.WIDTH, "160");    rl.addAttribute(RootLayout.HEIGHT, "140");    layout.addElement(rl);    head.addElement(layout);    // add first element    Timer part1 = new Timer();    part1.addAttribute(Timer.TIMING_DUR, "5s");    body.addElement(part1);    part1.addElement(      new Text("Hello World".getBytes(), "hello.txt", "text/plain"));    // add second part    Timer part2 = new Timer();    part2.addAttribute(Timer.TIMING_DUR, "5s");    body.addElement(part2);    part2.addElement(      new Image(        new FileInputStream("/tmp/picture.jpg"),        "picture.jpg",        "image/jpeg"));    // Construct a SMIL message    SMILMessage msg = new SMILMessage(doc);  }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?