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

📄 password.java

📁 本系统是基于CORBA实现的选课系统,具有一般选课系统的基本功能(查看学生基本信息,选课退课,查看成绩等),本系统主要是推荐给对刚进行CORBA学习的初学者来说有很大的重要性
💻 JAVA
字号:
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import choose.*;
import org.omg.CosNaming.*;
import org.omg.CosNaming.NamingContextPackage.*;
import org.omg.CORBA.*;

class Password extends JFrame implements ActionListener
{
	private JPanel aPanel = new JPanel();
	private JLabel aLabel;
	private JLabel bLabel;
	private JLabel cLabel;
	private JPasswordField aPasswordField;
	private JPasswordField bPasswordField;
	private JButton Button1;
	private JButton Button2;
	private String id;
	
	public Password(String id)
	{
		this.id = id;
		setTitle("修改密码");
		setupGUI();
	}
	
	private void setupGUI()
	{
		setSize(300,250);
		setLocation(100,50);
		Container ConTen = this.getContentPane();
		
		ConTen.add(aPanel);
		setupPanel();
	}
	
	private void setupPanel()
	{
		aPanel.setLayout(null);
		
		aLabel = new JLabel("输入新密码");
		aLabel.setSize(80,30);
		aLabel.setLocation(30,30);
		aPanel.add(aLabel);
		
		bLabel = new JLabel("确认新密码");
		bLabel.setSize(80,30);
		bLabel.setLocation(30,80);
		aPanel.add(bLabel);
		
		aPasswordField = new JPasswordField();
		aPasswordField.setSize(120,30);
		aPasswordField.setLocation(110,30);
		aPanel.add(aPasswordField);
		
		bPasswordField = new JPasswordField();
		bPasswordField.setSize(120,30);
		bPasswordField.setLocation(110,80);
		aPanel.add(bPasswordField);
		
		cLabel = new JLabel();
		cLabel.setSize(100,30);
		cLabel.setLocation(70,130);
		aPanel.add(cLabel);
		
		Button1 = new JButton("修改");
		Button1.setSize(70,30);
		Button1.setLocation(80,170);
		aPanel.add(Button1);
		Button1.addActionListener(this);
		
		/*Button2 = new JButton("退出");
		Button2.setSize(70,30);
		Button2.setLocation(120,180);
		aPanel.add(Button2);
		Button2.addActionListener(new ActionListener()
		             {
		             	public void actionPerformed(ActionEvent e)
		             	{
		             		Password a = new Password();
		             		a.dispose();
		             	}
		             });*/
	}
	
	public void actionPerformed(ActionEvent e)
	{
		if(e.getSource()==Button1)
		{
			try
		    {
				// 创建和初始化 ORB
				String   defaultargs[]={"-ORBInitialPort","900","-ORBInitialHost","192.168.108.73",}; 
				//String   defaultargs[]={"-ORBInitialPort","2089","-ORBInitialHost","192.168.0.164",};
				
				ORB orb = ORB.init(defaultargs, null);
				// 获取根命名上下文
				org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService");
				NamingContext ncRef = NamingContextHelper.narrow(objRef);
				//解析命名中的对象引用
				NameComponent nc = new NameComponent("choose","Object");
				NameComponent path[] = {nc};
				choose.xuanke ShowRef = xuankeHelper.narrow(ncRef.resolve(path));
				// 调用 Show 服务对象并打印结果
				if(aPasswordField.getText().equals(bPasswordField.getText()))
				{
					ShowRef.updatepasswd(id,aPasswordField.getText());
					cLabel.setText("修改成功!");
				}
				else
				{
					cLabel.setText("输入密码不一致");
				}
				
		     }catch (Exception e1) {
					System.out.println("ERROR : " + e1) ;
					e1.printStackTrace(System.out);
				  }
		}
	}
}

⌨️ 快捷键说明

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