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

📄 dealpool.java

📁 一个很有用的java程序 对初学者很有用
💻 JAVA
字号:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi 
// Source File Name:   DealPool.java

import java.awt.*;
import java.util.Iterator;
import java.util.Stack;
import javax.swing.JPanel;

class DealPool extends JPanel
{

    private int cardWidth;
    private int cardHeight;
    private int cardSpace;
    public Stack cards;
    Araneid main;

    public DealPool(Araneid araneid)
    {
        cardWidth = 71;
        cardHeight = 96;
        cardSpace = 10;
        cards = new Stack();
        addMouseListener(new DealPoolMouseListener());
        setBackground(Color.yellow);
        main = araneid;
    }

    public void putCard(Card card)
    {
        if(card != null)
        {
            cards.push(card);
            repaint();
        }
    }

    public void paintComponent(Graphics g)
    {
        Graphics2D graphics2d = (Graphics2D)g;
        graphics2d.setColor(main.backgroundcolor);
        graphics2d.fillRect(0, 0, getSize().width, getSize().height);
        Iterator iterator = cards.iterator();
        int i = getWidth() - cardWidth;
        while(iterator.hasNext()) 
        {
            Card card = (Card)iterator.next();
            graphics2d.drawImage(card.getCurrent(), i, 0, this);
            i -= cardSpace;
            int j = 0;
            while(iterator.hasNext()) 
            {
                iterator.next();
                if(++j >= 9)
                    break;
            }
        }
    }

    public void deal()
    {
        Pools apools[] = (Pools[])main.pool;
        for(int i = 0; i < apools.length; i++)
            if(apools[i].getCards().size() <= 0)
                return;

        if(cards.size() > 0)
        {
            for(int j = 0; j < main.pool.length; j++)
            {
                Card card = (Card)cards.pop();
                Pools pools = main.pool[j];
                card.turn2front();
                pools.putCard(card);
                pools.repaint();
            }

            repaint();
        }
    }
}

⌨️ 快捷键说明

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