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

📄 menuitem.java

📁 j2me写的google地图
💻 JAVA
字号:
// Decompiled by DJ v3.7.7.81 Copyright 2004 Atanas Neshkov  Date: 2008-6-16 11:23:26
// Home Page : http://members.fortunecity.com/neshkov/dj.html  - Check often for new version!
// Decompiler options: packimports(3) 
// Source File Name:   MenuItem.java

package com.eightmotions.menu;

import javax.microedition.lcdui.*;

// Referenced classes of package com.eightmotions.menu:
//            Menu

public class MenuItem extends Command
{

    public MenuItem(String inLabel, int type, int pos)
    {
        super(inLabel, type, pos);
        subMenu = null;
        shortKey = '\0';
        f = null;
        f = Font.getFont(64, 0, 8);
    }

    public MenuItem(String inLabel, int type, int pos, char c)
    {
        super(inLabel, type, pos);
        subMenu = null;
        shortKey = '\0';
        f = null;
        f = Font.getFont(64, 0, 8);
        shortKey = c;
    }

    public void setShortKey(char c)
    {
        shortKey = c;
    }

    public void setSubMenu(Menu inMenu)
    {
        subMenu = inMenu;
    }

    public void paint(Graphics g, boolean isSel, int x, int y, int menuw)
    {
        g.setFont(f);
        int menuHeight = f.getHeight() + 2;
        if(isSel)
        {
            g.setColor(0xa0a0a0);
            g.fillRect(x + 3, y, menuw - 5, menuHeight);
        }
        g.setColor(0);
        g.drawString(getLabel(), x + 4, y + 1, 20);
        if(shortKey != 0)
        {
            int width = f.stringWidth("#") + 4;
            g.setColor(0xffffff);
            g.fillRoundRect((x + menuw) - width - 4, y + 1, width, f.getHeight(), 4, 4);
            if(isSel)
                g.setColor(0);
            else
                g.setColor(0x979797);
            g.drawRoundRect((x + menuw) - width - 4, y + 1, width, f.getHeight() - 1, 4, 4);
            g.setColor(0xb5b5b5);
            g.drawLine((x + menuw) - width - 3, (y + f.getHeight()) - 1, (x + menuw) - 5, (y + f.getHeight()) - 1);
            g.setColor(0xd7d7d7);
            g.drawLine((x + menuw) - width - 3, (y + f.getHeight()) - 2, (x + menuw) - 5, (y + f.getHeight()) - 2);
            g.setColor(0);
            g.drawChar(shortKey, (x + menuw) - width - 1, y + 2, 20);
        }
        if(subMenu != null)
        {
            if(isSel)
                g.setColor(0);
            else
                g.setColor(0x979797);
            g.fillTriangle((x + menuw) - 8, y + 2, (x + menuw) - 2, y + 6, (x + menuw) - 8, y + 10);
        }
    }

    public int getWidth()
    {
        int res = f.stringWidth(getLabel());
        if(shortKey != 0)
            res += 6 + f.charWidth(shortKey);
        return res;
    }

    public Menu subMenu;
    char shortKey;
    Font f;
}

⌨️ 快捷键说明

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