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

📄 item.java

📁 用于移动设备上的java虚拟机源代码
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
     *     * <P>Value <code>0x30</code> is assigned to      * <code>LAYOUT_VCENTER</code>.</P>     * @since MIDP 2.0     */    public final static int LAYOUT_VCENTER = 0x30;    /**     * A layout directive indicating that this <code>Item</code>      * should be placed at the beginning of a new line or row.     *     * <P>Value <code>0x100</code> is assigned to      * <code>LAYOUT_NEWLINE_BEFORE</code>.</P>     * @since MIDP 2.0     */    public final static int LAYOUT_NEWLINE_BEFORE = 0x100;    /**     * A layout directive indicating that this <code>Item</code>     * should the last on its line or row, and that the next     * <code>Item</code> (if any) in the container     * should be placed on a new line or row.     *     * <P>Value <code>0x200</code> is assigned to      * <code>LAYOUT_NEWLINE_AFTER</code>.</P>     * @since MIDP 2.0     */    public final static int LAYOUT_NEWLINE_AFTER = 0x200;    /**     * A layout directive indicating that this <code>Item's</code>     * width may be reduced to its minimum width.     *     *<P>Value <code>0x400</code> is assigned to <code>LAYOUT_SHRINK</code></P>     * @since MIDP 2.0     */    public final static int LAYOUT_SHRINK = 0x400;    /**     * A layout directive indicating that this <code>Item's</code>      * width may be increased to fill available space.     *     *<P>Value <code>0x800</code> is assigned to <code>LAYOUT_EXPAND</code>.</P>     * @since MIDP 2.0     */    public final static int LAYOUT_EXPAND = 0x800;    /**     * A layout directive indicating that this <code>Item's</code>     * height may be reduced to its minimum height.     *     * <P>Value <code>0x1000</code> is assigned to     * <code>LAYOUT_VSHRINK</code>.</P>     * @since MIDP 2.0     */    public final static int LAYOUT_VSHRINK = 0x1000;    /**     * A layout directive indicating that this <code>Item's</code>      * height may be increased to fill available space.     *     * <P>Value <code>0x2000</code> is assigned to      * <code>LAYOUT_VEXPAND</code>.</P>     * @since MIDP 2.0     */    public final static int LAYOUT_VEXPAND = 0x2000;    /**     * A layout directive indicating that new MIDP 2.0 layout     * rules are in effect for this <code>Item</code>.  If this     * bit is clear, indicates that MIDP 1.0 layout behavior     * applies to this <code>Item</code>.     *     * <P>Value <code>0x4000</code> is assigned to     * <code>LAYOUT_2</code>.</P>     *      * @since MIDP 2.0     */    public static final int LAYOUT_2 = 0x4000;    /**     * An appearance mode value indicating that the <code>Item</code> is to have     * a normal appearance.     *     * <P>Value <code>0</code> is assigned to <code>PLAIN</code>.</P>     * @since MIDP 2.0     */    public final static int PLAIN = 0;    /**     * An appearance mode value indicating that the <code>Item</code>     * is to appear as a hyperlink.     * <P>Value <code>1</code> is assigned to <code>HYPERLINK</code>.</P>     * @since MIDP 2.0     */    public final static int HYPERLINK = 1;    /**     * An appearance mode value indicating that the <code>Item</code>     * is to appear as a button.     * <P>Value <code>2</code> is assigned to <code>BUTTON</code>.</P>     * @since MIDP 2.0     */    public final static int BUTTON = 2;// ************************************************************//  protected member variables// ************************************************************// ************************************************************//  package private member variables// ************************************************************    /** bounds[] array index to x coordinate */    final static int X      = Displayable.X;    /** bounds[] array index to y coordinate */    final static int Y      = Displayable.Y;    /** bounds[] array index to width */    final static int WIDTH  = Displayable.WIDTH;    /** bounds[] array index to height */    final static int HEIGHT = Displayable.HEIGHT;    /** internal bitmask representing a valid layout mask */    final static int VALID_LAYOUT;    /**     * An array of 4 elements, describing the x, y, width, height     * of this Item's bounds in the viewport coordinate space. If     * its null, it means the Item is currently not in the viewport     */    int[] bounds;    /**     * A flag indicating this Item has the input focus. This is     * maintained by the Item superclass for easy use by subclass     * code.     */    boolean hasFocus;    /**     * A flag indicating this Item is currently (at least partially)     * visible on the Form it is on. This is maintained by the Item     * superclass for easy use by subclass code.     */    boolean visible;    /**     * A flag indicating the size of this Item has changed in a     * subsequent layout operation     */    boolean sizeChanged;    /**     * commandListener that has to be notified of when ITEM command is     * activated     */    ItemCommandListener commandListener; // = null;    /** The label of this Item */    String label;    /**     * The owner Screen for this Item     */    Screen owner;     // = null    /**     * The layout type of this Item     */    int layout;       // = 0 ; LAYOUT_DEFAULT = 0    /**     * This is a default Command which represents the callback     * to a selection event.     */    Command defaultCommand;    /** The number of Commands added to this Item */    int numCommands;    /** The locked width of this Item, -1 by default */    int lockedWidth = -1;    /** The locked height of this Item, -1 by default */    int lockedHeight = -1;    /**     * A flag signaling how labels are painted. If true,     * labels are only painted bold on traverse, else they     * are always painted bold     */    final static boolean LABEL_BOLD_ON_TRAVERSE = false;    /**     * Padding used between Button Border and ImageItem     */    final static int BUTTON_PAD = 2;    /**     * Button Border is 3 pixel wide and 3 pixel high     */    final static int BUTTON_BORDER = 3;    /** Button border color for light gray border */    static final int LIGHT_GRAY_COLOR = 0x00AFAFAF; // light gray    /** Button border color for dark gray border */    static final int DARK_GRAY_COLOR = 0x00606060; // dark gray    /** The font to render item labels with focus */    final static Font LABEL_FONT = Font.getFont(        Screen.CONTENT_FONT.getFace(),        Font.STYLE_BOLD,        Screen.CONTENT_FONT.getSize());    /** 2 pixel padding between the label and the item's contents */    final static int LABEL_PAD = 2;    /** The height of the label (maximum of 1 line */    final static int LABEL_HEIGHT = LABEL_FONT.getHeight() + LABEL_PAD;    /** Maximum width available to any Item */    final static int DEFAULT_WIDTH =         Display.WIDTH - Form.CELL_SPACING - Form.CELL_SPACING;// ************************************************************//  private member variables// ************************************************************    /** An array of Commands added to this Item */    private Command commands[];// ************************************************************//  Static initializer, constructor// ************************************************************    static {        VALID_LAYOUT =            Item.LAYOUT_DEFAULT |            Item.LAYOUT_LEFT |            Item.LAYOUT_RIGHT |            Item.LAYOUT_CENTER |            Item.LAYOUT_TOP |            Item.LAYOUT_BOTTOM |            Item.LAYOUT_VCENTER |            Item.LAYOUT_SHRINK |            Item.LAYOUT_EXPAND |            Item.LAYOUT_VSHRINK |            Item.LAYOUT_VEXPAND |            Item.LAYOUT_NEWLINE_BEFORE |            Item.LAYOUT_NEWLINE_AFTER |            Item.LAYOUT_2;    }    /**     * Creates a new item with a given label.     *     * @param label the label string; null is allowed     */    Item(String label) {        // SYNC NOTE: probably safe, but since subclasses can't lock        // around their call to super(), we'll lock it here        synchronized (Display.LCDUILock) {            this.label = label;        }    }// ************************************************************//  public methods// ************************************************************    /**     * Sets the label of the <code>Item</code>. If <code>label</code>     * is <code>null</code>, specifies that this item has no label.     *      * <p>It is illegal to call this method if this <code>Item</code>     * is contained within  an <code>Alert</code>.</p>     *      * @param label the label string     * @throws IllegalStateException if this <code>Item</code> is contained      * within an <code>Alert</code>     * @see #getLabel     */    public void setLabel(String label) {        synchronized (Display.LCDUILock) {            this.label = label;            invalidate();        }    }        /**     * Gets the label of this <code>Item</code> object.     * @return the label string     * @see #setLabel     */    public String getLabel() {        // SYNC NOTE: return of atomic value, no locking necessary        return label;    }    /**     * Gets the layout directives used for placing the item.     * @return a combination of layout directive values     * @since MIDP 2.0     * @see #setLayout     */    public int getLayout() {        // SYNC NOTE: return of atomic value, no locking necessary        return layout;    }    /**     * Sets the layout directives for this item.     *     * <p>It is illegal to call this method if this <code>Item</code>      * is contained within an <code>Alert</code>.</p>     *      * @param layout a combination of layout directive values for this item     * @throws IllegalArgumentException if the value of layout is not a     * bit-wise OR combination of layout directives     * @throws IllegalStateException if this <code>Item</code> is     * contained within an <code>Alert</code>     * @since MIDP 2.0     * @see #getLayout     */    public void setLayout(int layout) {        synchronized (Display.LCDUILock) {            setLayoutImpl(layout);            invalidate();        }    }    /**     * Adds a context sensitive <code>Command</code> to the item.     * The semantic type of     * <code>Command</code> should be <code>ITEM</code>. The implementation     * will present the command     * only when the item is active, for example, highlighted.     * <p>     * If the added command is already in the item (tested by comparing the     * object references), the method has no effect. If the item is     * actually visible on the display, and this call affects the set of     * visible commands, the implementation should update the display as soon     * as it is feasible to do so.     *     * <p>It is illegal to call this method if this <code>Item</code>     * is contained within an <code>Alert</code>.</p>     *     * @param cmd the command to be added     * @throws IllegalStateException if this <code>Item</code> is contained     * within an <code>Alert</code>     * @throws NullPointerException if cmd is <code>null</code>     * @since MIDP 2.0     */    public void addCommand(Command cmd) {        synchronized (Display.LCDUILock) {            addCommandImpl(cmd);        }        }    /**     * Removes the context sensitive command from item. If the command is not     * in the <code>Item</code> (tested by comparing the object references),     * the method has     * no effect. If the <code>Item</code> is actually visible on the display,      * and this  call     * affects the set of visible commands, the implementation should update     * the display as soon as it is feasible to do so.     *     *     * If the command to be removed happens to be the default command,     * the command is removed and the default command on this Item is     * set to <code>null</code>.     *     * The following code:     * <CODE> <pre>     *     // Command c is the default command on Item item     *     item.removeCommand(c);     * </pre> </CODE>     * is equivalent to the following code:     * <CODE> <pre>     *     // Command c is the default command on Item item     *     item.setDefaultCommand(null);     *     item.removeCommand(c);     * </pre> </CODE>     *     *     * @param cmd the command to be removed     * @since MIDP 2.0     */    public void removeCommand(Command cmd) {        synchronized (Display.LCDUILock) {            removeCommandImpl(cmd);        }

⌨️ 快捷键说明

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