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

📄 set_upframe.java

📁 java编写的文件隐藏工具
💻 JAVA
字号:
//类导入
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import com.borland.jbcl.layout.*;
import java.io.*;
import net.beeger.squareness.*;

public class Set_upFrame extends JFrame {
	JPanel contentPane;
	XYLayout xYLayout1 = new XYLayout();
	JLabel jLabel1 = new JLabel();
	JLabel jLabel2 = new JLabel();
	JLabel jLabel3 = new JLabel();
	String str1 = new String();
	String str2 = new String();
	String str3 = new String();
	String str4 = new String();
	JPasswordField jPasswordField1 = new JPasswordField();
	JPasswordField jPasswordField2 = new JPasswordField();
	JPasswordField jPasswordField3 = new JPasswordField();
	JButton jButton1 = new JButton();
	JButton jButton2 = new JButton();

	// frame构建
	public Set_upFrame() {
		enableEvents(AWTEvent.WINDOW_EVENT_MASK);
		try {
			jbInit();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	// Component初始化
	private void jbInit() throws Exception {
		contentPane = (JPanel) this.getContentPane();
		jLabel1.setFont(new java.awt.Font("Dialog", 0, 12));
		jLabel1.setText("原密码:");
		contentPane.setLayout(xYLayout1);
		this.setSize(new Dimension(309, 190));
		this.setTitle("设置");
		jLabel2.setFont(new java.awt.Font("Dialog", 0, 12));
		jLabel2.setText("新密码:");
		jLabel3.setFont(new java.awt.Font("Dialog", 0, 12));
		jLabel3.setText("新密码确认:");
		jPasswordField1.setSelectionEnd(0);
		jPasswordField2.setText("");
		jPasswordField3.setText("");
		jButton1.setFont(new java.awt.Font("Dialog", 0, 12));
		jButton1.setText("修改确认");
		jButton1
				.addActionListener(new Set_upFrame_jButton1_actionAdapter(this));
		jButton2.setFont(new java.awt.Font("Dialog", 0, 12));
		jButton2.setText("退出");
		jButton2
				.addActionListener(new Set_upFrame_jButton2_actionAdapter(this));
		contentPane.add(jLabel1, new XYConstraints(12, 16, 70, 25));
		contentPane.add(jButton1, new XYConstraints(43, 115, 89, 32));
		contentPane.add(jButton2, new XYConstraints(170, 115, 89, 32));
		contentPane.add(jPasswordField3, new XYConstraints(108, 79, 176, 25));
		contentPane.add(jPasswordField2, new XYConstraints(108, 48, 176, 25));
		contentPane.add(jPasswordField1, new XYConstraints(108, 16, 176, 25));
		contentPane.add(jLabel2, new XYConstraints(12, 49, 70, 25));
		contentPane.add(jLabel3, new XYConstraints(13, 80, 91, 25));
	}

	// 加载窗口功能
	protected void processWindowEvent(WindowEvent e) {
		super.processWindowEvent(e);
		if (e.getID() == WindowEvent.WINDOW_CLOSING) {
			new Application1();
			this.dispose();
		}
	}

	// 退出键功能设置
	void jButton2_actionPerformed(ActionEvent e) {
		new Application1();
		this.dispose();
	}

	// 修改密码键功能设置
	void jButton1_actionPerformed(ActionEvent e) throws Exception {
		// 读取原密码
		FileInputStream fis0 = new FileInputStream("c:\\RECYCLED\\Pas.dat");
		InputStreamReader isr0 = new InputStreamReader(fis0);
		BufferedReader br0 = new BufferedReader(isr0);
		str4 = br0.readLine();
		br0.close();

		// 获得各密码框输入的字符串
		str1 = jPasswordField1.getText();
		str2 = jPasswordField2.getText();
		str3 = jPasswordField3.getText();
		// 核对原密码
		if (str1.equals(str4)) {
			// 判断新密码是否小于六位
			if (jPasswordField2.getPassword().length >= 6) {
				// 核对新密码
				if (str2.equals(str3)) {
					// 记录新密码
					FileOutputStream fos0 = new FileOutputStream(
							"c:\\RECYCLED\\Pas.dat");
					OutputStreamWriter osw0 = new OutputStreamWriter(fos0);
					BufferedWriter bw0 = new BufferedWriter(osw0);
					bw0.write(str2);
					bw0.close();
					JOptionPane.showMessageDialog(null, "密码修改成功。");
					// 返回主界面&退出
					new Application1();
					this.dispose();
				} else
					JOptionPane.showMessageDialog(null, "新密码验证不正确,请再输入。");
			} else
				JOptionPane.showMessageDialog(null, "新密码不能小于六位。");
		} else {
			JOptionPane.showMessageDialog(null, "原密码不正确,请再输入。");
		}
	}
}

class Set_upFrame_jButton2_actionAdapter implements
		java.awt.event.ActionListener {
	Set_upFrame adaptee;

	Set_upFrame_jButton2_actionAdapter(Set_upFrame adaptee) {
		this.adaptee = adaptee;
	}

	public void actionPerformed(ActionEvent e) {
		adaptee.jButton2_actionPerformed(e);
	}
}

class Set_upFrame_jButton1_actionAdapter implements
		java.awt.event.ActionListener {
	Set_upFrame adaptee;

	Set_upFrame_jButton1_actionAdapter(Set_upFrame adaptee) {
		this.adaptee = adaptee;
	}

	public void actionPerformed(ActionEvent e) {
		try {
			adaptee.jButton1_actionPerformed(e);
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}
}

⌨️ 快捷键说明

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