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

📄 mcanvas.java

📁 飞信的j2me源代码
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
        isKeyPressed = false;
        hasPainted = true;
        spend = System.currentTimeMillis() - start;
        try
        {
            Paint_Error(g);
        }
        catch(Exception exception1) { }
    }

    public int getANIM_COVER()
    {
        return 1;
    }

    public void Paint_Test_Info(Graphics g)
    {
        g.setColor(150, 0, 0);
        g.drawString("timer:" + midlet.startStepTimer, 5, 30, 0x10 | 4);
        g.drawString("position:" + midlet.position, 5, 40, 0x10 | 4);
    }

    public void output(String s)
    {
    }

    private void paintGroupTab(Graphics g)
    {
        buddySec.paint(g);
        strangerSec.paint(g);
    }

    private void paintFirstPage(Graphics g)
    {
        if(isloadImageError)
        {
            g.setColor(0xff0000);
            g.drawString("加载图片失败", 1, 1, 20);
            return;
        }
        int i = 0;
        try
        {
            i = Setting.Y_AppName + img_AppName.getHeight() + Setting.CHAR_HEIGHT + 1;
        }
        catch(Exception exception) { }
        byte byte0 = 10;
        if(Setting.HEIGHT <= 128)
            byte0 = 6;
        if(isAnimationsRunning(1))
        {
            sp_FirstAnimation.nextFrame();
            g.setColor(0x487ae9);
            byte byte1 = 0;
            if(midlet.startStepTimer < 4)
                byte1 = 0;
            else
            if(midlet.startStepTimer < 8)
                byte1 = 1;
            else
            if(midlet.startStepTimer < 9)
                byte1 = 2;
            else
                byte1 = 3;
            g.drawString(ChineseString.loadingHit[byte1], 3, i - Setting.CHAR_HEIGHT - 1, 20);
            g.setColor(0x487ae9);
            g.fillRoundRect(10, i, midlet.startStepTimer * 11, byte0, 4, 4);
            g.drawRoundRect(10, i, 110, byte0, 4, 4);
        }
        sp_FirstAnimation.paint(g);
        g.drawImage(img_AppName, 10, Setting.Y_AppName, 20);
        g.setColor(0x487ae9);
        g.drawString("版本号:" + MMIDlet.version, 3, Setting.HEAD_HEIGHT + 2, 20);
    }

    private void paintFooter(Graphics g)
    {
        int i = Setting.HEIGHT - 15;
        blt(img_Bottom, 0, 0, Setting.WIDTH, img_Bottom.getHeight(), 0, i, g);
        int j = img_Commands.getHeight() / 5;
        byte byte0 = 3;
        rightKeyAction = 3;
        if(tabNum == 0 && !buddySec.isSelected && !strangerSec.isSelected && currentList != null)
        {
            MMIDlet.selectedItem = currentList.currentItem();
            if(MMIDlet.selectedItem != null)
            {
                if(MMIDlet.selectedItem.type == MListItem.BUDDY_ITEM)
                {
                    if(!MMIDlet.selectedItem.buddy.isCancelService())
                    {
                        if(!MMIDlet.selectedItem.buddy.isBlock())
                        {
                            byte0 = 1;
                            rightKeyAction = 1;
                        }
                    }
                }
            }
        }
        if(necError){
            byte0 = 4;
        }
        blt(img_Commands, 0, 0, img_Commands.getWidth(), j, 5, i + (15 - j) / 2, g);
        blt(img_Commands, 0, byte0 * j, img_Commands.getWidth(), j, Setting.WIDTH - (5 + img_Commands.getWidth()), i + (15 - j) / 2, g);
        
        if(MMIDlet.user.isOnline())
        {
            blt(img_BigIcon, 0, 0, Setting.BUDDY_ICON_SIZE, Setting.BUDDY_ICON_SIZE, Setting.X_Oneself_Appearance, i, g);
            if(!MMIDlet.user.isActive())
                if(MMIDlet.user.isBusy())
                    blt(img_BigIcon, 11 * Setting.BUDDY_ICON_SIZE, 0, Setting.BUDDY_ICON_SIZE, Setting.BUDDY_ICON_SIZE, Setting.X_Oneself_Appearance, i, g);
                else
                    blt(img_BigIcon, 12 * Setting.BUDDY_ICON_SIZE, 0, Setting.BUDDY_ICON_SIZE, Setting.BUDDY_ICON_SIZE, Setting.X_Oneself_Appearance, i, g);
        } else
        {
            blt(img_BigIcon, 10 * Setting.BUDDY_ICON_SIZE, 0, Setting.BUDDY_ICON_SIZE, Setting.BUDDY_ICON_SIZE, Setting.X_Oneself_Appearance, i, g);
        }
        if(midlet.messageNotifyFlag[0])
            blt(img_BigIcon, Setting.BUDDY_ICON_SIZE * 3, 0, Setting.BUDDY_ICON_SIZE, Setting.BUDDY_ICON_SIZE, Setting.X_Sound_Appearance, i, g);
        else
        if(midlet.messageNotifyFlag[1])
        {
            blt(img_BigIcon, Setting.BUDDY_ICON_SIZE * 2, 0, Setting.BUDDY_ICON_SIZE, Setting.BUDDY_ICON_SIZE, Setting.X_Sound_Appearance, i, g);
        } else
        {
            blt(img_BigIcon, Setting.BUDDY_ICON_SIZE * 3, 0, Setting.BUDDY_ICON_SIZE, Setting.BUDDY_ICON_SIZE, Setting.X_Sound_Appearance, i, g);
            blt(img_BigIcon, Setting.BUDDY_ICON_SIZE * 7, 0, Setting.BUDDY_ICON_SIZE, Setting.BUDDY_ICON_SIZE, Setting.X_Sound_Appearance, i, g);
        }
        blt(img_BigIcon, Setting.BUDDY_ICON_SIZE * 6, 0, Setting.BUDDY_ICON_SIZE, Setting.BUDDY_ICON_SIZE, Setting.X_Absence_Information, i, g);
        g.setColor(0);
        g.drawString(String.valueOf(ChatSession.total_UnReadMessageCount), Setting.X_Information, i, 24);
        if(isPointed && y < i + Setting.BUDDY_ICON_SIZE && y > i)
            if(x < 5 + img_Commands.getWidth() && x > 5)
            {
                g.setColor(255, 0, 0);
                g.drawRect(5, i, img_Commands.getWidth(), Setting.BUDDY_ICON_SIZE);
            } else
            if(x < Setting.WIDTH - 5 && x > Setting.WIDTH - (5 + img_Commands.getWidth()))
            {
                g.setColor(255, 0, 0);
                g.drawRect(Setting.WIDTH - (5 + img_Commands.getWidth()), i, img_Commands.getWidth(), Setting.BUDDY_ICON_SIZE);
            } else
            if(x < Setting.X_Oneself_Appearance + Setting.BUDDY_ICON_SIZE && x > Setting.X_Oneself_Appearance)
            {
                g.setColor(255, 0, 0);
                g.drawRect(Setting.X_Oneself_Appearance, i, Setting.BUDDY_ICON_SIZE, Setting.BUDDY_ICON_SIZE);
            } else
            if(x < Setting.X_Sound_Appearance + Setting.BUDDY_ICON_SIZE && x > Setting.X_Sound_Appearance)
            {
                g.setColor(255, 0, 0);
                g.drawRect(Setting.X_Sound_Appearance, i, Setting.BUDDY_ICON_SIZE, Setting.BUDDY_ICON_SIZE);
            } else
            if(x < Setting.X_Absence_Information + 44 && x > Setting.X_Absence_Information)
            {
                g.setColor(255, 0, 0);
                g.drawRect(Setting.X_Absence_Information, i, 44, Setting.BUDDY_ICON_SIZE);
            }
    }

    private void paintTab(Graphics g)
    {
        int i = Setting.HEAD_HEIGHT;
        blt(img_Tab, 0, (img_Tab.getHeight() / 3) * tabNum, Setting.WIDTH, img_Tab.getHeight() / 3, 0, i, g);
        if(isPointed)
            if(tabNum == 0)
            {
                if(WIDTH >= 240)
                {
                    if(x < 140 && x > 40 && y < 45 && y > 24)
                    {
                        g.setColor(255, 0, 0);
                        g.drawRect(40, 24, 100, 21);
                    } else
                    if(x < 202 && x > 180 && y < 45 && y > 24)
                    {
                        g.setColor(255, 0, 0);
                        g.drawRect(180, 24, 22, 21);
                    } else
                    if(x < 235 && x > 212 && y < 45 && y > 24)
                    {
                        g.setColor(255, 0, 0);
                        g.drawRect(212, 24, 23, 21);
                    }
                } else
                if(WIDTH >= 176)
                {
                    if(x < 120 && x > 0 && y < 45 && y > 24)
                    {
                        g.setColor(255, 0, 0);
                        g.drawRect(4, 24, 100, 21);
                    } else
                    if(x < 148 && x > 125 && y < 45 && y > 24)
                    {
                        g.setColor(255, 0, 0);
                        g.drawRect(130, 24, 15, 21);
                    } else
                    if(x < 176 && x > 150 && y < 45 && y > 24)
                    {
                        g.setColor(255, 0, 0);
                        g.drawRect(150, 24, 23, 21);
                    }
                } else
                if(WIDTH < 128);
            } else
            if(tabNum == 1)
            {
                if(WIDTH >= 240)
                {
                    if(x < 27 && x > 5 && y < 45 && y > 24)
                    {
                        g.setColor(255, 0, 0);
                        g.drawRect(5, 24, 22, 21);
                    } else
                    if(x < 180 && x > 60 && y < 45 && y > 24)
                    {
                        g.setColor(255, 0, 0);
                        g.drawRect(60, 24, 120, 21);
                    } else
                    if(x < 235 && x > 212 && y < 45 && y > 24)
                    {
                        g.setColor(255, 0, 0);
                        g.drawRect(212, 24, 23, 21);
                    }
                } else
                if(WIDTH >= 176)
                {
                    if(x < 25 && x > 0 && y < 45 && y > 24)
                    {
                        g.setColor(255, 0, 0);
                        g.drawRect(1, 24, 22, 21);
                    } else
                    if(x < 148 && x > 26 && y < 45 && y > 24)
                    {
                        g.setColor(255, 0, 0);
                        g.drawRect(30, 24, 110, 21);
                    } else
                    if(x < 176 && x > 150 && y < 45 && y > 24)
                    {
                        g.setColor(255, 0, 0);
                        g.drawRect(155, 24, 19, 21);
                    }
                } else
                if(WIDTH < 128);
            } else
            if(tabNum == 2)
                if(WIDTH >= 240)
                {
                    if(x < 27 && x > 5 && y < 45 && y > 24)
                    {
                        g.setColor(255, 0, 0);
                        g.drawRect(5, 24, 22, 21);
                    } else
                    if(x < 62 && x > 39 && y < 45 && y > 24)
                    {
                        g.setColor(255, 0, 0);
                        g.drawRect(39, 24, 23, 21);
                    } else
                    if(x < 203 && x > 103 && y < 45 && y > 24)
                    {
                        g.setColor(255, 0, 0);
                        g.drawRect(103, 24, 100, 21);
                    }
                } else
                if(WIDTH >= 176)
                {
                    if(x < 25 && x > 0 && y < 45 && y > 24)
                    {
                        g.setColor(255, 0, 0);
                        g.drawRect(2, 24, 20, 21);
                    } else
                    if(x < 50 && x > 26 && y < 45 && y > 24)
                    {
                        g.setColor(255, 0, 0);
                        g.drawRect(28, 24, 20, 21);
                    } else
                    if(x < 176 && x > 52 && y < 45 && y > 24)
                    {
                        g.setColor(255, 0, 0);
                        g.drawRect(55, 24, 100, 21);
                    }
                } else
                if(WIDTH < 128);
    }

    private boolean isAnimationsRunning(int i)
    {
        return (animation & i) == i;
    }

    private void paintMList(Graphics g)
    {
        if(currentList != null)
        {
            if(isAnimationsRunning(2))
            {
                currentList.down();
                if(currentList.isEnd())
                    stopAnimation(2);
            } else
            if(isAnimationsRunning(4))
            {
                currentList.up();
                if(currentList.isHome())
                    stopAnimation(4);
            }
            currentList.paint(g);
        }
        int i = Setting.HEAD_HEIGHT + img_Tab.getHeight() / 3;
        g.setColor(0x5b86bb);
        g.drawLine(0, i, 0, Setting.HEIGHT - 15);
        g.drawLine(Setting.WIDTH - 1, i, Setting.WIDTH - 1, Setting.HEIGHT - 15);
        g.drawLine(0, Setting.HEIGHT - 15 - 1, Setting.WIDTH - 1, Setting.HEIGHT - 15 - 1);
    }

    protected void hideNotify()
    {
        isKeyPressed = false;
        isPointed = false;
        stopAnimation(6);
    }

    protected void keyPressed(int i)
    {
        if(MMIDlet.isKeypad)
        {
            isKeyPressed = true;
            keyCode = i;
            hasPainted = false;
            repaint();
        }
    }

    protected void keyReleased(int i)
    {
        if(MMIDlet.isKeypad && hasPainted)
            isKeyPressed = false;
    }

    protected void keyRepeated(int i)
    {
        if(MMIDlet.isKeypad)
        {
            isKeyPressed = true;
            keyCode = i;
            hasPainted = false;
            repaint();
        }
    }

    protected void pointerDragged(int i, int j)
    {
        if(!MMIDlet.isKeypad)
        {
            if(isPaintFirstPage)
                return;
            x = i;
            y = j;
            isPointed = true;
            boolean flag = false;
            int k = Setting.HEAD_HEIGHT + img_Tab.getHeight() / 3;
            int l = currentList.size();
            if(l > Setting.DISPLAY_ITEM_NUM)
                l = Setting.DISPLAY_ITEM_NUM;
            int i1 = k + (1 + l) * (Setting.ITEM_HEIGHT + 1);
            if(tabNum == 0)
            {
                if(!buddySec.isExpand && !strangerSec.isExpand)
                {
                    if(y > k && y < k + Setting.SELECT_ITEM_FILL_HEIGHT)
                    {

⌨️ 快捷键说明

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