controlpanel.java

来自「贪吃蛇游戏java实现,里面的结构较为清晰」· Java 代码 · 共 33 行

JAVA
33
字号
import java.awt.BorderLayout;
import java.awt.FlowLayout;

import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class ControlPanel extends JPanel {
	public static final int WIDTH = 200;
	public static final int HEIGHT = 600;
	JButton apply = new JButton("Apply");
	JButton retry = new JButton("Retry");
	JPanel southPabel=new JPanel();
	JPanel cenPanel=new JPanel(new FlowLayout(FlowLayout.LEFT));
	JLabel level = new JLabel("等级");
	String[] data = { "1", "2", "3", "4", "5"};	
	JComboBox list = new JComboBox(data);
	
	public ControlPanel(){
		southPabel.add(apply);
		southPabel.add(retry);
		cenPanel.add(level);
		cenPanel.add(list);
		this.setSize(WIDTH, HEIGHT);
		this.setLayout(new BorderLayout());
		this.add(southPabel,"South");
		this.add(cenPanel,"Center");
		this.setSize(WIDTH, HEIGHT);
		
	}
}

⌨️ 快捷键说明

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