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

📄 graphicspanel.java

📁 利用JAVA实现的利用进化算法对人口增长进行仿真的源码
💻 JAVA
字号:
/*
 * graphicsPanel.java
 *
 * Created on 12 October 2006, 07:44
 */

package wpc;
import java.awt.Graphics;
/**
 *
 * @author  User
 */
public class GraphicsPanel extends javax.swing.JPanel {
    wpc.data.World world;
    MainFrame mainFrame;
    boolean changed;
    /** Creates new form graphicsPanel */
    public GraphicsPanel(MainFrame mainFrame) {
        this.mainFrame = mainFrame;
        this.world = mainFrame.getWorld();
        initComponents();
        changed = true;
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
    private void initComponents() {

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 400, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 300, Short.MAX_VALUE)
        );
    }// </editor-fold>//GEN-END:initComponents
    
      
    public void paintComponent(Graphics g){
       //super.paintComponent(g);
       if(mainFrame.getCreated()){      
          if(mainFrame.getStarted()){
              world.draw(g);               
          }
       }
    }
    
    public void update(){
        repaint();
    }
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    // End of variables declaration//GEN-END:variables
    
}

⌨️ 快捷键说明

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