📄 updatecourseinfo.java
字号:
//修改课程信息。在修改课程信息的过程中,可以修改除课程编号外的其它课程信息数据项。
//如果修改专业编号数据项,判断该课程是否已经成为开设的课程,即判断该课程是否存在于课程成绩信息中,
//如果存在,则不允许修改;如果不存在,允许修改。但是新的专业编号必须是专业信息中存在的专业编号,
//同时开课信息和选课信息中的原课程编号作废。
package jin.internalFrame;
import java.awt.*;
import javax.swing.*;
import jin.handler.*;
import jin.view.ButtonsPanel;
public class UpdateCourseInfo extends JInternalFrame
{
private JLabel[] labels;
private JComboBox[] comboBoxs;
private JTextField field;
private ButtonsPanel buttonsPanel;
private JPanel[] panels;
private JDesktopPane desktopPane;
private JFrame frame;
public UpdateCourseInfo(JFrame frame,JDesktopPane desktopPane)
{
super("",true,true,true,true);
this.frame=frame;
this.desktopPane=desktopPane;
labels=new JLabel[3];
field=new JTextField(10);
comboBoxs=new JComboBox[2];
for(int i=0;i<2;i++)
{
comboBoxs[i]=new JComboBox();
}
comboBoxs[1].addItem("请选择");
comboBoxs[1].addItem("课程名称");
comboBoxs[1].addItem("专业编号");
comboBoxs[1].addItem("状态");
buttonsPanel=new ButtonsPanel(1);
buttonsPanel.setTitle(0,"确定");
panels=new JPanel[4];
String titles[]={"请输入要修改的课程的编号","请选择要修改的项 "
};
for(int i=0;i<2;i++)
{
labels[i]=new JLabel(titles[i]);
panels[i]=new JPanel();
panels[i].add(labels[i]);
}
panels[0].add(comboBoxs[0]);
panels[1].add(comboBoxs[1]);
panels[2]=new JPanel();
// panels[2].add(labels[2]);
// panels[2].add(field);
panels[3]=new JPanel();
panels[3].add(buttonsPanel);
this.setLayout(new GridLayout(4,1));
for(int i=0;i<4;i++)
{
add(panels[i]);
}
desktopPane.add(this);
frame.add(desktopPane);
UpdateCourseInfoHandler handler=new UpdateCourseInfoHandler(this);
this.setSize(350,250);
this.setVisible(true);
}
public static void main(String args[])
{
JFrame frame=new JFrame();
JDesktopPane desktopPane=new JDesktopPane();
UpdateCourseInfo app=new UpdateCourseInfo(frame,desktopPane);
frame.setSize(500,500);
frame.setVisible(true);
}
public JTextField getField()
{
return field;
}
public ButtonsPanel getButtonsPanel()
{
return buttonsPanel;
}
public JComboBox getComboBox(int index)
{
return comboBoxs[index];
}
public JComboBox[] getComboBoxs()
{
return comboBoxs;
}
public JPanel getPanel()
{
return panels[2];
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -