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

📄 mypanel.java

📁 Differential Evolution(JAVA)
💻 JAVA
字号:
package DeApp1.panel;

import java.awt.*;         // Import all classes from the java.awt package
                           // AWT is the Abstract Window Toolkit. The AWT
import java.io.*;



public class MyPanel extends Panel
/***********************************************************
**                                                        **
** Enables the usage of gridbaglayout in panels.          **
**                                                        **
** Authors:            Rainer Storn                       **
**                                                        **
***********************************************************/ 
{

  public MyPanel ()
  /***************************************
  ** Constructor.                       **
  ***************************************/
  {
	 //do nothing
  }


//---------------------------------------------------------
	protected void constrain(Container container,Component component
		,int grid_x,int grid_y,int grid_with,int grid_height,int fill,
		int anchor,double weight_x,double weight_y,int top,int left,
		int bottom,int right)
//---------------------------------------------------------
    /** Unfortunately we can't use the constrain() method defined 
	 in class Screen, so we have to define it here again.
	*/
	/** This method places the component in the container
	grid_x, gird_y		  : the absolute place of the cells in the gridlayout
	grid_width,grid_height: the number of cells which use this component
	fill				  : the direction, where the component become bigger when it is possible.
	anchor				  : the position in its cells (NORTH SOUTH EAST...)
	weight_x,weight_y     : when the window becomes larger, this direction
	top,left,bottom,right : the marge arround the component
	*/
	{
		GridBagConstraints c =new GridBagConstraints();
		c.gridx		=grid_x;
		c.gridy		=grid_y;
		c.gridwidth	=grid_with;
		c.gridheight=grid_height;
		c.fill		=fill;
		c.anchor	=anchor;
		c.weightx	=weight_x;
		c.weighty	=weight_y;
		if (top+bottom+left+right>0)
			c.insets=new Insets(top,left,bottom,right);
		((GridBagLayout)container.getLayout()).setConstraints(component,c);
		container.add(component);
	}
}// End class ControlPanel





⌨️ 快捷键说明

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