animationdemo.java

来自「J2ME lwuit实现屏幕九宫图,功能十分强大」· Java 代码 · 共 49 行

JAVA
49
字号
/* * Copyright ?2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * */package com.sun.lwuit.uidemo;import com.sun.lwuit.Button;import com.sun.lwuit.Command;import com.sun.lwuit.Form;import com.sun.lwuit.events.ActionEvent;import com.sun.lwuit.events.ActionListener;import com.sun.lwuit.layouts.BoxLayout;import com.sun.lwuit.util.Resources;import java.io.IOException;/** * Demonstrates simple animation both static and manual * * @author Shai Almog */public class AnimationDemo implements ActionListener {    public Form form = new Form("AnimationDemo");    private  Command backCommand = new Command("Back", 1);    AnimationDemo()    {        try {            form.addCommand(backCommand);            form.setCommandListener(this);            Button animation = new Button(Resources.open("/res/duke.res").getAnimation("duke3_1.gif"));            animation.setBorderPainted(false);            animation.getStyle().setBgTransparency(0);            form.setLayout(new BoxLayout(BoxLayout.Y_AXIS));            form.addComponent(animation);        } catch (IOException ex) {            ex.printStackTrace();        }    }    public void actionPerformed(ActionEvent arg0) {        if(arg0.getCommand()==backCommand)        {            UIDemoMIDlet.backToMainMenu();        }    }}

⌨️ 快捷键说明

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