⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 softkeyimpl.java

📁 开发j2me 手机程序必须的用到的。文件较小
💻 JAVA
字号:
package com.jmobilecore.ui;

import com.jmobilecore.ui.core.SoftKey;
import com.jmobilecore.ui.core.EventListener;

/**
 * This class is implementation of abstract class <code>SoftKey</code>
 * The class keeps information about returning value and reference to
 * it's parent (owner).
 *
 * @author Greg Gridin
 */
public class SoftKeyImpl extends SoftKey {

    /**
     * Parent (owner) of this soft key
     */
    public EventListener parent = null;

    /**
     * Result to report
     */
    public int rslt;

    /**
     * Creates a new <code>SoftKeyImpl</code> instance.
     *
     * @param label The <code>SoftKey</code> label.
     * @see #performAction
     */
    public SoftKeyImpl(String label) {
        this(label, null, EventListener.EVENT_OK);
    }

    /**
     * Creates a new <code>SoftKeyImpl</code> instance.
     *
     * @param label  The <code>SoftKey</code> label.
     * @param parent The parent (owner) of this soft key.
     * @see #performAction
     */
    public SoftKeyImpl(String label, EventListener parent) {
        this(label, parent, EventListener.EVENT_OK);
    }

    /**
     * Creates a new <code>SoftKeyImpl</code> instance.
     *
     * @param label  The <code>SoftKey</code> label.
     * @param parent The parent (owner) of this soft key.
     * @param rslt   The result to report.
     * @see #performAction
     */
    public SoftKeyImpl(String label, EventListener parent, int rslt) {
        super(label);
        this.parent = parent;
        this.rslt = rslt;
    }

    /**
     * Performs an action - informs the parent that action is performed
     */
    public void performAction() {
        if (parent != null) {
            parent.actionPerformed(rslt);
        }
    }
} // class SoftKeyImpl

⌨️ 快捷键说明

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