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

📄 fatepanel.java

📁 Massively Multiplayer Space Trading and Combat game. This is an online strategy game, not a 3D space
💻 JAVA
字号:
/*
 * FatePanel.java
 *
 * Copyright (C) 2000 Jason M. Hanley
 * Released under the GNU General Public License (GPL)
 * See license.txt for additional information.
 *
 * Created on December 5, 2000, 2:08 AM
 */

package fate.ui;

import java.awt.*;
import javax.swing.*;

/**
 * Class to replace JPanel in Fate.
 *
 * @author  preylude@s3m.com
 * @version 0.1.0
 */
public class FatePanel extends JPanel {

    ImageIcon theImage;
    
    /** Creates new FatePanel */
    public FatePanel() {
      super();
    
      theImage = new ImageIcon( "bg.gif" );
    }
    
    /** Creates new FatePanel */
    public FatePanel(LayoutManager layout) {
      super(layout);
    
      theImage = new ImageIcon( "bg.gif" );
    }
    
    public void paintComponent(Graphics g)
    {
      super.paintComponent(g);
      int width = getWidth();
      int height = getHeight();
      int iwidth = theImage.getIconWidth();
      int iheight = theImage.getIconWidth();
      java.awt.Color oldColor = g.getColor();
      if (isOpaque())
      {
        g.setColor(getBackground());
        g.fillRect(0, 0, width, height);
      }
      if (theImage != null)
      {
        for( int i = 0; i < width; i += iwidth ) {
            for( int j = 0; j < height; j += iheight ) {
                g.drawImage(theImage.getImage(), i, j, this);
            }
        }
      }
      g.setColor(oldColor);
    }
}

⌨️ 快捷键说明

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