javaSwing日记管理系统

news2024/9/24 11:31:35

一、简介

使用 Java Swing 开发日记管理系统

在今天的博客中,我将向您介绍如何使用 Java Swing 开发一个简单而功能强大的日记管理系统。这个系统将具有登录、注册、找回密码、写日志以及切换主题等功能。我们将使用 MySQL 数据库来存储用户信息和日记内容。

二、技术栈

  • Java Swing:用于构建用户界面
  • MySQL:用于存储用户信息和日记内容
  • JDBC:用于 Java 与数据库的连接
  • SQL:用于数据库操作

三、数据库设计

首先,我们来设计数据库表结构。每个用户将有一张日记表,用于存储他们的日记内容。以下是数据库表的创建语句:

-- 用户表
create table users(
    username varchar(20) primary key,
    displayname varchar(20),
    pwd varchar(30),
    mail varchar(30),
    pwdprotectq int,
    pwdprotecta varchar(50),
    setting varchar(10) default 'summer'
);

-- 日记表示例
create table firstuser(
    date char(10),
    weather varchar(10),
    emotion varchar(20),
    title varchar(50),
    content varchar(5000)
);

四、功能介绍

请添加图片描述

登录

用户可以使用他们的用户名和密码登录系统。我们将验证用户名和密码是否匹配数据库中的记录。
请添加图片描述

注册

新用户可以注册一个账号。他们需要提供用户名、显示名称、密码、邮箱地址以及密码保护问题和答案。
请添加图片描述

找回密码

如果用户忘记了密码,他们可以通过密码保护问题来找回密码。

写日志

用户可以添加新的日记条目。每个日记包括日期、天气、心情、标题和内容。
请添加图片描述

查看日记

请添加图片描述

切换主题

用户可以根据自己的喜好切换系统主题。我们提供了春夏秋冬四种主题,用户可以按照心情或天气对日记进行排序。
请添加图片描述

实现步骤

  1. 连接数据库:使用 JDBC 连接到 MySQL 数据库。
  2. 登录和注册界面:创建登录和注册界面,收集用户信息并验证。
  3. 密码找回界面:允许用户通过密码保护问题找回密码。
  4. 主界面:展示用户的日记列表,并提供写日记和切换主题的功能。
  5. 写日记界面:让用户输入日记内容并保存到数据库。
  6. 切换主题功能:根据用户选择的主题,改变界面的外观和排序方式。

五、部分代码

DateChooser.java

package qifang.li.diaryui;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Frame;
import java.awt.GridLayout;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFormattedTextField;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JSpinner;
import javax.swing.SpinnerNumberModel;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.border.LineBorder;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;

public class DateChooser extends JPanel implements ActionListener, ChangeListener {

	private static final long serialVersionUID = 1L;
	int startYear = 1980;
	int lastYear = 2050;
	int width = 270;
	int height = 200;
	Color backGroundColor = Color.gray;
	Color palletTableColor = Color.white;
	Color todayBackColor = Color.orange;
	Color weekFontColor = Color.blue ;
	Color dateFontColor = Color.black;
	Color weekendFontColor = Color.red ;
	Color controlLineColor = Theme.getMainColor();
	Color controlTextColor = Color.white ;
	Color rbFontColor = Color.white ;
	Color rbBorderColor = Color.red ;
	Color rbButtonColor = Color.pink;
	Color rbBtFontColor = Color.red ;
	JDialog dialog;
	JSpinner yearSpin;
	JSpinner monthSpin;
	JButton[][] daysButton = new JButton[6][7];
	JFormattedTextField jFormattedTextField;//显示当前选择日期的格式化输入框
	Calendar c = getCalendar();
	Calendar cal = Calendar.getInstance();
	int currentDay = cal.get(Calendar.DAY_OF_MONTH);
	
	DateChooser(JFormattedTextField jftf){
		jFormattedTextField = jftf;
		setLayout(new BorderLayout());
		setBorder(new LineBorder(backGroundColor,2));
		setBackground(backGroundColor);
		
		JPanel topYearAndMonth = createYearAndMonthPanal();
		add(topYearAndMonth,BorderLayout.NORTH);
		JPanel centerWeekAndDay = createWeekAndDayPanal();
		add(centerWeekAndDay,BorderLayout.CENTER);
	}
	private JPanel createYearAndMonthPanal() {
		int currentYear = c.get(Calendar.YEAR);
		int currentMonth = c.get(Calendar.MONTH)+1;
		
		JPanel result = new JPanel();
		result.setLayout(new FlowLayout());
		result.setBackground(controlLineColor);
		yearSpin = new JSpinner(new SpinnerNumberModel(currentYear,startYear,lastYear,1));
		yearSpin.setPreferredSize(new Dimension(60,20));
		yearSpin.setName("Year");
		yearSpin.addChangeListener(this);
		result.add(yearSpin);
		JLabel yearLabel = new JLabel("年");
		yearLabel.setForeground(controlTextColor);
		result.add(yearLabel);
		
		monthSpin = new JSpinner(new SpinnerNumberModel(currentMonth,1,12,1));
		monthSpin.setName("Month");
		monthSpin.addChangeListener(this);
		result.add(monthSpin);
		JLabel monthLabel = new JLabel("月");
		monthLabel.setForeground(controlTextColor);
		result.add(monthLabel);	
		return result;
	}
	private JPanel createWeekAndDayPanal() {
		String colname[] = {"日","一","二","三","四","五","六"};
		JPanel result = new JPanel();
		result.setFont(new Font("宋体",Font.PLAIN,12));
		result.setLayout(new GridLayout(7,7));
		result.setBackground(Color.white);
		JLabel cell;
		
		for(int i=0;i<7;i++) {
			cell = new JLabel(colname[i]);
			cell.setHorizontalAlignment(JLabel.CENTER);
			if(i==0||i==6) {
				cell.setForeground(weekendFontColor);
			}else {
				cell.setForeground(weekFontColor);
			}
			result.add(cell);
		}
		int actionCommandld = 0;
		for(int i=0;i<6;i++) {
			for(int j = 0;j<7;j++) {
				JButton numberButton = new JButton();
				numberButton.setBorder(null);
				numberButton.setHorizontalAlignment(SwingConstants.CENTER);
				numberButton.setActionCommand(String.valueOf(actionCommandld));
				numberButton.addActionListener(this);
				numberButton.setBackground(palletTableColor);
				numberButton.setForeground(dateFontColor);
				if(j ==0||j==6) {
					numberButton.setForeground(weekendFontColor);
				}else {
					numberButton.setForeground(dateFontColor);
				}
				daysButton[i][j] = numberButton;
				numberButton.addMouseListener(new MouseAdapter() {
					public void mouseClicked(MouseEvent e) {
						if(e.getClickCount() ==2) {
							closeAndSetDate();
						}
					}
				});
				result.add(numberButton);
				actionCommandld++;
			}						
		}	
		return result;
	}
	
	private JDialog createDialog(Frame owner) {
		JDialog result = new JDialog(owner,"日期时间选择器",true);
		result.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
		result.getContentPane().add(this, BorderLayout.CENTER);
		result.pack();
		result.setSize(width, height);
		return result;
	}
	public void showDateChooser(Point position) {
		Object tmpobj = SwingUtilities.getWindowAncestor(jFormattedTextField);
		if(tmpobj.getClass().isInstance(new JDialog())||tmpobj.getClass().getSuperclass().isInstance(new JDialog())) {
			JDialog ownerdialog = (JDialog)SwingUtilities.getWindowAncestor(jFormattedTextField);
			Frame owner = (Frame)SwingUtilities.getWindowAncestor(ownerdialog);
			if(dialog == null || dialog.getOwner() != owner) {
				dialog = createDialog(owner);
			}
			dialog.setLocation(getAppropriateLocation(owner,position));
		}
		else if(tmpobj.getClass().isInstance(new JFrame())||tmpobj.getClass().getSuperclass().isInstance(new JFrame())) {
			JFrame ownerFrame = (JFrame)SwingUtilities.getWindowAncestor(jFormattedTextField);
			if(dialog == null || dialog.getOwner() != ownerFrame) {
				dialog = createDialog(ownerFrame);
			}
			dialog.setLocation(getAppropriateLocation(ownerFrame,position));
		}
		flushWeekAndDay();
		dialog.setVisible(true);
	}
	Point getAppropriateLocation(Frame owner, Point position) {
		Point result = new Point(position);
		Point p  = owner.getLocation();
		int offsetX = (position.x + width) - (p.x = owner.getWidth());
		int offsetY = (position.y + height) - (p.y + owner.getHeight());
		
		if(offsetX > 0) {
			result.x -= offsetX;
		}
		if(offsetY > 0) {
			result.y -= offsetY;
		}
		return result;
	}
	public void closeAndSetDate() {
		setDate(c.getTime());
		dialog.dispose();
	}	
	private Calendar getCalendar() {
		Calendar result = Calendar.getInstance();
		result.setTime(getDate());
		return result;
	}
	private int getSelectedYear() {
		return ((Integer)yearSpin.getValue()).intValue();
	}
	private int getSelectedMonth() {
		return ((Integer)monthSpin.getValue()).intValue();
	}
	private void dayColorUpdate(boolean isOldDay) {
		int day = c.get(Calendar.DAY_OF_MONTH);
		c.set(Calendar.DAY_OF_MONTH, currentDay);
		int actionCommandld = day -2 + c.get(Calendar.DAY_OF_WEEK);
		int i = actionCommandld / 7;
		int j = actionCommandld % 7;
		if(isOldDay) {
			daysButton[i][j].setForeground(dateFontColor);
		}else {
			daysButton[i][j].setForeground(todayBackColor);
		}
	}
	private void flushWeekAndDay() {
		c.set(Calendar.DAY_OF_MONTH,currentDay);
		int maxDayNo = c.getActualMaximum(Calendar.DAY_OF_MONTH);
		int dayNo = 2 - c.get(Calendar.DAY_OF_WEEK);
		for(int i=0; i<6;i++) {
			for(int j=0;j<7;j++) {
				String s = "";
				if(dayNo >= 1 && dayNo <= maxDayNo) {
					s = String.valueOf(dayNo);					
				}
				daysButton[i][j].setText(s);
				dayNo++;
			}
		}
		dayColorUpdate(false);
	}
	public void setDate(Date date) {
		jFormattedTextField.setText(getDefaultDateFormat().format(date));
	}
	public Date getDate() {
		try {
			String dateString = jFormattedTextField.getText();
			return getDefaultDateFormat().parse(dateString);
		}catch(ParseException e){
			return getNowDate();
		}catch(Exception ee) {
			return getNowDate();
		}
	}
	private static Date getNowDate() {
		return Calendar.getInstance().getTime();
	}
	private static SimpleDateFormat getDefaultDateFormat() {
		return new SimpleDateFormat("yyyy-MM-dd");
	}
	
	@Override
	public void stateChanged(ChangeEvent e) {
		// TODO Auto-generated method stub
		JSpinner source = (JSpinner)e.getSource();
		dayColorUpdate(true);
		if(source.getName().equals("Year")) {
			c.set(Calendar.YEAR, getSelectedYear());
		}
		if(source.getName().equals("Month")) {
			c.set(Calendar.MONDAY, getSelectedMonth()-1);
		}
		flushWeekAndDay();
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		// TODO Auto-generated method stub
		JButton source = (JButton)e.getSource();
		if (source.getText().length() == 0) {
			return;
		}
		dayColorUpdate(true);
		source.setForeground(todayBackColor);
		int newDay = Integer.parseInt(source.getText());
		c.set(Calendar.DAY_OF_MONTH, newDay);
	}
	
	

}

FindPwdUI.java


package qifang.li.diaryui;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;

import javax.swing.Box;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;

public class FindPwdUI {
	private JPanel findPwdJP = new JPanel(){
		private static final long serialVersionUID = 120000L;
		protected void paintComponent(Graphics g) {
        	super.paintComponent(g);
            ImageIcon icon = Theme.getImage();
            // 图片随窗体大小而变化
            g.drawImage(icon.getImage(), 0, 0,getWidth(),getHeight(),this);
        }
	};
	private JTextField userNameField = new JTextField();
	private JPasswordField passwordField1 = new JPasswordField();
	private JPasswordField passwordField2 = new JPasswordField();
	String[] question = new String[] { "你父亲的名字是?", "你母亲的名字是?", "你的小名是?" ,"你最好的朋友是?","你最喜欢的颜色是?"};
	private JComboBox questionSelector = new JComboBox(question);
	private JTextField anwserField = new JTextField();
	private JButton enterBn = new JButton("确定");
	private JButton cancelBn = new JButton("取消");
	
	public FindPwdUI() {
		init();
	}
	
	public void clearFindPedPage() {
		userNameField.setText("");
		passwordField1.setText("");
		passwordField2.setText("");
		anwserField.setText("");
		questionSelector.setSelectedIndex(0);
	}
	
	public void init() {
		GridBagLayout gbLayout = new GridBagLayout(); 
		GridBagConstraints gbCons = new GridBagConstraints();
		findPwdJP.setLayout(gbLayout);
		findPwdJP.setFocusable(false);
		userNameField.addFocusListener(new JTextFieldHintListener(userNameField,"用户名6~20个字符"));
		
		userNameField.setPreferredSize(new Dimension(200,30));
		passwordField1.setPreferredSize(new Dimension(200,30));
		passwordField2.setPreferredSize(new Dimension(200,30));
		questionSelector.setPreferredSize(new Dimension(200,30));
		anwserField.setPreferredSize(new Dimension(200,30));
		
		gbCons.fill = GridBagConstraints.BOTH;
		gbCons.insets = new Insets(10, 50, 5, 10);
		gbCons.weightx = 0;
		gbCons.weighty = 0;
		gbCons.gridx = 0;
		gbCons.gridy = 0;
		gbCons.gridwidth = 1;
		gbCons.gridheight = 1;
		findPwdJP.add(new JLabel("用  户  名:"),gbCons);
		Box nameBox = Box.createHorizontalBox();	
		gbCons.insets = new Insets(10, 0, 5, 50);
		nameBox.add(userNameField);
		gbCons.weightx = 1;
		gbCons.gridx = 1;
		findPwdJP.add(nameBox, gbCons);
		
		gbCons.insets = new Insets(5, 50, 5, 10);
		gbCons.weightx = 0;
		gbCons.gridx = 0;
		gbCons.gridy = 2;
		findPwdJP.add(new JLabel("密保问题:"),gbCons);
		gbCons.insets = new Insets(5, 0, 5, 50);
		gbCons.weightx = 1;
		gbCons.gridwidth = 1;
		gbCons.weightx = 0;
		gbCons.gridx = 1;
		gbCons.gridy = 2;
		findPwdJP.add(questionSelector,gbCons);
		
		gbCons.insets = new Insets(5, 50, 5, 10);
		gbCons.gridwidth = 1;
		gbCons.weightx = 0;
		gbCons.gridx = 0;
		gbCons.gridy = 3;
		findPwdJP.add(new JLabel("问题答案:"),gbCons);
		Box Box6 = Box.createHorizontalBox();	
		gbCons.insets = new Insets(5, 0, 5, 50);
		Box6.add(anwserField);
		gbCons.weightx = 1;
		gbCons.gridx = 1;
		gbCons.gridy = 3;
		findPwdJP.add(Box6, gbCons);
		
		gbCons.insets = new Insets(5, 0, 5, 5);
		gbCons.weightx = 0;
		gbCons.gridx = 1;
		gbCons.gridy = 4;
		gbCons.gridwidth = 1;
		findPwdJP.add(new JLabel("*密码长度8~30个字符,必须同时包含数字、字母、特殊字符"),gbCons);
		
		gbCons.insets = new Insets(5, 50, 5, 10);
		gbCons.weightx = 0;
		gbCons.gridx = 0;
		gbCons.gridy = 5;
		gbCons.gridwidth = 1;
		findPwdJP.add(new JLabel("新  密  码:"),gbCons);		
		Box Box2 = Box.createHorizontalBox();	
		gbCons.insets = new Insets(5, 0, 5, 50);
		Box2.add(passwordField1);
		gbCons.weightx = 1;
		gbCons.gridx = 1;
		gbCons.gridy = 5;
		findPwdJP.add(Box2, gbCons);
		
		gbCons.insets = new Insets(5, 50, 5, 10);
		gbCons.weightx = 0;
		gbCons.gridx = 0;
		gbCons.gridy = 6;
		findPwdJP.add(new JLabel("确认密码:"),gbCons);		
		Box Box3 = Box.createHorizontalBox();	
		gbCons.insets = new Insets(5, 0, 5, 50);
		Box3.add(passwordField2);
		gbCons.weightx = 1;
		gbCons.gridx = 1;
		gbCons.gridy = 6;
		findPwdJP.add(Box3, gbCons);
				
		gbCons.fill = GridBagConstraints.NONE;	
		gbCons.insets = new Insets(5, 50, 5, 10);
		gbCons.weightx = 0;
		gbCons.gridx = 0;
		gbCons.gridy = 7;
		enterBn.setBackground(Theme.getMainColor());
		enterBn.setForeground(Color.white);
		findPwdJP.add(enterBn,gbCons);
		gbCons.anchor = GridBagConstraints.WEST;
		gbCons.insets = new Insets(5, 0, 5, 50);
		gbCons.weightx = 0;
		gbCons.gridx = 1;
		gbCons.gridy = 7;
		cancelBn.setContentAreaFilled(false);
		cancelBn.setForeground(Theme.getMainColor());
		findPwdJP.add(cancelBn,gbCons);
	}
	public JTextField getUserNameField() {
		return userNameField;
	}
	public void setUserNameField(JTextField userNameField) {
		this.userNameField = userNameField;
	}
	public JPasswordField getPasswordField1() {
		return passwordField1;
	}
	public void setPasswordField1(JPasswordField passwordField1) {
		this.passwordField1 = passwordField1;
	}
	public JPasswordField getPasswordField2() {
		return passwordField2;
	}
	public void setPasswordField2(JPasswordField passwordField2) {
		this.passwordField2 = passwordField2;
	}
	public String[] getQuestion() {
		return question;
	}
	public void setQuestion(String[] question) {
		this.question = question;
	}
	public JComboBox getQuestionSelector() {
		return questionSelector;
	}
	public void setQuestionSelector(JComboBox questionSelector) {
		this.questionSelector = questionSelector;
	}
	public JTextField getAnwserField() {
		return anwserField;
	}
	public void setAnwserField(JTextField anwserField) {
		this.anwserField = anwserField;
	}
	public JButton getEnterBn() {
		return enterBn;
	}
	public void setEnterBn(JButton enterBn) {
		this.enterBn = enterBn;
	}
	public JButton getCancelBn() {
		return cancelBn;
	}
	public void setCancelBn(JButton cancelBn) {
		this.cancelBn = cancelBn;
	}
	public void setFindPwdJP(JPanel findPwdJP) {
		this.findPwdJP = findPwdJP;
	}
	public JPanel getFindPwdJP() {
		return findPwdJP;
	}
}

Login.java

package qifang.li.diaryui;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;

public class LoginUI {
	private JPanel loginJP = new JPanel(){
		private static final long serialVersionUID = 2L;
		protected void paintComponent(Graphics g) {
        	super.paintComponent(g);
            ImageIcon icon = Theme.getImage();
            // 图片随窗体大小而变化
            g.drawImage(icon.getImage(), 0, 0,getWidth(),getHeight(),this);
        }
	};
	private JTextField userNameField = new JTextField();
	private JPasswordField passwordField = new JPasswordField();
	private JButton loginBn = new JButton("登录");
	private JButton signUpBn = new JButton("注册");
	private JButton findBn = new JButton("找回密码");

	public LoginUI() {
		init();
	}
	public void init() {
		userNameField.addFocusListener(new JTextFieldHintListener(userNameField,"用户名6~20个字符"));
		GridBagLayout gbLayout = new GridBagLayout(); 
		GridBagConstraints gbCons = new GridBagConstraints();
		loginJP.setLayout(gbLayout);
		loginJP.setFocusable(false);
		
		gbCons.fill = GridBagConstraints.BOTH;
		gbCons.insets = new Insets(20, 20, 10, 5);
		gbCons.weightx = 0;
		gbCons.weighty = 0;
		gbCons.gridx = 0;
		gbCons.gridy = 0;
		gbCons.gridwidth = 1;
		gbCons.gridheight = 1;
		loginJP.add(new JLabel("用户名:"),gbCons);
				
		Box nameBox = Box.createHorizontalBox();	
		gbCons.insets = new Insets(20, 5, 10, 5);
		userNameField.setOpaque(false);
		nameBox.add(userNameField);
		gbCons.weightx = 1;
		gbCons.gridx = 1;
		loginJP.add(nameBox, gbCons);
		
		gbCons.insets = new Insets(20, 5, 10, 20);
		gbCons.weightx = 0;
		gbCons.gridx = 2;
		gbCons.gridy = 0;	
		signUpBn.setContentAreaFilled(false);
		signUpBn.setForeground(Theme.getMainColor());
		loginJP.add(signUpBn, gbCons);
		
		gbCons.insets = new Insets(10, 20, 10, 5);
		gbCons.gridx = 0;
		gbCons.gridy = 1;
		loginJP.add(new JLabel("密    码:"),gbCons);
		
		Box pwdBox = Box.createHorizontalBox();
		gbCons.insets = new Insets(10, 5, 10, 5);
		passwordField.setOpaque(false);
		pwdBox.add(passwordField);
		gbCons.weightx = 1;
		gbCons.gridx = 1;
		gbCons.gridy = 1;		
		loginJP.add(pwdBox, gbCons);
		
		gbCons.insets = new Insets(10, 5, 10, 20);
		gbCons.weightx = 0;
		gbCons.gridx = 2;
		gbCons.gridy = 1;	
		findBn.setContentAreaFilled(false);
		findBn.setForeground(Theme.getMainColor());
		loginJP.add(findBn, gbCons);
		
		gbCons.insets = new Insets(10, 5, 0, 5);
		gbCons.weightx = 0;
		gbCons.weighty = 0;
		gbCons.gridx = 1;
		gbCons.gridy = 2;		
		loginBn.setBackground(Theme.getMainColor());
		loginBn.setForeground(Color.white);
		loginJP.add(loginBn, gbCons);		
		
		userNameField.addMouseListener(new MouseFieldListener());
		passwordField.addMouseListener(new MouseFieldListener());
	}
	
	class MouseFieldListener extends MouseAdapter{
		@Override
		public void mouseExited(MouseEvent e) {// 鼠标退出组件
			((JTextField)e.getSource()).setBorder(BorderFactory.createLineBorder(Color.white));
			
		}
		@Override
		public void mouseEntered(MouseEvent e) {// 鼠标进入组件
			((JTextField)e.getSource()).setBorder(BorderFactory.createLineBorder(Theme.getMainColor()));
		}
	}
	
	
	public JPanel getLoginJP() {
		return loginJP;
	}
	public JButton getloginBn() {
		return loginBn;
	}
	public JButton getSignUpBn() {
		return signUpBn;
	}
	public JButton getFindBn() {
		return findBn;
	}
	public JTextField getUserNameField() {
		return userNameField;
	}
	public JTextField getPasswordField() {
		return passwordField;
	}	
	
}

六、联系与交流

q:969060742  sql 、 完整代码、程序资源

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1534254.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

Springboot集成shiro框架

前言 以前的项目代码&#xff0c;整理记录一下。 一、什么是shiro 官方&#xff1a;Shiro是一个功能强大且易于使用的Java安全框架&#xff0c;可以运行在JavaSE和JavaEE项目中&#xff0c;可执行身份验证、授权、加密和会话管理。 二、Shiro核心组件 1、UsernamePasswordT…

面试真经(运维工程师)

1.熟悉的排序算法有哪些&#xff0c;它们的时间空间复杂度如何? 排序算法主要分为内部排序和外部排序。内部排序指的是数据记录在内存中进行排序&#xff0c;而外部排序则适用于排序的数据量很大&#xff0c;一次不能容纳全部排序记录的情况&#xff0c;需要在排序过程中访问…

【爬虫】专栏文章索引

为了方便 快速定位 和 便于文章间的相互引用等 作为一个快速准确的导航工具 爬虫 目录&#xff1a; &#xff08;一&#xff09;web自动化和接口自动化 &#xff08;二&#xff09;实战-爬取Boss直聘信息数据

为什么物联网网关需要边缘计算能力?边缘计算应用场景有哪些?

【前言】本篇为物联网硬件系列学习笔记&#xff0c;分享学习&#xff0c;欢迎评论区交流~ 什么是边缘计算&#xff1f; 边缘计算&#xff08;Edge Computing&#xff09;是一种分布式计算范式&#xff0c;旨在将计算和数据存储功能放置在接近数据源或终端设备的边缘位置&#…

一代大神跌落神坛——Java炸了!

曾经它是只手遮天的一大计算机语言.......可现如今&#xff0c;腹背受敌、大势已去&#xff0c;一代神话跌落神坛&#xff01; Java薪水20k降至15k难掩颓势&#xff0c;事业编3k升至3500尽显嫡道风范&#xff01;嫡嫡道道、嫡嫡道道~ 没错&#xff0c;就是它&#xff01;Java…

【C语言】模拟实现 atoi

文章目录 atoi()函数模拟实现思路分析代码呈现 atoi()函数 通过上述cplusplus和MSDN对atoi函数的介绍我们可以得出以下几个关键点 库函数&#xff1a; <stdlib.h>形参&#xff1a;const char * str返回值&#xff1a; int作用&#xff1a;atoi函数是将一个字符串转化成一…

运维篇SHELL脚本实战案例

统计出每个IP的访问量有多少&#xff1f; 检查是否提供了日志文件的路径作为参数。使用awk从日志文件的每行中提取第一个字段&#xff08;假设这是IP地址&#xff09;。使用sort对提取的IP地址进行排序。使用uniq -c统计每个唯一IP地址的出现次数。最后&#xff0c;使用sort -…

Python模块-基础知识

Python模块-基础知识 1.模块分类&#xff1a; &#xff08;1&#xff09;自定义模块&#xff1a; 如果你自己写一个py文件&#xff0c;在文件内写入一堆函数&#xff0c;则它被称为自定义模块&#xff0c;即使用python编写的.py文件 &#xff08;2&#xff09;第三方模块&…

从0到1:Java构建高并发、高可用分布式系统的实战经验分享

文章目录 引言基础架构选择与设计微服务架构分布式储存与计算 高并发处理策略异步处理与消息队列并发控制与资源隔离 高可用性设计与故障恢复冗余与集群化容错与自我修复监控与运维自动化 引言 随着互联网业务的快速发展和技术迭代升级&#xff0c;作为Java架构师&#xff0c;…

springboot企业级抽奖项目业务一(登录模块)

开发流程 该业务基于rouyi生成好了mapper和service的代码&#xff0c;现在需要在controller层写接口 实际操作流程&#xff1a; 看接口文档一>controller里定义函数一>看给出的工具类一>补全controller里的函数一>运行测试 接口文档 在登录模块有登录和登出方…

虚拟内存页表和内存保护

前言 大家好我是jiantaoyab&#xff0c;这是我所总结作为学习的笔记第21篇&#xff0c;在这里分享给大家&#xff0c;这篇文章讲虚拟内存和内存之间的页表和内存安全问题。 虚拟内存 前面的文章提到过&#xff0c;程序装载到内存的过程。可以知道&#xff0c;程序并不直接访…

爬虫实战-Python爬取百度当天热搜内容

爬虫实战-Python爬取百度当天热搜内容 学习建议学习目标预期内容目标分解热搜地址热搜标题热搜简介热搜指数小总结 代码实现总结 学习建议 本文仅用于学习使用&#xff0c;不做他用&#xff1b;本文仅获取页面的内容&#xff0c;作为学习和对Python知识的了解&#xff0c;不会…

如何使用Net2FTP+cpolar搭建专属文件共享站点并实现无公网IP远程访问——“cpolar内网穿透”

文章目录 1.前言2. Net2FTP网站搭建2.1. Net2FTP下载和安装2.2. Net2FTP网页测试 3. cpolar内网穿透3.1.Cpolar云端设置3.2.Cpolar本地设置 4.公网访问测试5.结语 1.前言 文件传输可以说是互联网最主要的应用之一&#xff0c;特别是智能设备的大面积使用&#xff0c;无论是个人…

MySQL高级学习笔记

1、MySQL架构组成 1.1 高级MySQL介绍 什么是DBA&#xff1f; 数据库管理员&#xff0c;英文是Database Administrator&#xff0c;简称DBA&#xff1b; 百度百科介绍 数据库管理员&#xff08;简称DBA&#xff09;&#xff0c;是从事管理和维护数据库管理系统&#xff08;D…

ISIS骨干网连续性简述

默认情况下&#xff0c; 一、L1路由器是ISIS 普通区域内部路由器&#xff0c;只能与L1和L1-2路由器建立邻接关系&#xff0c;不能与L2路由器建立邻接关系。 二、L2路由器是骨干区域的路由器&#xff0c;L2路由器只能与其他 L2路由器同处一个区域&#xff0c;可与本区域的L2路由…

分布式系统的基本特性

一般&#xff0c;分布式系统需要支持以下特性&#xff1a; 资源共享 开放性 并发性 可伸缩性 容错性 透明性 下面分别讨论。 容易理解的 资源共享 一旦授权&#xff0c;可以访问环境中的任何资源。 资源&#xff1a;包括硬件(e.g. printer, scanner, camera)、软件&a…

MYSQL 同步到ES 如何设计架构保持一致性

简单使用某个组件很容易&#xff0c;但是一旦要搬到生产上就要考虑各种各样的异常&#xff0c;保证你方案的可靠性&#xff0c;可恢复性就是我们需要思考的问题。今天来聊聊我们部门在 MYSQL 同步到ES的方案设计。 在面对复杂条件查询时&#xff0c;MYSQL往往显得力不从心&…

机器视觉学习(六)—— 图像的颜色识别

目录 一、色彩空间 1.1 RGB色彩空间 1.2 HSV色彩空间 1.3 灰度 1.4 CMYK色彩空间 1.5 Lab色彩空间 二、色彩空间转换 三、识别颜色 3.1 识别一种特定的颜色 3.2 识别多种颜色 一、色彩空间 计算机视觉中常用的色彩空间有RGB色彩空间、HSV色彩空间、CMYK色彩空间、La…

windows DCMTK编译使用(qt) 医学图像

由于项目需要生成DICOM格式的图片&#xff0c;需要使用到第三方开源库DCMTK&#xff0c;于是研究了一番&#xff0c;该库是C编写的&#xff0c;DICOM主要用于医疗体系中&#xff0c;除了可以保存图片信息外&#xff0c;还可以储存患者信息&#xff0c;病例信息&#xff0c;医疗…

如何修复WordPress网站媒体库上传文件失败的问题

公司最近推出了一系列新产品&#xff0c;为了更新网站的视频和图片&#xff0c;我们需要将它们上传至网站媒体库。然而&#xff0c;在上传视频时&#xff0c;我们却遇到了一些问题。系统提示说&#xff0c;我们尝试上传的视频文件大小超出了站点的最大上传限制。尽管我们的视频…