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

📄 addclassinfo.java

📁 在本系统中
💻 JAVA
字号:

package jin.internalFrame;

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


import jin.handler.*;
import jin.view.ButtonsPanel;
 
//输入班级编号、班级名称、专业编号、状态     (表的字段:班级编号、班级名称、专业编号、状态)
public class AddClassInfo extends JInternalFrame 
{
	private JLabel[] labels;	
	private JTextField[] fields;
	private JPanel[] panels;
	private ButtonsPanel buttonsPanel;
	private JComboBox comboBox;
	
	private JDesktopPane desktopPane;
	private JFrame frame;
	
	public AddClassInfo(JFrame frame,JDesktopPane desktopPane)
	{
		super("",true,true,true,true);
		this.frame=frame;
		this.desktopPane=desktopPane;
		
		labels=new JLabel[4];
		fields=new JTextField[3];
		panels=new JPanel[5];
		comboBox=new JComboBox();
		
		setLayout(new GridLayout(5,1));
		
		String titles[]={"班级编号","班级名称","专业编号          ","状态       "
		};
		
		for(int i=0;i<4;i++)
		{
			panels[i]=new JPanel();
			labels[i]=new JLabel(titles[i]);
			panels[i].add(labels[i]);
			
			if(i==2)
			{
				panels[i].add(comboBox);			
			}
			
			else
			{
				if(i==3)
				{
					fields[2]=new JTextField(8);
					panels[i].add(fields[2]);	
				}
				
				else
				{
					fields[i]=new JTextField(8);
					panels[i].add(fields[i]);		
				}		
			}
			
			add(panels[i]);
			
		}
	
		buttonsPanel=new ButtonsPanel(2);		
		
		String str[]={"确定","取消"
		};
		
		buttonsPanel.setTitles(str);
		
		panels[4]=new JPanel();
		panels[4].add(buttonsPanel);
		add(panels[4]);
	
	
		desktopPane.add(this);
		frame.add(desktopPane);	
		
		AddClassInfoHandler handler=new AddClassInfoHandler(this);
		
		this.setSize(450,440);
		this.setVisible(true);
		
		
	}
	

	public static void main(String args[])
	{
		JFrame frame=new JFrame();
	    JDesktopPane desktopPane=new JDesktopPane();
	    AddClassInfo addClassInfo=new AddClassInfo(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 + -