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

📄 student.java

📁 在本系统中
💻 JAVA
字号:


package jin.student;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

import jin.handler.*;


//查询开课信息  查询本人的选修课信息  添加选课信息  删除选课信息  按照课程编号查询自己在该门课程中的考试成绩
public class Student extends JInternalFrame
{
	private JDesktopPane desktopPane;
	private JFrame frame;	
	private String id;
	
	//private JPanel imagePanel;
	//private JLabel center;
	private JLabel stateLabel;
	//private Icon icon;
	private JToolBar toorBar;
	private JPanel north;
	private JPanel south;
	
	private JMenuItem addItem;	
	private JMenuItem delItem;
	private JMenuItem[] searchItems;

	public Student(JFrame frame,JDesktopPane desktopPane,String id)
	{
		super("",true,true,true,true);
		this.frame=frame;
		this.desktopPane=desktopPane;	
		this.id=id;	
		frame.setTitle("学生功能界面");	;
		
		frame.setJMenuBar(createMenuBar());
		//add(imagePanel);
		
		toorBar=createToolBar();
		north=new JPanel(new GridLayout(1,10));
		north.add(toorBar);
		
		stateLabel=new JLabel("状态栏");
		south=new JPanel();
		south.add(stateLabel);
		south.setBorder(BorderFactory.createRaisedBevelBorder());
		south.setBorder(BorderFactory.createLineBorder(Color.red));
		
		frame.add(north,BorderLayout.NORTH);
		frame.add(south,BorderLayout.SOUTH);
	
		
		desktopPane.add(this);
		frame.add(desktopPane);	
		
		StudentHandler handler=new StudentHandler(this,id);
		this.setSize(450,440);
		//this.setVisible(true);
	}	
	
	public JFrame getFrame()
	{
		return this.frame;
	}
	
	public JDesktopPane getDesktopPane()
	{
		return this.desktopPane;
	}
	
	public JToolBar createToolBar()
	{
		JToolBar toolBar=new JToolBar();
		
		ImageIcon[] icons=new ImageIcon[3];
		JButton[] buttons=new JButton[3];
		
		String titles[]={"小图标\\new.png","小图标\\open.png","小图标\\save.png"
		};
		String captions[]={"New File(Ctrl+N)","Open(Ctrl+O)","Save(Ctrl+S)"
		};
		for(int i=0;i<3;i++)
		{
			icons[i]=new ImageIcon(titles[i]);
			buttons[i]=new JButton(icons[i]);
			buttons[i].setToolTipText(captions[i]);
			toolBar.add(buttons[i]);
		}
		
		return toolBar;
	}
	
	public JMenuBar createMenuBar()
	{
		JMenuBar menuBar=new JMenuBar();		
		
		
		JMenu addInfo=new JMenu("添加数据");		
			
		addItem=new JMenuItem("添加选课信息");		
		addInfo.add(addItem);			
		menuBar.add(addInfo);
		
		
		JMenu delInfo=new JMenu("删除数据");		
	
		delItem=new JMenuItem("删除选课信息");		
		delInfo.add(delItem);			
		menuBar.add(delInfo);
		
		
		
		JMenu searchInfo=new JMenu("查询数据");		
		String serchStr[]={"查询开课信息","查询本人的选修课信息","按照课程编号查询一门","查询所有课程的考试成绩"
		};				
		searchItems=new JMenuItem[4];
		
		JMenu searchCourInfo=new JMenu("查询成绩");	
		searchInfo.add(searchCourInfo);
			
		for(int i=0;i<4;i++)
		{
			searchItems[i]=new JMenuItem(serchStr[i]);
			
			if(i<=1)
			{
				searchInfo.add(searchItems[i]);					
			}
			
			else
			{
				searchCourInfo.add(searchItems[i]);
			}
					
		}
			
		menuBar.add(searchInfo);
		
		return menuBar;
		
	}
	
	public JMenuItem getAddItem()
	{
		return addItem;
	}
	
	public JMenuItem getDelItem()
	{
		return delItem;
	}
	
	public JMenuItem getSearchItem(int index)
	{
		return searchItems[index];
	}	
/*
	public String getID()
	{
		return this.id;
	}
*/

	public static void main(String args[])
	{
		JFrame app=new JFrame();
		JDesktopPane d=new JDesktopPane();
		Student student=new Student(app,d,"001");
		app.setSize(300,300);
		app.setVisible(true);
		app.setLocation(150,100);
	}

}

⌨️ 快捷键说明

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