📄 delcourseinfo.java
字号:
//删除课程信息。在删除课程信息的过程中,需要判断该课程是否已经存在于课程成绩信息,
//且属于没有完成的状态。如果存在且为未完成状态,则不允许删除;如果存在且为完成状态,允许删除;
//如果不存在,允许删除,同时删除开课信息和选课信息中的该课程信息。
package jin.internalFrame;
import java.awt.*;
import javax.swing.*;
import jin.handler.*;
import jin.view.ButtonsPanel;
public class DelCourseInfo extends JInternalFrame
{
private JLabel[] labels;
private JComboBox comboBox;
private JTextField[] fields;
private ButtonsPanel buttonsPanel;
private JPanel[] panels;
private JDesktopPane desktopPane;
private JFrame frame;
public DelCourseInfo(JFrame frame,JDesktopPane desktopPane)
{
super("",true,true,true,true);
this.frame=frame;
this.desktopPane=desktopPane;
labels=new JLabel[4];
fields=new JTextField[3];
comboBox=new JComboBox();
comboBox.addItem("请选择");
String str[]={"选择删除课程的编号","课程名称 ","专业编号 ","状态 "
};
for(int i=0;i<4;i++)
{
labels[i]=new JLabel(str[i]);
}
for(int i=0;i<3;i++)
{
fields[i]=new JTextField(8);
}
buttonsPanel=new ButtonsPanel(1);
buttonsPanel.setTitle(0,"确定");
panels=new JPanel[5];
for(int i=0;i<4;i++)
{
panels[i]=new JPanel();
panels[i].add(labels[i]);
}
panels[0].add(comboBox);
panels[1].add(fields[0]);
panels[2].add(fields[1]);
panels[3].add(fields[2]);
panels[4]=new JPanel();
panels[4].add(buttonsPanel);
this.setLayout(new GridLayout(5,1));
for(int i=0;i<5;i++)
{
add(panels[i]);
}
desktopPane.add(this);
frame.add(desktopPane);
DelCourseInfoHandler handler=new DelCourseInfoHandler(this);
this.setSize(350,250);
this.setVisible(true);
}
public static void main(String args[])
{
JFrame frame=new JFrame();
JDesktopPane desktopPane=new JDesktopPane();
DelCourseInfo app=new DelCourseInfo(frame,desktopPane);
frame.setSize(500,500);
frame.setVisible(true);
}
public JTextField getField(int index)
{
return fields[index];
}
public JTextField[] getFields()
{
return fields;
}
public ButtonsPanel getButtonsPanel()
{
return buttonsPanel;
}
public JComboBox getComboBox()
{
return comboBox;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -