添加herobrine

This commit is contained in:
2024-06-27 13:40:35 +08:00
parent b4e168387e
commit 68e975daec
4 changed files with 145 additions and 9 deletions
+15 -9
View File
@@ -11,6 +11,7 @@ import java.sql.SQLException;
import com.msksbr.MainFrm.MainFrm;
import com.msksbr.SQL.Connector;
import com.msksbr.images.EasterEgg;
public class LoginFrm extends javax.swing.JFrame {
private final Connector connector;
@@ -101,16 +102,21 @@ public class LoginFrm extends javax.swing.JFrame {
}
private Boolean isLoginMessageTrue() {
try {
ResultSet resultSet = connector.executeQuery("SELECT * FROM users WHERE username = '" + username + "'");
if (resultSet != null && resultSet.next()) { // 检查结果集是否不为空
if (resultSet.getString("password").equals(password)) {
return true;
}
}
if (username.equals("java") && password.equals("beans")) {
new EasterEgg();
return false;
} catch (SQLException e) {
throw new RuntimeException(e);
} else {
try {
ResultSet resultSet = connector.executeQuery("SELECT * FROM users WHERE username = '" + username + "'");
if (resultSet != null && resultSet.next()) { // 检查结果集是否不为空
if (resultSet.getString("password").equals(password)) {
return true;
}
}
return false;
} catch (SQLException e) {
throw new RuntimeException(e);
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

+89
View File
@@ -0,0 +1,89 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.msksbr.images.EasterEgg">
<grid id="cbd77" binding="contentPane" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="10" left="10" bottom="10" right="10"/>
<constraints>
<xy x="48" y="54" width="436" height="297"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<grid id="94766" layout-manager="FlowLayout" hgap="5" vgap="5" flow-align="1">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<grid id="9538f" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints/>
<properties/>
<border type="none"/>
<children>
<component id="e7465" class="javax.swing.JButton" binding="buttonOK">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Coding!"/>
</properties>
</component>
</children>
</grid>
</children>
</grid>
<grid id="e3588" layout-manager="BorderLayout" hgap="0" vgap="0">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<grid id="3b48b" layout-manager="FlowLayout" hgap="5" vgap="5" flow-align="1">
<constraints border-constraint="South"/>
<properties/>
<border type="none"/>
<children>
<component id="76717" class="javax.swing.JLabel">
<constraints/>
<properties>
<font size="14" style="1"/>
<text value="Coding with JavaBeans!"/>
</properties>
</component>
</children>
</grid>
<grid id="283b1" layout-manager="GridBagLayout">
<constraints border-constraint="Center"/>
<properties/>
<border type="none"/>
<children>
<component id="9b6a4" class="javax.swing.JLabel" binding="imageLable">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<gridbag weightx="0.0" weighty="0.0"/>
</constraints>
<properties>
<text value=""/>
</properties>
</component>
<hspacer id="29912">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
<gridbag weightx="0.0" weighty="0.0"/>
</constraints>
</hspacer>
<vspacer id="5cc54">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
<gridbag weightx="0.0" weighty="0.0"/>
</constraints>
</vspacer>
</children>
</grid>
</children>
</grid>
</children>
</grid>
</form>
+41
View File
@@ -0,0 +1,41 @@
package com.msksbr.images;
import com.msksbr.LoginFrm.ScreenSize;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class EasterEgg extends JDialog {
private JPanel contentPane;
private JButton buttonOK;
private JLabel imageLable;
public EasterEgg() {
setTitle("Easter Egg!");
setContentPane(contentPane);
setModal(true);
getRootPane().setDefaultButton(buttonOK);
imageLable.setIcon(new ImageIcon("src/com/msksbr/images/BuzzBeans.png"));
buttonOK.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
onOK();
}
});
pack();
setResizable(false);
setLocation();
setVisible(true);
}
private void onOK() {
// 在此处添加您的代码
dispose();
}
public void setLocation() {
setLocation(new ScreenSize().width / 2 - getWidth() / 2, new ScreenSize().height / 2 - getHeight() / 2);
}
}