}
}
cNum.setText(null); cName.setText(null); cTeacher.setText(null); cPoint.setText(null); cRatio.setText(null); cPlace.setText(null);
/**
* 通过给定的文件名获得图像 */
Image getImage(String filename) { }
URLClassLoader urlLoader = (URLClassLoader)this.getClass().
getClassLoader(); URL url = null; Image image = null;
url = urlLoader.findResource(filename);
image = Toolkit.getDefaultToolkit().getImage(url); MediaTracker mediatracker = new MediaTracker(this); try { }
catch (InterruptedException _ex) { }
if (mediatracker.isErrorID(0)) { }
return image;
image = null; image = null;
mediatracker.addImage(image, 0); mediatracker.waitForID(0);
//////////////////////////////////CourseInfoSearchCnum.java/////////////////
import javax.swing.*; import java.awt.*; import java.awt.event.*; /**
* 课程信息管理模块
* 根据课程编号查询课程信息,以供调用者修改或删除 */ public
class
CourseInfoSearchCnum
extends
JDialog
implements
ActionListener{
Container contentPane;
String[] s;
//框架的大小
Dimension faceSize = new Dimension(300, 100); JLabel jLabel1 = new JLabel(); JComboBox selectCnum;
JButton searchInfo = new JButton();
public CourseInfoSearchCnum(JFrame frame) { super(frame, true); this.setResizable(false); try { Init();
}
catch (Exception e) { e.printStackTrace(); }
//设置运行位置,使对话框居中 Dimension
screenSize
Toolkit.getDefaultToolkit().getScreenSize();
this.setLocation( (int) (screenSize.width - 400) / 2 ,
(int) (screenSize.height - 300) / 2 + 45);
}
private void Init() throws Exception { this.setSize(faceSize);
contentPane = this.getContentPane(); contentPane.setLayout(new FlowLayout()); jLabel1.setText(\请输入或者选择课程号:\
jLabel1.setFont(new Font(\ contentPane.add(jLabel1);
CrsBean getId = new CrsBean(); s = getId.getAllId();
selectCnum = new JComboBox(s); selectCnum.setSelectedItem(null); selectCnum.setEditable(true);
selectCnum.setFont(new Font(\ contentPane.add(selectCnum);
searchInfo.setText(\查询\
searchInfo.setFont(new Font(\
contentPane.add(searchInfo); =
}
/**
* 返回选择的学号 */
public String getCnum(){ }
return (String)this.selectCnum.getSelectedItem(); /** * 事件处理 */
public void actionPerformed(ActionEvent e) { }
Object obj = e.getSource(); if (obj == selectCnum) { //退出 this.dispose(); }
else if (obj == searchInfo) { //修改 this.dispose(); } }
selectCnum.addActionListener(this); searchInfo.addActionListener(this);
//////////////////////////////////CourseSearchCname.java//////////////////////
import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.net.*; /**
* 课程信息查询模块
* 根据课程名称查询课程的信息
*/
public class CourseSearchCname extends JFrame implements ActionListener{
Container contentPane;
//框架的大小
Dimension faceSize = new Dimension(300, 100); JLabel jLabel1 = new JLabel();
JTextField cName = new JTextField(8); JButton searchInfo = new JButton();
public CourseSearchCname() { //设置标题
this.setTitle(\按课程名称查询\ this.setResizable(false);
//设置程序图标
this.setIconImage(getImage(\ try { Init();
}
catch (Exception e) { e.printStackTrace(); }
//设置运行位置,使对话框居中 Dimension
screenSize
Toolkit.getDefaultToolkit().getScreenSize();
this.setLocation( (int) (screenSize.width - 400) / 2 ,
(int) (screenSize.height - 300) / 2 + 45);
}
private void Init() throws Exception { this.setSize(faceSize);
contentPane = this.getContentPane(); contentPane.setLayout(new FlowLayout()); jLabel1.setText(\请输入课程名称: \
jLabel1.setFont(new Font(\ contentPane.add(jLabel1); cName.setText(null);
cName.setFont(new Font(\ contentPane.add(cName);
searchInfo.setText(\确定\
searchInfo.setFont(new Font(\ contentPane.add(searchInfo);
searchInfo.addActionListener(this); } /**
* 事件处理
=
}
*/
public void actionPerformed(ActionEvent e) { } /**
* 通过给定的文件名获得图像 */
Image getImage(String filename) { }
URLClassLoader urlLoader = (URLClassLoader)this.getClass().
getClassLoader(); URL url = null; Image image = null;
url = urlLoader.findResource(filename);
image = Toolkit.getDefaultToolkit().getImage(url); MediaTracker mediatracker = new MediaTracker(this); try { }
catch (InterruptedException _ex) { }
if (mediatracker.isErrorID(0)) { }
return image;
image = null; image = null;
mediatracker.addImage(image, 0); mediatracker.waitForID(0); Object obj = e.getSource();
if (obj == searchInfo) { //查询 ResultCourse rC = new ResultCourse(\ }
this.dispose();
//////////////////////////////////CourseSearchCteacher.java//////////////////////
import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.net.*; /**
* 课程信息查询模块
* 根据授课教师查询课程的信息
*/