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

📄 coursemain.java

📁 课程信息维护界面
💻 JAVA
字号:
import java.awt.*;
public class CourseMain extends Frame {
	Label lbCourseID = new Label("课程编号:");
	Label lbCourseName = new Label("课程名称:");
	Label lbCourseType = new Label("课程类别:");
	Label lbCourseHours = new Label("课时数:");
	Label lbCourseOption = new Label("是否选修课:");
	Label lbCourseDescription = new Label("课程简介:");
	TextField tfCourseID = new TextField(10);
	TextField tfCourseName = new TextField(20);
	TextField tfCourseHours = new TextField(4);
	Checkbox cbCourseOption = new Checkbox("是否选修课");
	CheckboxGroup cbgCourseType = new CheckboxGroup();
	Panel paCourseType = new Panel();
	Checkbox cbBasic = new Checkbox("基础课",cbgCourseType,true);
	Checkbox cbMajorBasic = new Checkbox("专业基础课",cbgCourseType,false);
	Checkbox cbMajor = new Checkbox("专业课",cbgCourseType,false);
	Panel btnPanel = new Panel(new FlowLayout(FlowLayout.CENTER,30,0));
	Button b1 = new Button("保存");
	Button b2 = new Button("取消");
	TextArea taCourseDescription = new TextArea();
	public CourseMain(){
	  setLayout(new GridBagLayout());
	  btnPanel.add(b1);
	  btnPanel.add(b2);
	  //设置CourseID
	  GridBagConstraints gbclbCourseID = new GridBagConstraints(0,0,1,1,0,0,GridBagConstraints.WEST,
	  GridBagConstraints.NONE,new Insets(5,5,5,5),0,0);
	  add(lbCourseID,gbclbCourseID);
	  GridBagConstraints gbctfCourseID = new GridBagConstraints(1,0,1,1,0,0,GridBagConstraints.WEST,
	  GridBagConstraints.NONE,new Insets(5,5,5,5),0,0);
	  add(tfCourseID,gbctfCourseID);
	  
	  //设置CourseHours
	  GridBagConstraints gbclbCourseHours = new GridBagConstraints(2,0,1,1,0,0,GridBagConstraints.WEST,
	  GridBagConstraints.NONE,new Insets(5,5,5,5),0,0);
	  add(lbCourseHours,gbclbCourseHours);
	  GridBagConstraints gbctfCourseHours = new GridBagConstraints(3,0,1,1,0,0,GridBagConstraints.WEST,
	  GridBagConstraints.NONE,new Insets(5,5,5,5),0,0);
	  add(tfCourseHours,gbctfCourseHours);
	  
	  //设置CourseName
	  GridBagConstraints gbclbCourseName = new GridBagConstraints(0,1,1,1,0,0,GridBagConstraints.WEST,
	  GridBagConstraints.HORIZONTAL,new Insets(5,5,5,5),0,0);
	  add(lbCourseName,gbclbCourseName);
	  GridBagConstraints gbctfCourseName = new GridBagConstraints(1,1,1,1,0,0,GridBagConstraints.WEST,
	  GridBagConstraints.HORIZONTAL,new Insets(5,5,5,5),0,0);
	  add(tfCourseName,gbctfCourseName);
	  
	  //设置CourseOption
//	  GridBagConstraints gbclbCourseOption = new GridBagConstraints(2,1,2,1,0,0,GridBagConstraints.WEST,
//	  GridBagConstraints.NONE,new Insets(5,5,5,5),0,0);
//	  add(lbCourseOption,gbclbCourseOption);
	  GridBagConstraints gbccbCourseOption = new GridBagConstraints(3,1,2,1,0,0,GridBagConstraints.WEST,
	  GridBagConstraints.HORIZONTAL,new Insets(5,5,5,5),0,0);
	  add(cbCourseOption,gbccbCourseOption);
	  
	  //设置CourseType
	  GridBagConstraints gbclbCourseType = new GridBagConstraints(0,2,1,1,0,0,GridBagConstraints.WEST,
	  GridBagConstraints.HORIZONTAL,new Insets(5,5,5,5),0,0);
	  add(lbCourseType,gbclbCourseType);
	  paCourseType.add(cbBasic);
	  paCourseType.add(cbMajorBasic);
	  paCourseType.add(cbMajor);
	  GridBagConstraints gbcpaCourseType = new GridBagConstraints(1,2,2,1,0,0,GridBagConstraints.WEST,
	  GridBagConstraints.NONE,new Insets(5,5,5,5),0,0);
	  add(paCourseType,gbcpaCourseType);
 	  
	  //设置CourseDescrption
	  GridBagConstraints gbclbCourseDescription = new GridBagConstraints(0,3,1,1,0,0,GridBagConstraints.NORTHWEST,
	  GridBagConstraints.HORIZONTAL,new Insets(5,5,5,5),0,0);
	  add(lbCourseDescription,gbclbCourseDescription);
	  GridBagConstraints gbctaCourseDescription = new GridBagConstraints(1,3,3,1,0,0,GridBagConstraints.CENTER,
	  GridBagConstraints.BOTH,new Insets(5,5,5,5),0,0);
	  add(taCourseDescription,gbctaCourseDescription);
	  
	  //设置btnPanel
	  GridBagConstraints gbcBtnPanel = new GridBagConstraints(0,4,4,1,0,0,GridBagConstraints.CENTER,
	  GridBagConstraints.BOTH,new Insets(5,5,5,5),0,0);
	  add(btnPanel,gbcBtnPanel);
    }
	public static void main(String[] args) {
		CourseMain f = new CourseMain();
		f.pack();
		f.setLocation(100,100);
		f.setVisible(true);
	}	
}

⌨️ 快捷键说明

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