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

📄 settingcanvas.java

📁 一款麻将游戏的J2me源代码
💻 JAVA
字号:
// FrontEnd Plus GUI for JAD
// DeCompiled : SettingCanvas.class
   
import javax.microedition.lcdui.*;
import com.nokia.mid.ui.*;
// Referenced classes of package com.joypark.mj13:
//            MJ13MIDlet

public class SettingCanvas extends FullCanvas
{

    private Image m_iSound; 
    private byte m_abtDiscard[];
    private MJ13MIDlet m_MJ13MIDlet;
    private RichRMS m_RichRMS; 
     
    public SettingCanvas(MJ13MIDlet mj13midlet)
    {
        m_iSound = ImgUtil.createImage("/imgs/sound.png");
        m_MJ13MIDlet = mj13midlet;
        m_RichRMS = m_MJ13MIDlet.getRichRMS(); 
         
    }
     
    private static byte[] convertHexToBinary(String s)
        throws Exception
    {
        if(s.length() % 2 != 0)
            throw new Exception("Must be an even number of hex digits");
        byte abyte0[] = new byte[s.length() / 2];
        for(int i = 0; i < abyte0.length; i++)
        {
            String s1 = s.substring(i * 2, i * 2 + 2);
            if(s1.charAt(0) == '-')
                throw new Exception("Invalid hex digit: -");
            int j = 0;
            try
            {
                j = Integer.parseInt(s1, 16);
            }
            catch(NumberFormatException numberformatexception) { }
            abyte0[i] = (byte)j;
        }

        return abyte0;
    }

    public void keyPressed(int i)
    {
        if(i == -3)
        {
              
                 m_MJ13MIDlet.playSound();
                m_MJ13MIDlet.isplaysound = true;
                 
                repaint();
             
        } else
        if(i == -4)
        {
                m_MJ13MIDlet.stopSound();
                m_MJ13MIDlet.isplaysound = false;
                 
                repaint();
            
        } else
        if(i == -6)
        {
            //m_RichRMS.put("SOUND_SWITCH", "" + m_bSwitch);
            //m_RichRMS.save();
            m_MJ13MIDlet.splashEnded();
        }
    }

    public void paint(Graphics g)
    {
        g.setColor(255,255,255);//菜单的背景	
        g.fillRect(0,0,getWidth(),getHeight());	
        
        g.setFont(g.getFont().getFont(32, 5, 16));
        int i = (getWidth() - g.getFont().stringWidth("声音设定")) / 2;
        ImgUtil.drawOutlineString(g, "声音设定", i, 6, 0, 0, 255, 255, 255, 255);
        g.setColor(100, 153, 111);
        g.fillRoundRect(10, 33, 155, 100, 20, 20);
        ImgUtil.drawImage(g, m_iSound, 40, 71);
        g.setColor(0, 102, 0);
        ImgUtil.drawString(g, m_MJ13MIDlet.isplaysound ? "开" : "关", 72, (100 - g.getFont().getHeight()) / 2 + 33);
         g.setFont(Font.getFont(Font.FACE_SYSTEM,Font.STYLE_PLAIN ,Font.SIZE_SMALL)); 
         g.setColor(0,0,0);
         g.drawString("返回",3, 190,0);
    
    }
}

⌨️ 快捷键说明

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