First commit
3
.idea/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# 默认忽略的文件
|
||||
/shelf/
|
||||
/workspace.xml
|
5
.idea/JavaProjects_IDEA.eml
generated
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<component inherit-compiler-output="true" jdk="18" jdk_type="JavaSDK">
|
||||
<exclude-output/>
|
||||
<contentEntry url="file://$MODULE_DIR$"/>
|
||||
</component>
|
2
.idea/JavaProjects_IDEA.iml
generated
Normal file
@@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module classpath="eclipse" classpath-dir="$MODULE_DIR$" type="JAVA_MODULE" version="4" />
|
16
.idea/libraries/MigLayout.xml
generated
Normal file
@@ -0,0 +1,16 @@
|
||||
<component name="libraryTable">
|
||||
<library name="MigLayout">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/miglayout-swing.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/lib/miglayout-core.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$PROJECT_DIR$/lib/miglayout-swing-javadoc.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/lib/miglayout-core-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/miglayout-swing-sources.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/lib/miglayout-core-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
6
.idea/misc.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
11
.idea/modules.xml
generated
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/Airline Reservation System/Airline Reservation System.iml" filepath="$PROJECT_DIR$/Airline Reservation System/Airline Reservation System.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/JavaDemo_01/JavaDemo_01.iml" filepath="$PROJECT_DIR$/JavaDemo_01/JavaDemo_01.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/JavaProjects_IDEA.iml" filepath="$PROJECT_DIR$/.idea/JavaProjects_IDEA.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/JavaDemo_02/com.qing.test/com.qing.test.iml" filepath="$PROJECT_DIR$/JavaDemo_02/com.qing.test/com.qing.test.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
127
.idea/uiDesigner.xml
generated
Normal file
@@ -0,0 +1,127 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Palette2">
|
||||
<group name="Swing">
|
||||
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||
</item>
|
||||
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||
<initial-values>
|
||||
<property name="text" value="Button" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="RadioButton" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="CheckBox" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="Label" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||
<preferred-size width="-1" height="20" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||
</item>
|
||||
</group>
|
||||
</component>
|
||||
<component name="uidesigner-configuration">
|
||||
<option name="DEFAULT_LAYOUT_MANAGER" value="FlowLayout" />
|
||||
</component>
|
||||
</project>
|
7
.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/Airline Reservation System" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/Airline Reservation System1" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
12
Airline Reservation System/Airline Reservation System.iml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="18" jdkType="JavaSDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="mysql-connector-java-8.0.15 (3)" level="application" />
|
||||
</component>
|
||||
</module>
|
BIN
Airline Reservation System/lib/mysql-connector-java-8.0.15.jar
Normal file
@@ -0,0 +1,98 @@
|
||||
package xjdx.rjxy.airplane.dao;
|
||||
|
||||
import xjdx.rjxy.airplane.util.JdbcUtil;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.sql.*;
|
||||
|
||||
public class UserDao {
|
||||
|
||||
public static boolean SelectUser(String username, String password) {
|
||||
Connection conn = null;
|
||||
Statement stmt = null;
|
||||
ResultSet rs = null;
|
||||
boolean f;
|
||||
try {
|
||||
conn = JdbcUtil.getConnection();
|
||||
String sql = "SELECT * from user where username='" + username + "'and password='" + password + "';";
|
||||
stmt = conn.createStatement();
|
||||
rs = stmt.executeQuery(sql);
|
||||
if (rs.next()) {
|
||||
f = true;
|
||||
JOptionPane.showMessageDialog(null, "登录成功!", "提示", JOptionPane.INFORMATION_MESSAGE);
|
||||
} else {
|
||||
f = false;
|
||||
JOptionPane.showMessageDialog(null, "密码错误或者账户未注册!", "错误", JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException();
|
||||
} finally {
|
||||
JdbcUtil.close(rs, stmt, conn);
|
||||
}
|
||||
return f;
|
||||
}
|
||||
|
||||
public static boolean insertUser(String username, String password) {
|
||||
Connection conn = null;
|
||||
PreparedStatement pstmt = null;
|
||||
Statement stmt = null;
|
||||
ResultSet rs = null;
|
||||
boolean f2 = false;
|
||||
try {
|
||||
conn = JdbcUtil.getConnection();
|
||||
String sql1 = "select * from user;";
|
||||
stmt = conn.createStatement();
|
||||
rs = stmt.executeQuery(sql1);
|
||||
while (rs.next()) {
|
||||
String oldusername = rs.getString("username");
|
||||
String oldpassword = rs.getString("password");
|
||||
if (!oldusername.equals(username)) {
|
||||
String sql = "insert into user(username,password) values (?,?)";
|
||||
pstmt = conn.prepareStatement(sql);
|
||||
pstmt.setString(1, username);
|
||||
pstmt.setString(2, password);
|
||||
pstmt.executeUpdate();
|
||||
f2 = true;
|
||||
} else {
|
||||
JOptionPane.showMessageDialog(null, "用户名重复,请重新注册!", "提示", JOptionPane.ERROR_MESSAGE);
|
||||
f2 = false;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException();
|
||||
} finally {
|
||||
JdbcUtil.close(pstmt, conn);
|
||||
JdbcUtil.close(rs, stmt, conn);
|
||||
}
|
||||
return f2;
|
||||
}
|
||||
|
||||
//返回当前登录的用户名
|
||||
public static String currentUser(String username, String password) {
|
||||
Connection conn = null;
|
||||
Statement stmt = null;
|
||||
ResultSet rs = null;
|
||||
boolean f;
|
||||
try {
|
||||
conn = JdbcUtil.getConnection();
|
||||
String sql = "SELECT * from user where username='" + username + "'and password='" + password + "';";
|
||||
stmt = conn.createStatement();
|
||||
rs = stmt.executeQuery(sql);
|
||||
if (rs.next()) {
|
||||
return username;
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
} finally {
|
||||
JdbcUtil.close(rs, stmt, conn);
|
||||
}
|
||||
return username;
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,4 @@
|
||||
package xjdx.rjxy.airplane.dao;
|
||||
|
||||
public interface UserDaoImpl {
|
||||
}
|
@@ -0,0 +1,53 @@
|
||||
package xjdx.rjxy.airplane.service;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
import static xjdx.rjxy.airplane.dao.UserDao.SelectUser;
|
||||
import static xjdx.rjxy.airplane.dao.UserDao.insertUser;
|
||||
|
||||
public class UserService {
|
||||
public static boolean UserLogin(String myusername, String mypassword) {
|
||||
boolean flag = false;
|
||||
if (myusername.equals("") || mypassword.equals("")) {
|
||||
JOptionPane.showMessageDialog(null, "用户名或密码为空!", "错误", JOptionPane.ERROR_MESSAGE);
|
||||
flag = false;
|
||||
} else {
|
||||
if (SelectUser(myusername, mypassword)) {
|
||||
flag = true;
|
||||
} else {
|
||||
JOptionPane.showMessageDialog(null, "系统故障,请重试!", "错误", JOptionPane.ERROR_MESSAGE);
|
||||
flag = false;
|
||||
}
|
||||
|
||||
}
|
||||
return flag;
|
||||
|
||||
}
|
||||
|
||||
public static void UserRegister(String newusername, String newpassword1, String newpassword2) {
|
||||
|
||||
if (newusername.equals("") && newpassword1.equals("") && newpassword2.equals("")) {
|
||||
JOptionPane.showMessageDialog(null, "请先填写内容!", "错误", JOptionPane.ERROR_MESSAGE);
|
||||
} else {
|
||||
if (newusername.equals("") || newpassword1.equals("")) {
|
||||
JOptionPane.showMessageDialog(null, "用户名或密码不能为空!", "错误", JOptionPane.ERROR_MESSAGE);
|
||||
} else {
|
||||
if (newpassword2.equals("")) {
|
||||
JOptionPane.showMessageDialog(null, "请确认密码!", "错误", JOptionPane.ERROR_MESSAGE);
|
||||
} else {
|
||||
if ((!newpassword1.equals(newpassword2))) {
|
||||
JOptionPane.showMessageDialog(null, "请确认两次密码是否相同!", "错误", JOptionPane.ERROR_MESSAGE);
|
||||
} else {
|
||||
if (!insertUser(newusername, newpassword1)) {
|
||||
JOptionPane.showMessageDialog(null, "系统出错,注册失败!", "ERROR", JOptionPane.ERROR_MESSAGE);
|
||||
} else {
|
||||
JOptionPane.showMessageDialog(null, "用户注册成功!", "提示", JOptionPane.INFORMATION_MESSAGE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,67 @@
|
||||
package xjdx.rjxy.airplane.util;
|
||||
|
||||
import java.sql.*;
|
||||
|
||||
public class JdbcUtil {
|
||||
private static String url = "jdbc:mysql://localhost:3306/Airline Reservation System?useSSL=false&serverTimezone=GMT";
|
||||
private static String user = "root";
|
||||
private static String password = "1611";
|
||||
|
||||
static {
|
||||
try {
|
||||
Class.forName("com.mysql.cj.jdbc.Driver");
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static Connection getConnection() {
|
||||
try {
|
||||
Connection conn = DriverManager.getConnection(url, user, password);
|
||||
return conn;
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static void close(ResultSet rs, Statement stmt, Connection conn) {
|
||||
if (stmt != null) {
|
||||
try {
|
||||
stmt.close();
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
if (conn != null) {
|
||||
try {
|
||||
conn.close();
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void close(PreparedStatement pstmt, Connection conn) {
|
||||
if (pstmt != null) {
|
||||
try {
|
||||
pstmt.close();
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
if (conn != null) {
|
||||
try {
|
||||
conn.close();
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,129 @@
|
||||
package xjdx.rjxy.airplane.view;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
public class BuyPage extends JFrame implements ActionListener {
|
||||
String cabin[] = {"舱位不限", "经济舱", "公务舱,头等舱"};
|
||||
String number[] = {"1", "2", "3", "4", "5"};
|
||||
String pew[] = {"1A", "1B", "1C", "1D", "2A", "2B", "2C", "2D", "2A", "3B", "3C", "3D", "4A", "4B", "4C", "4D", "5A", "5B", "5C", "5D",};
|
||||
JComboBox<String> seatSelectionBox, airTicketsNumberBox, pewSelectBox;
|
||||
JTextField flightNumberTextField;
|
||||
JButton buyBtn, backBtn;
|
||||
|
||||
private Icon buyBtnIco = new ImageIcon("E:\\JavaProjects_IDEA\\Airline Reservation System\\src\\xjdx\\rjxy\\airplane\\view\\images\\我的购买.png");
|
||||
|
||||
public BuyPage() {
|
||||
super("飞机订票系统 v1.0>>购买机票");
|
||||
//改变按钮样式
|
||||
try {
|
||||
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (InstantiationException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (UnsupportedLookAndFeelException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
//设置ICO图标
|
||||
Image im;
|
||||
ImageIcon ig = new ImageIcon("E:\\JavaProjects_IDEA\\Airline Reservation System\\src\\xjdx\\rjxy\\airplane\\view\\images\\ico.jpg");//设置图标图片
|
||||
im = ig.getImage();
|
||||
setIconImage(im);
|
||||
//设置背景图
|
||||
ImageIcon icon = new ImageIcon("E:\\JavaProjects_IDEA\\Airline Reservation System\\src\\xjdx\\rjxy\\airplane\\view\\images\\airplane2.png");//背景图
|
||||
JLabel label = new JLabel(icon);//标签中加入图片
|
||||
label.setBounds(0, 0, icon.getIconWidth(), icon.getIconHeight());//设置标签位置大小为图片大小
|
||||
getLayeredPane().add(label, Integer.valueOf(Integer.MIN_VALUE));//标签添加到第二层面板
|
||||
//获取顶层容器设为透明
|
||||
JPanel Panel = (JPanel) getContentPane();
|
||||
Panel.setOpaque(false);
|
||||
getContentPane().setLayout(null);
|
||||
|
||||
Font font = new Font("楷体", Font.TYPE1_FONT, 20);
|
||||
|
||||
JLabel seatSelectionLab = new JLabel("舱位选择:");
|
||||
seatSelectionLab.setFont(font);
|
||||
JLabel pewSelectLab = new JLabel("座 位 号:");
|
||||
pewSelectLab.setFont(font);
|
||||
JLabel flightNumberLab = new JLabel("航 班 号:");
|
||||
flightNumberLab.setFont(font);
|
||||
JLabel airTicketsNumberLab = new JLabel("机票数量:");
|
||||
airTicketsNumberLab.setFont(font);
|
||||
|
||||
seatSelectionBox = new JComboBox<>(cabin);
|
||||
pewSelectBox = new JComboBox<>(pew);
|
||||
airTicketsNumberBox = new JComboBox<>(number);
|
||||
flightNumberTextField = new JTextField(23);
|
||||
|
||||
JPanel pan1 = new JPanel();
|
||||
pan1.setBounds(60, 50, 100, 120);
|
||||
pan1.setOpaque(false);
|
||||
pan1.setLayout(new FlowLayout());
|
||||
pan1.add(flightNumberLab);
|
||||
pan1.add(seatSelectionLab);
|
||||
pan1.add(pewSelectLab);
|
||||
pan1.add(airTicketsNumberLab);
|
||||
this.add(pan1);
|
||||
|
||||
JPanel pan2 = new JPanel();
|
||||
pan2.setBounds(160, 50, 150, 90);
|
||||
pan2.setOpaque(false);
|
||||
|
||||
pan2.setLayout(new FlowLayout(0, 5, 7));
|
||||
pan2.add(flightNumberTextField);
|
||||
pan2.add(seatSelectionBox);
|
||||
pan2.add(pewSelectBox);
|
||||
this.add(pan2);
|
||||
|
||||
airTicketsNumberBox.setBounds(165, 145, 50, 20);
|
||||
this.add(airTicketsNumberBox);
|
||||
|
||||
buyBtn = new JButton("购买", buyBtnIco);
|
||||
buyBtn.setBounds(125, 185, 150, 30);
|
||||
buyBtn.setFont(font);
|
||||
buyBtn.setForeground(Color.GREEN);
|
||||
this.add(buyBtn);
|
||||
|
||||
backBtn = new JButton("<<");
|
||||
backBtn.setFont(font);
|
||||
backBtn.setBounds(0, 0, 70, 30);
|
||||
backBtn.setContentAreaFilled(false); //设置按钮透明
|
||||
backBtn.setBorder(null); //取消边框
|
||||
this.add(backBtn);
|
||||
|
||||
|
||||
setBounds(600, 300, 400, 300);
|
||||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
setVisible(true);
|
||||
setResizable(false);
|
||||
setTitle(getTitle());
|
||||
|
||||
buyBtn.addActionListener(this);
|
||||
backBtn.addActionListener(this);
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
new BuyPage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (e.getSource() == backBtn) {
|
||||
this.dispose();
|
||||
new PassengerRegistration();
|
||||
}
|
||||
if (e.getSource() == buyBtn) {
|
||||
int res = JOptionPane.showConfirmDialog(null, "是否确认购买", "提示", JOptionPane.YES_OPTION);
|
||||
if (res == JOptionPane.YES_OPTION) {
|
||||
//确认购票后执行的操作
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,61 @@
|
||||
package xjdx.rjxy.airplane.view;
|
||||
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
|
||||
public class Carousel extends JFrame {
|
||||
MyPanel mp;
|
||||
int index;
|
||||
ImageIcon[] imgs = {
|
||||
new ImageIcon("E:\\JavaProjects_IDEA\\Airline Reservation System\\src\\xjdx\\rjxy\\airplane\\view\\images\\airplaneImages\\1.jpg"),
|
||||
new ImageIcon("E:\\JavaProjects_IDEA\\Airline Reservation System\\src\\xjdx\\rjxy\\airplane\\view\\images\\airplaneImages\\2.jpg"),
|
||||
new ImageIcon("E:\\JavaProjects_IDEA\\Airline Reservation System\\src\\xjdx\\rjxy\\airplane\\view\\images\\airplaneImages\\3.jpg"),
|
||||
new ImageIcon("E:\\JavaProjects_IDEA\\Airline Reservation System\\src\\xjdx\\rjxy\\airplane\\view\\images\\airplaneImages\\4.jpg"),
|
||||
new ImageIcon("E:\\JavaProjects_IDEA\\Airline Reservation System\\src\\xjdx\\rjxy\\airplane\\view\\images\\airplaneImages\\5.jpg"),
|
||||
new ImageIcon("E:\\JavaProjects_IDEA\\Airline Reservation System\\src\\xjdx\\rjxy\\airplane\\view\\images\\airplaneImages\\6.jpg"),
|
||||
new ImageIcon("E:\\JavaProjects_IDEA\\Airline Reservation System\\src\\xjdx\\rjxy\\airplane\\view\\images\\airplaneImages\\7.jpg"),
|
||||
new ImageIcon("E:\\JavaProjects_IDEA\\Airline Reservation System\\src\\xjdx\\rjxy\\airplane\\view\\images\\airplaneImages\\8.jpg"),
|
||||
new ImageIcon("E:\\JavaProjects_IDEA\\Airline Reservation System\\src\\xjdx\\rjxy\\airplane\\view\\images\\airplaneImages\\9.jpg"),
|
||||
new ImageIcon("E:\\JavaProjects_IDEA\\Airline Reservation System\\src\\xjdx\\rjxy\\airplane\\view\\images\\airplaneImages\\10.jpg"),
|
||||
};
|
||||
|
||||
public Carousel() {
|
||||
mp = new MyPanel();
|
||||
//设置ICO图标
|
||||
Image im;
|
||||
ImageIcon ig = new ImageIcon("E:\\JavaProjects_IDEA\\Airline Reservation System\\src\\xjdx\\rjxy\\airplane\\view\\images\\ico.jpg");//设置图标图片
|
||||
im = ig.getImage();
|
||||
setIconImage(im);
|
||||
this.add(mp);
|
||||
// this.setExtendedState(JFrame.MAXIMIZED_BOTH);
|
||||
this.setBounds(300, 150, 1000, 600);
|
||||
this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
||||
this.setTitle("飞机订票系统 v1.0>>飞机展示");
|
||||
this.setVisible(true);
|
||||
Timer timer = new Timer(1000, new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
mp.repaint();
|
||||
}
|
||||
});
|
||||
timer.start();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
new Carousel();
|
||||
}
|
||||
|
||||
class MyPanel extends JPanel {
|
||||
public void paint(Graphics g) {
|
||||
super.paint(g);
|
||||
g.drawImage(imgs[index % imgs.length].getImage(), 0, 0, this);
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,166 @@
|
||||
package xjdx.rjxy.airplane.view;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
public class CustomerServiceInfo extends JFrame implements ActionListener {
|
||||
JButton backBtn, lanBtn, zhangBtn, dongBtn, chengBtn;
|
||||
private Icon lanBtnIco = new ImageIcon("E:\\JavaProjects_IDEA\\Airline Reservation System\\src\\xjdx\\rjxy\\airplane\\view\\images\\头像.jpg");
|
||||
private Icon zhangBtnIco = new ImageIcon("E:\\JavaProjects_IDEA\\Airline Reservation System\\src\\xjdx\\rjxy\\airplane\\view\\images\\张.jpg");
|
||||
private Icon dongBtnIco = new ImageIcon("E:\\JavaProjects_IDEA\\Airline Reservation System\\src\\xjdx\\rjxy\\airplane\\view\\images\\董.jpg");
|
||||
private Icon chengBtnIco = new ImageIcon("E:\\JavaProjects_IDEA\\Airline Reservation System\\src\\xjdx\\rjxy\\airplane\\view\\images\\程.jpg");
|
||||
|
||||
public CustomerServiceInfo() {
|
||||
super("飞机订票系统 v1.0>>客服信息");
|
||||
//改变按钮样式
|
||||
try {
|
||||
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (InstantiationException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (UnsupportedLookAndFeelException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
//设置ICO图标
|
||||
Image im;
|
||||
ImageIcon ig = new ImageIcon("E:\\JavaProjects_IDEA\\Airline Reservation System\\src\\xjdx\\rjxy\\airplane\\view\\images\\ico.jpg");//设置图标图片
|
||||
im = ig.getImage();
|
||||
setIconImage(im);
|
||||
//设置背景图
|
||||
ImageIcon icon = new ImageIcon("E:\\JavaProjects_IDEA\\Airline Reservation System\\src\\xjdx\\rjxy\\airplane\\view\\images\\airplane2.png");//背景图
|
||||
JLabel label = new JLabel(icon);//标签中加入图片
|
||||
label.setBounds(0, 0, icon.getIconWidth(), icon.getIconHeight());//设置标签位置大小为图片大小
|
||||
getLayeredPane().add(label, Integer.valueOf(Integer.MIN_VALUE));//标签添加到第二层面板
|
||||
//获取顶层容器设为透明
|
||||
JPanel Panel = (JPanel) getContentPane();
|
||||
Panel.setOpaque(false);
|
||||
getContentPane().setLayout(null);
|
||||
Font font = new Font("楷体", Font.TYPE1_FONT, 20);
|
||||
|
||||
JLabel label1 = new JLabel("请选择客服:");
|
||||
label1.setFont(font);
|
||||
label1.setBounds(0, 30, 150, 50);
|
||||
this.add(label1);
|
||||
|
||||
lanBtn = new JButton(lanBtnIco);
|
||||
lanBtn.setPreferredSize(new Dimension(100, 100));
|
||||
// lanBtn.setEnabled(false);
|
||||
dongBtn = new JButton(dongBtnIco);
|
||||
dongBtn.setPreferredSize(new Dimension(100, 100));
|
||||
|
||||
zhangBtn = new JButton(zhangBtnIco);
|
||||
zhangBtn.setPreferredSize(new Dimension(100, 100));
|
||||
|
||||
chengBtn = new JButton(chengBtnIco);
|
||||
chengBtn.setPreferredSize(new Dimension(100, 105));
|
||||
|
||||
|
||||
JPanel panel = new JPanel();
|
||||
panel.setBounds(0, 70, 400, 100);
|
||||
panel.setOpaque(false);
|
||||
panel.setLayout(new FlowLayout(0, 0, 8));
|
||||
|
||||
panel.add(dongBtn);
|
||||
panel.add(zhangBtn);
|
||||
panel.add(lanBtn);
|
||||
panel.add(chengBtn);
|
||||
this.add(panel);
|
||||
|
||||
JLabel lanLab = new JLabel("小兰客服");
|
||||
lanLab.setFont(font);
|
||||
lanLab.setForeground(Color.gray);
|
||||
JLabel zhangLab = new JLabel("小张客服");
|
||||
zhangLab.setFont(font);
|
||||
zhangLab.setForeground(Color.green);
|
||||
|
||||
JLabel dongLab = new JLabel("小董客服");
|
||||
dongLab.setFont(font);
|
||||
dongLab.setForeground(Color.green);
|
||||
JLabel chengLab = new JLabel("小程客服");
|
||||
chengLab.setFont(font);
|
||||
chengLab.setForeground(Color.green);
|
||||
|
||||
JPanel panel1 = new JPanel();
|
||||
panel1.setBounds(0, 180, 400, 20);
|
||||
panel1.setOpaque(false);
|
||||
panel1.setLayout(new FlowLayout(0, 14, 0));
|
||||
|
||||
panel1.add(dongLab);
|
||||
panel1.add(zhangLab);
|
||||
panel1.add(lanLab);
|
||||
panel1.add(chengLab);
|
||||
|
||||
this.add(panel1);
|
||||
|
||||
|
||||
backBtn = new JButton("<<");
|
||||
backBtn.setFont(font);
|
||||
backBtn.setBounds(0, 0, 70, 30);
|
||||
backBtn.setContentAreaFilled(false); //设置按钮透明
|
||||
backBtn.setBorder(null); //取消边框
|
||||
this.add(backBtn);
|
||||
|
||||
setBounds(600, 300, 400, 300);
|
||||
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
||||
setVisible(true);
|
||||
setResizable(false);
|
||||
setTitle(getTitle());
|
||||
|
||||
backBtn.addActionListener(this);
|
||||
lanBtn.addActionListener(this);
|
||||
zhangBtn.addActionListener(this);
|
||||
dongBtn.addActionListener(this);
|
||||
chengBtn.addActionListener(this);
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
new CustomerServiceInfo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (e.getSource() == backBtn) {
|
||||
this.dispose();
|
||||
}
|
||||
if (e.getSource() == dongBtn) {
|
||||
int res = JOptionPane.showConfirmDialog(null, "是否需要小董客服为你服务!", "提示", JOptionPane.YES_NO_CANCEL_OPTION);
|
||||
|
||||
if (res == JOptionPane.YES_OPTION) {
|
||||
JOptionPane.showMessageDialog(null, "请联系:dongjingfei@qq.com");
|
||||
}
|
||||
if (res == JOptionPane.NO_OPTION) {
|
||||
JOptionPane.showMessageDialog(null, "小董会伤心的哦~TnT~");
|
||||
}
|
||||
}
|
||||
if (e.getSource() == zhangBtn) {
|
||||
int res2 = JOptionPane.showConfirmDialog(null, "是否需要小张客服为你服务!", "提示", JOptionPane.YES_NO_CANCEL_OPTION);
|
||||
if (res2 == JOptionPane.YES_OPTION) {
|
||||
JOptionPane.showMessageDialog(null, "请联系: zhanghaoyang@qq.com");
|
||||
}
|
||||
if (res2 == JOptionPane.NO_OPTION) {
|
||||
JOptionPane.showMessageDialog(null, "小张会生气的哦~TnT~");
|
||||
}
|
||||
}
|
||||
if (e.getSource() == lanBtn) {
|
||||
int res3 = JOptionPane.showConfirmDialog(null, "是否需要小兰客服为你服务!", "提示", JOptionPane.YES_NO_CANCEL_OPTION);
|
||||
if (res3 == JOptionPane.YES_OPTION) {
|
||||
JOptionPane.showMessageDialog(null, "小兰客服不在线,请稍后重试...");
|
||||
}
|
||||
}
|
||||
if (e.getSource() == chengBtn) {
|
||||
int res4 = JOptionPane.showConfirmDialog(null, "是否需要小程客服为你服务!", "提示", JOptionPane.YES_NO_CANCEL_OPTION);
|
||||
if (res4 == JOptionPane.YES_OPTION) {
|
||||
JOptionPane.showMessageDialog(null, "请联系:chengyongkang@qq.com");
|
||||
}
|
||||
if (res4 == JOptionPane.NO_OPTION) {
|
||||
JOptionPane.showMessageDialog(null, "小程会不开心的哦~TnT~");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,177 @@
|
||||
package xjdx.rjxy.airplane.view;
|
||||
|
||||
import xjdx.rjxy.airplane.dao.UserDao;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.FocusEvent;
|
||||
import java.awt.event.FocusListener;
|
||||
|
||||
import static xjdx.rjxy.airplane.service.UserService.UserLogin;
|
||||
|
||||
public class Login extends JFrame implements ActionListener {
|
||||
static JTextField usernameTextField;
|
||||
JButton loginBtn, registerBtn, quitBtn;
|
||||
JPasswordField passwordField;
|
||||
private Icon loginIco = new ImageIcon("E:\\JavaProjects_IDEA\\Airline Reservation System\\src\\xjdx\\rjxy\\airplane\\view\\images\\登录.png");
|
||||
private Icon registerIco = new ImageIcon("E:\\JavaProjects_IDEA\\Airline Reservation System\\src\\xjdx\\rjxy\\airplane\\view\\images\\工会成员注册.png");
|
||||
private Icon quitIco = new ImageIcon("E:\\JavaProjects_IDEA\\Airline Reservation System\\src\\xjdx\\rjxy\\airplane\\view\\images\\18.退出_关闭.png");
|
||||
|
||||
public Login() {
|
||||
super("飞机订票系统 v1.0>>登录窗口");
|
||||
//改变按钮样式
|
||||
try {
|
||||
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (InstantiationException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (UnsupportedLookAndFeelException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
//设置ICO图标
|
||||
Image im;
|
||||
ImageIcon ig = new ImageIcon("E:\\JavaProjects_IDEA\\Airline Reservation System\\src\\xjdx\\rjxy\\airplane\\view\\images\\ico.jpg");//设置图标图片
|
||||
im = ig.getImage();
|
||||
setIconImage(im);
|
||||
//设置背景图
|
||||
ImageIcon icon = new ImageIcon("E:\\JavaProjects_IDEA\\Airline Reservation System\\src\\xjdx\\rjxy\\airplane\\view\\images\\airplane2.png");//背景图
|
||||
JLabel label = new JLabel(icon);//标签中加入图片
|
||||
label.setBounds(0, 0, icon.getIconWidth(), icon.getIconHeight());//设置标签位置大小为图片大小
|
||||
getLayeredPane().add(label, Integer.valueOf(Integer.MIN_VALUE));//标签添加到第二层面板
|
||||
//获取顶层容器设为透明
|
||||
JPanel Panel = (JPanel) getContentPane();
|
||||
Panel.setOpaque(false);
|
||||
getContentPane().setLayout(null);
|
||||
|
||||
JPanel titlePan = new JPanel();
|
||||
titlePan.setOpaque(false);
|
||||
JLabel titleLab = new JLabel("Airline Reservation System");
|
||||
titlePan.setBounds(0, 50, 600, 55);
|
||||
|
||||
Font font = new Font("楷体", Font.TYPE1_FONT, 30);
|
||||
titleLab.setFont(font);
|
||||
titleLab.setForeground(Color.BLACK);
|
||||
|
||||
titlePan.add(titleLab);
|
||||
getContentPane().add(titlePan);
|
||||
|
||||
JPanel pan1 = new JPanel();
|
||||
pan1.setOpaque(false);
|
||||
JLabel usernameLab = new JLabel("Username:");
|
||||
JLabel passwordLab = new JLabel("Password:");
|
||||
|
||||
Font font1 = new Font("楷体", Font.TYPE1_FONT, 20);
|
||||
usernameLab.setFont(font1);
|
||||
passwordLab.setFont(font1);
|
||||
usernameLab.setForeground(Color.BLACK);
|
||||
passwordLab.setForeground(Color.BLACK);
|
||||
pan1.setBounds(150, 150, 100, 100);
|
||||
pan1.add(usernameLab);
|
||||
pan1.add(passwordLab);
|
||||
pan1.setLayout(new FlowLayout(0, 0, 20));
|
||||
getContentPane().add(pan1);
|
||||
|
||||
|
||||
JPanel pan2 = new JPanel();
|
||||
pan2.setOpaque(false);
|
||||
usernameTextField = new JTextField(28);
|
||||
usernameTextField.setToolTipText("please enter username");
|
||||
passwordField = new JPasswordField(28);
|
||||
passwordField.setOpaque(false);
|
||||
usernameTextField.setOpaque(false);
|
||||
passwordField.setToolTipText("please enter password");
|
||||
pan2.setBounds(280, 150, 200, 100);
|
||||
pan2.add(usernameTextField);
|
||||
pan2.add(passwordField);
|
||||
pan2.setLayout(new FlowLayout(0, 0, 23));
|
||||
getContentPane().add(pan2);
|
||||
|
||||
|
||||
JPanel pan3 = new JPanel();
|
||||
pan3.setOpaque(false);
|
||||
loginBtn = new JButton("Login");
|
||||
loginBtn.setIcon(loginIco);
|
||||
registerBtn = new JButton("Register");
|
||||
registerBtn.setIcon(registerIco);
|
||||
quitBtn = new JButton("Quit");
|
||||
quitBtn.setIcon(quitIco);
|
||||
|
||||
pan3.setBounds(80, 300, 600, 50);
|
||||
pan3.setLayout(new FlowLayout(0, 40, 0));
|
||||
pan3.add(loginBtn);
|
||||
pan3.add(registerBtn);
|
||||
pan3.add(quitBtn);
|
||||
|
||||
getContentPane().add(pan3);
|
||||
|
||||
|
||||
setBounds(500, 200, 600, 500);
|
||||
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
||||
setVisible(true);
|
||||
setResizable(false);
|
||||
setTitle(getTitle());
|
||||
|
||||
registerBtn.addActionListener(this);
|
||||
loginBtn.addActionListener(this);
|
||||
quitBtn.addActionListener(this);
|
||||
|
||||
usernameTextField.setText("enter username,password");
|
||||
usernameTextField.setForeground(new Color(204, 204, 204));
|
||||
usernameTextField.addFocusListener(new FocusListener() {
|
||||
@Override
|
||||
public void focusGained(FocusEvent e) {
|
||||
if (usernameTextField.getText().equals("enter username,password")) {
|
||||
usernameTextField.setText("");
|
||||
usernameTextField.setForeground(Color.BLACK);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void focusLost(FocusEvent e) {
|
||||
if (usernameTextField.getText().length() < 1) {
|
||||
usernameTextField.setText("enter username,password");
|
||||
usernameTextField.setForeground(new Color(160, 157, 157));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
Login app = new Login();
|
||||
}
|
||||
|
||||
// //返回当前登录的用户名
|
||||
// public static String currentUser() {
|
||||
// return currentUsername;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (e.getSource() == registerBtn) {
|
||||
new Register();
|
||||
this.dispose();
|
||||
}
|
||||
if (e.getSource() == quitBtn) {
|
||||
System.exit(0);
|
||||
}
|
||||
if (e.getSource() == loginBtn) {
|
||||
String username = usernameTextField.getText();
|
||||
String password = String.valueOf(passwordField.getPassword());
|
||||
if (UserLogin(username, password)) {
|
||||
String currentusername = UserDao.currentUser(username, password);
|
||||
this.dispose();
|
||||
new MainPage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,751 @@
|
||||
package xjdx.rjxy.airplane.view;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
|
||||
public class MainPage extends JFrame implements ActionListener {
|
||||
JComboBox<String> jcb;
|
||||
JComboBox<String> jcb2;
|
||||
JComboBox<String> yearBox, yearBox2;
|
||||
JComboBox<String> monthBox, monthBox2; //下拉框
|
||||
JComboBox<String> dayBox, dayBox2;
|
||||
JComboBox<String> clockBox, clockBox2;
|
||||
JComboBox<String> minuteBox, minuteBox2;
|
||||
|
||||
JTextArea showInfo;
|
||||
|
||||
JButton exchangebtn, seekBtn, buyBtn, refundBtn, orderSeekBtn, flightSeekBtn;
|
||||
|
||||
JComboBox<String> cabinBox;
|
||||
|
||||
JMenu exchangeBackground, exchangeTextAreaColor;
|
||||
JMenuItem blueTheme, redTheme, whiteThem, blackTheme, greenTheme, oldBg, blackBg, redBg, blueBg, transparentBg, currentUser, userInfo, signOut, closePage, checkFlight, airplaneShow, customerServiceInfo, systemInfo, useManual;
|
||||
String year[] = {null, "2022", "2023", "2024"};
|
||||
String month[] = {null, "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"};
|
||||
String day[] = {null, "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31"};
|
||||
String clock[] = {null, "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "00"};
|
||||
String minute[] = {null, "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "50,", "51", "52", "53", "54", "55", "56", "57", "58", "59", "60"};
|
||||
|
||||
String cityList[] = {null, "--请选择城市--", "北京市", "天津市", "上海市", "重庆市", "河北省", "山西省", "辽宁省", "吉林省", "黑龙江省", "江苏省", "浙江省", "安徽省", "福建省", "江西省", "山东省", "河南省", "湖北省", "湖南省", "广东省", "海南省", "四川省", "贵州省", "云南省", "陕西省", "甘肃省", "青海省", "台湾省", "内蒙古自治区", "广西壮族自治区", "西藏自治区", "宁夏回族自治区", "新疆维吾尔自治区", "香港特别行政区", "澳门特别行政区"};
|
||||
JCheckBox checkBox1, checkBox2, checkBox3, checkBox4;
|
||||
JLabel titleLab;
|
||||
JMenuItem all, copy, past, refresh, shi, shiwu, ershi, erhshiwu, sanshi, redFont, blueFont, yellowFont, blackFont, greenFont, whiteFont;
|
||||
JPopupMenu popupMenu;
|
||||
JPanel showPan;
|
||||
JScrollPane scrollPane;
|
||||
private Icon exchangeIco = new ImageIcon("E:\\JavaProjects_IDEA\\Airline Reservation System\\src\\xjdx\\rjxy\\airplane\\view\\images\\上下切换.png");
|
||||
private Icon seelBtnIco = new ImageIcon("E:\\JavaProjects_IDEA\\Airline Reservation System\\src\\xjdx\\rjxy\\airplane\\view\\images\\seekBtn.png");
|
||||
private Icon buyBtnIco = new ImageIcon("E:\\JavaProjects_IDEA\\Airline Reservation System\\src\\xjdx\\rjxy\\airplane\\view\\images\\BuyBtnIco.png");
|
||||
private Icon refundBtnIco = new ImageIcon("E:\\JavaProjects_IDEA\\Airline Reservation System\\src\\xjdx\\rjxy\\airplane\\view\\images\\refundBtnIco.png");
|
||||
private Icon orderSeekBtnIco = new ImageIcon("E:\\JavaProjects_IDEA\\Airline Reservation System\\src\\xjdx\\rjxy\\airplane\\view\\images\\订单查询2.png");
|
||||
private Icon flightSeekBtnIco = new ImageIcon("E:\\JavaProjects_IDEA\\Airline Reservation System\\src\\xjdx\\rjxy\\airplane\\view\\images\\航班2.png");
|
||||
|
||||
public MainPage() {
|
||||
super("飞机订票系统 v1.0>>主页面");
|
||||
|
||||
//改变按钮的样式
|
||||
try {
|
||||
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (InstantiationException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (UnsupportedLookAndFeelException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
//设置ICO图标
|
||||
Image im;
|
||||
ImageIcon ig = new ImageIcon("E:\\JavaProjects_IDEA\\Airline Reservation System\\src\\xjdx\\rjxy\\airplane\\view\\images\\ico.jpg");//设置图标图片
|
||||
im = ig.getImage();
|
||||
setIconImage(im);
|
||||
//设置背景图
|
||||
ImageIcon icon = new ImageIcon("E:\\JavaProjects_IDEA\\Airline Reservation System\\src\\xjdx\\rjxy\\airplane\\view\\images\\airplane.jpeg");//背景图
|
||||
JLabel label = new JLabel(icon);//标签中加入图片
|
||||
label.setBounds(0, 0, icon.getIconWidth(), icon.getIconHeight());//设置标签位置大小为图片大小
|
||||
getLayeredPane().add(label, Integer.valueOf(Integer.MIN_VALUE));//标签添加到第二层面板
|
||||
//获取顶层容器设为透明
|
||||
JPanel Panel = (JPanel) getContentPane();
|
||||
Panel.setOpaque(false);
|
||||
|
||||
//菜单栏
|
||||
JMenuBar menuBar = new JMenuBar();
|
||||
JMenu userMenu = new JMenu("用户");
|
||||
JMenu viewMenu = new JMenu("视图");
|
||||
JMenu optionsMenu = new JMenu("选项");
|
||||
JMenu aboutMenu = new JMenu("关于");
|
||||
JMenu helpMenu = new JMenu("帮助");
|
||||
|
||||
//用户的子菜单
|
||||
currentUser = new JMenuItem("当前用户");
|
||||
userInfo = new JMenuItem("账号信息");
|
||||
signOut = new JMenuItem("退出登录");
|
||||
|
||||
|
||||
//视图的子菜单
|
||||
exchangeBackground = new JMenu("更改标题颜色");
|
||||
blueTheme = new JMenuItem("蓝色");
|
||||
blackTheme = new JMenuItem("黑色(默认)");
|
||||
redTheme = new JMenuItem("红色");
|
||||
whiteThem = new JMenuItem("白色");
|
||||
greenTheme = new JMenuItem("绿色");
|
||||
exchangeTextAreaColor = new JMenu("改变信息展示框的背景颜色");
|
||||
oldBg = new JMenuItem("白色(默认)");
|
||||
blackBg = new JMenuItem("黑色背景");
|
||||
redBg = new JMenuItem("红色背景");
|
||||
blueBg = new JMenuItem("蓝色背景");
|
||||
transparentBg = new JMenuItem("透明背景");
|
||||
|
||||
//信息框展示添加子菜单
|
||||
exchangeTextAreaColor.add(oldBg);
|
||||
exchangeTextAreaColor.add(blackBg);
|
||||
exchangeTextAreaColor.add(redBg);
|
||||
exchangeTextAreaColor.add(blueBg);
|
||||
exchangeTextAreaColor.add(transparentBg);
|
||||
|
||||
//选项的子菜单
|
||||
checkFlight = new JMenuItem("查看飞机信息");
|
||||
airplaneShow = new JMenuItem("航班展示");
|
||||
customerServiceInfo = new JMenuItem("客服信息");
|
||||
closePage = new JMenuItem("关闭页面");
|
||||
|
||||
//选项添加子菜单
|
||||
optionsMenu.add(checkFlight);
|
||||
optionsMenu.add(airplaneShow);
|
||||
optionsMenu.add(customerServiceInfo);
|
||||
optionsMenu.add(closePage);
|
||||
|
||||
//更改背景添加子菜单
|
||||
exchangeBackground.add(redTheme);
|
||||
exchangeBackground.add(blueTheme);
|
||||
exchangeBackground.add(blackTheme);
|
||||
exchangeBackground.add(whiteThem);
|
||||
exchangeBackground.add(greenTheme);
|
||||
|
||||
//关于添加子菜单
|
||||
systemInfo = new JMenuItem("关于");
|
||||
aboutMenu.add(systemInfo);
|
||||
//帮助添加子菜单
|
||||
useManual = new JMenuItem("使用说明");
|
||||
helpMenu.add(useManual);
|
||||
|
||||
|
||||
//用户添加子菜单
|
||||
userMenu.add(currentUser);
|
||||
userMenu.add(userInfo);
|
||||
userMenu.add(signOut);
|
||||
|
||||
//视图添加子菜单
|
||||
viewMenu.add(exchangeBackground);
|
||||
viewMenu.add(exchangeTextAreaColor);
|
||||
|
||||
|
||||
//菜单栏添加菜单
|
||||
menuBar.add(userMenu);
|
||||
menuBar.add(viewMenu);
|
||||
menuBar.add(optionsMenu);
|
||||
menuBar.add(aboutMenu);
|
||||
menuBar.add(helpMenu);
|
||||
|
||||
this.setJMenuBar(menuBar);
|
||||
|
||||
getContentPane().setLayout(null);
|
||||
JPanel titlePan = new JPanel();
|
||||
titlePan.setOpaque(false);
|
||||
titleLab = new JLabel("Welcome to Airline Reservation System");
|
||||
Font font = new Font("楷体", Font.TYPE1_FONT, 30);
|
||||
titleLab.setFont(font);
|
||||
// titleLab.setForeground(Color.BLACK);
|
||||
titlePan.setBounds(0, 20, 1000, 50);
|
||||
titlePan.add(titleLab);
|
||||
this.add(titlePan);
|
||||
|
||||
|
||||
jcb = new JComboBox<>(cityList);
|
||||
jcb.setPreferredSize(new Dimension(150, 40));
|
||||
jcb2 = new JComboBox<>(cityList);
|
||||
jcb2.setPreferredSize(new Dimension(150, 40));
|
||||
|
||||
|
||||
//下拉框
|
||||
JLabel lab1 = new JLabel("出发地:");
|
||||
JLabel lab2 = new JLabel("目的地:");
|
||||
|
||||
Font font1 = new Font("楷体", Font.TYPE1_FONT, 20);
|
||||
lab1.setFont(font1);
|
||||
lab2.setFont(font1);
|
||||
lab1.setForeground(Color.BLACK);
|
||||
lab2.setForeground(Color.BLACK);
|
||||
|
||||
JPanel pan1 = new JPanel();
|
||||
JPanel pan2 = new JPanel();
|
||||
pan1.setBounds(50, 80, 80, 30);
|
||||
pan2.setBounds(50, 160, 80, 30);
|
||||
pan1.add(lab1);
|
||||
pan2.add(lab2);
|
||||
|
||||
JPanel pan3 = new JPanel();
|
||||
JPanel pan4 = new JPanel();
|
||||
pan3.setBounds(130, 70, 160, 50);
|
||||
pan4.setBounds(130, 150, 160, 50);
|
||||
pan3.add(jcb);
|
||||
pan4.add(jcb2);
|
||||
this.add(pan3);
|
||||
this.add(pan4);
|
||||
this.add(pan1);
|
||||
this.add(pan2);
|
||||
|
||||
pan2.setOpaque(false);
|
||||
pan1.setOpaque(false);
|
||||
pan3.setOpaque(false);
|
||||
pan4.setOpaque(false);
|
||||
|
||||
|
||||
//"换"按钮
|
||||
exchangebtn = new JButton();
|
||||
exchangebtn.setBounds(190, 115, 40, 40);
|
||||
exchangebtn.setIcon(exchangeIco);
|
||||
exchangebtn.setContentAreaFilled(false); //设置按钮透明
|
||||
exchangebtn.setBorder(null); //取消边框
|
||||
exchangebtn.setBorder(BorderFactory.createRaisedBevelBorder()); //设置突起
|
||||
this.add(exchangebtn);
|
||||
|
||||
Font font2 = new Font("楷体", Font.TYPE1_FONT, 15);
|
||||
//出发时间选择---------------------------------------------------------
|
||||
JLabel timeLab = new JLabel("出发时间:");
|
||||
JLabel yearLab = new JLabel("年");
|
||||
yearLab.setFont(font2);
|
||||
JLabel monthLab = new JLabel("月");
|
||||
monthLab.setFont(font2);
|
||||
JLabel dayLab = new JLabel("日");
|
||||
dayLab.setFont(font2);
|
||||
|
||||
JLabel clockLab = new JLabel("时");
|
||||
clockLab.setFont(font2);
|
||||
|
||||
JLabel minuteLab = new JLabel("分");
|
||||
minuteLab.setFont(font2);
|
||||
|
||||
|
||||
yearBox = new JComboBox<>(year);
|
||||
monthBox = new JComboBox<>(month);
|
||||
dayBox = new JComboBox<>(day);
|
||||
|
||||
clockBox = new JComboBox<>(clock);
|
||||
|
||||
minuteBox = new JComboBox<>(minute);
|
||||
|
||||
|
||||
JPanel pan5 = new JPanel();
|
||||
JPanel pan6 = new JPanel();
|
||||
JPanel pan7 = new JPanel();
|
||||
JPanel pan8 = new JPanel();
|
||||
JPanel pan9 = new JPanel();
|
||||
//time
|
||||
timeLab.setBounds(55, 200, 100, 50);
|
||||
timeLab.setFont(font1);
|
||||
timeLab.setForeground(Color.BLACK);
|
||||
this.add(timeLab);
|
||||
//year
|
||||
pan5.setBounds(55, 240, 80, 30);
|
||||
pan5.setOpaque(false);
|
||||
pan5.setLayout(new FlowLayout());
|
||||
pan5.add(yearBox);
|
||||
pan5.add(yearLab);
|
||||
this.add(pan5);
|
||||
//month
|
||||
pan6.setBounds(135, 240, 80, 30);
|
||||
pan6.setLayout(new FlowLayout());
|
||||
pan6.setOpaque(false);
|
||||
pan6.add(monthBox);
|
||||
pan6.add(monthLab);
|
||||
this.add(pan6);
|
||||
//day
|
||||
pan7.setBounds(205, 240, 80, 30);
|
||||
pan7.setOpaque(false);
|
||||
pan7.setLayout(new FlowLayout());
|
||||
pan7.add(dayBox);
|
||||
pan7.add(dayLab);
|
||||
this.add(pan7);
|
||||
//clock
|
||||
pan8.setBounds(275, 240, 80, 30);
|
||||
pan8.setOpaque(false);
|
||||
pan8.setLayout(new FlowLayout());
|
||||
pan8.add(clockBox);
|
||||
pan8.add(clockLab);
|
||||
this.add(pan8);
|
||||
//minute
|
||||
pan9.setBounds(350, 240, 80, 30);
|
||||
pan9.setOpaque(false);
|
||||
pan9.setLayout(new FlowLayout());
|
||||
pan9.add(minuteBox);
|
||||
pan9.add(minuteLab);
|
||||
this.add(pan9);
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// 到达时间选择
|
||||
JLabel timeLab2 = new JLabel("到达时间:");
|
||||
JLabel yearLab2 = new JLabel("年");
|
||||
yearLab2.setFont(font2);
|
||||
JLabel monthLab2 = new JLabel("月");
|
||||
monthLab2.setFont(font2);
|
||||
JLabel dayLab2 = new JLabel("日");
|
||||
dayLab2.setFont(font2);
|
||||
|
||||
JLabel clockLab2 = new JLabel("时");
|
||||
clockLab2.setFont(font2);
|
||||
|
||||
JLabel minuteLab2 = new JLabel("分");
|
||||
minuteLab2.setFont(font2);
|
||||
|
||||
yearBox2 = new JComboBox<>(year);
|
||||
monthBox2 = new JComboBox<>(month);
|
||||
dayBox2 = new JComboBox<>(day);
|
||||
|
||||
clockBox2 = new JComboBox<>(clock);
|
||||
|
||||
minuteBox2 = new JComboBox<>(minute);
|
||||
|
||||
JPanel pan10 = new JPanel();
|
||||
JPanel pan11 = new JPanel();
|
||||
JPanel pan12 = new JPanel();
|
||||
JPanel pan13 = new JPanel();
|
||||
JPanel pan14 = new JPanel();
|
||||
|
||||
//time
|
||||
timeLab2.setBounds(55, 260, 100, 50);
|
||||
timeLab2.setFont(font1);
|
||||
timeLab2.setForeground(Color.BLACK);
|
||||
this.add(timeLab2);
|
||||
//year
|
||||
pan10.setBounds(55, 300, 80, 30);
|
||||
pan10.setOpaque(false);
|
||||
pan10.setLayout(new FlowLayout());
|
||||
pan10.add(yearBox2);
|
||||
pan10.add(yearLab2);
|
||||
this.add(pan10);
|
||||
//month
|
||||
pan11.setBounds(135, 300, 80, 30);
|
||||
pan11.setLayout(new FlowLayout());
|
||||
pan11.setOpaque(false);
|
||||
pan11.add(monthBox2);
|
||||
pan11.add(monthLab2);
|
||||
this.add(pan11);
|
||||
//day
|
||||
pan12.setBounds(205, 300, 80, 30);
|
||||
pan12.setOpaque(false);
|
||||
pan12.setLayout(new FlowLayout());
|
||||
pan12.add(dayBox2);
|
||||
pan12.add(dayLab2);
|
||||
this.add(pan12);
|
||||
//clock
|
||||
pan13.setBounds(275, 300, 80, 30);
|
||||
pan13.setOpaque(false);
|
||||
pan13.setLayout(new FlowLayout());
|
||||
pan13.add(clockBox2);
|
||||
pan13.add(clockLab2);
|
||||
this.add(pan13);
|
||||
//minute
|
||||
pan14.setBounds(350, 300, 80, 30);
|
||||
pan14.setOpaque(false);
|
||||
pan14.setLayout(new FlowLayout());
|
||||
pan14.add(minuteBox2);
|
||||
pan14.add(minuteLab2);
|
||||
this.add(pan14);
|
||||
|
||||
|
||||
//信息显示框
|
||||
showPan = new JPanel();
|
||||
showPan.setOpaque(false);
|
||||
showPan.setBounds(450, 70, 500, 450);
|
||||
showInfo = new JTextArea(27, 49);
|
||||
showInfo.setLineWrap(true); //激活自动换行功能
|
||||
showInfo.setWrapStyleWord(true); // 激活断行不断字功能
|
||||
showInfo.setFont(font1);
|
||||
scrollPane = new JScrollPane();
|
||||
scrollPane.setBounds(450, 70, 500, 450);
|
||||
// scrollPane.setOpaque(false);
|
||||
|
||||
scrollPane.getViewport().add(showPan);
|
||||
showPan.add(showInfo);
|
||||
this.add(scrollPane);
|
||||
|
||||
//舱位选择
|
||||
JLabel label1 = new JLabel("选择舱位:");
|
||||
label1.setBounds(55, 340, 100, 30);
|
||||
label1.setFont(font1);
|
||||
this.add(label1);
|
||||
String cabin[] = {"舱位不限", "经济舱", "公务舱,头等舱"};
|
||||
JPanel panel = new JPanel();
|
||||
panel.setBounds(150, 337, 110, 30);
|
||||
panel.setOpaque(false);
|
||||
cabinBox = new JComboBox(cabin);
|
||||
panel.add(cabinBox);
|
||||
this.add(panel);
|
||||
|
||||
//查找按钮
|
||||
JLabel label2 = new JLabel("请选择查询条件:");
|
||||
label2.setBounds(300, 65, 100, 20);
|
||||
this.add(label2);
|
||||
|
||||
checkBox1 = new JCheckBox("出发地");
|
||||
checkBox1.setOpaque(false);
|
||||
checkBox2 = new JCheckBox("目的地");
|
||||
checkBox2.setOpaque(false);
|
||||
checkBox3 = new JCheckBox("时间");
|
||||
checkBox3.setOpaque(false);
|
||||
checkBox4 = new JCheckBox("舱位");
|
||||
checkBox4.setOpaque(false);
|
||||
|
||||
|
||||
JPanel checkBoxPan = new JPanel();
|
||||
checkBoxPan.setBounds(310, 80, 130, 60);
|
||||
checkBoxPan.setOpaque(false);
|
||||
checkBoxPan.setLayout(new FlowLayout(0, 0, 5));
|
||||
checkBoxPan.add(checkBox1);
|
||||
checkBoxPan.add(checkBox3);
|
||||
checkBoxPan.add(checkBox2);
|
||||
checkBoxPan.add(checkBox4);
|
||||
this.add(checkBoxPan);
|
||||
|
||||
seekBtn = new JButton();
|
||||
seekBtn.setBounds(340, 150, 50, 50);
|
||||
seekBtn.setContentAreaFilled(false); //设置按钮透明
|
||||
seekBtn.setBorder(null); //取消边框
|
||||
seekBtn.setBorder(BorderFactory.createRaisedBevelBorder()); //设置突起
|
||||
seekBtn.setIcon(seelBtnIco);
|
||||
this.add(seekBtn);
|
||||
|
||||
|
||||
//购票,退票按钮设置
|
||||
buyBtn = new JButton("购票", buyBtnIco);
|
||||
buyBtn.setPreferredSize(new Dimension(150, 50));
|
||||
buyBtn.setFont(font1);
|
||||
refundBtn = new JButton("退票", refundBtnIco);
|
||||
refundBtn.setFont(font1);
|
||||
refundBtn.setPreferredSize(new Dimension(150, 50));
|
||||
|
||||
|
||||
JPanel panBtn1 = new JPanel();
|
||||
panBtn1.setBounds(50, 400, 400, 60);
|
||||
panBtn1.setLayout(new FlowLayout(0, 30, 0));
|
||||
panBtn1.setOpaque(false);
|
||||
panBtn1.add(buyBtn);
|
||||
panBtn1.add(refundBtn);
|
||||
this.add(panBtn1);
|
||||
|
||||
|
||||
//订单查询,航班查询按钮设置
|
||||
orderSeekBtn = new JButton("订单", orderSeekBtnIco);
|
||||
orderSeekBtn.setPreferredSize(new Dimension(150, 50));
|
||||
orderSeekBtn.setFont(font1);
|
||||
flightSeekBtn = new JButton("航班", flightSeekBtnIco);
|
||||
flightSeekBtn.setPreferredSize(new Dimension(150, 50));
|
||||
flightSeekBtn.setFont(font1);
|
||||
|
||||
JPanel panBtn2 = new JPanel();
|
||||
panBtn2.setLayout(new FlowLayout(0, 30, 0));
|
||||
panBtn2.setBounds(50, 460, 400, 60);
|
||||
panBtn2.setOpaque(false);
|
||||
panBtn2.add(orderSeekBtn);
|
||||
panBtn2.add(flightSeekBtn);
|
||||
this.add(panBtn2);
|
||||
|
||||
|
||||
//右键菜单
|
||||
popupMenu = new JPopupMenu();
|
||||
all = new JMenuItem("全选");
|
||||
copy = new JMenuItem("复制");
|
||||
past = new JMenuItem("粘贴");
|
||||
refresh = new JMenuItem("刷新清空");
|
||||
|
||||
shi = new JMenuItem("10");
|
||||
shiwu = new JMenuItem("15");
|
||||
ershi = new JMenuItem("20");
|
||||
erhshiwu = new JMenuItem("25");
|
||||
sanshi = new JMenuItem("30");
|
||||
JMenu fontMenu = new JMenu("设置字体大小");
|
||||
|
||||
blackFont = new JMenuItem("黑色(默认)");
|
||||
redFont = new JMenuItem("红色");
|
||||
blueFont = new JMenuItem("蓝色");
|
||||
yellowFont = new JMenuItem("黄色");
|
||||
greenFont = new JMenuItem("绿色");
|
||||
whiteFont = new JMenuItem("白色");
|
||||
|
||||
JMenu fontColorMenu = new JMenu("设置字体的颜色");
|
||||
fontColorMenu.add(blackFont);
|
||||
fontColorMenu.add(redFont);
|
||||
fontColorMenu.add(yellowFont);
|
||||
fontColorMenu.add(blueFont);
|
||||
fontColorMenu.add(greenFont);
|
||||
fontColorMenu.add(whiteFont);
|
||||
|
||||
fontMenu.add(shi);
|
||||
fontMenu.add(shiwu);
|
||||
fontMenu.add(ershi);
|
||||
fontMenu.add(erhshiwu);
|
||||
fontMenu.add(sanshi);
|
||||
|
||||
popupMenu.add(all);
|
||||
popupMenu.addSeparator(); //分割线
|
||||
popupMenu.add(copy);
|
||||
popupMenu.addSeparator();
|
||||
popupMenu.add(past);
|
||||
popupMenu.addSeparator();
|
||||
popupMenu.add(refresh);
|
||||
popupMenu.addSeparator();
|
||||
popupMenu.add(fontMenu);
|
||||
popupMenu.addSeparator();
|
||||
popupMenu.add(fontColorMenu);
|
||||
|
||||
|
||||
//底部显示栏
|
||||
JLabel bottomLab = new JLabel("当前登录者:");
|
||||
bottomLab.setBounds(0, 500, 1000, 50);
|
||||
this.add(bottomLab);
|
||||
|
||||
setBounds(300, 150, 1000, 600);
|
||||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
setVisible(true);
|
||||
setResizable(false);
|
||||
setTitle(getTitle());
|
||||
|
||||
|
||||
closePage.addActionListener(this); //菜单-关闭页面
|
||||
exchangebtn.addActionListener(this); //交换按钮
|
||||
signOut.addActionListener(this);//菜单-退出登录
|
||||
buyBtn.addActionListener(this); //购票按钮
|
||||
refundBtn.addActionListener(this);//退票按钮事件
|
||||
seekBtn.addActionListener(this); //查询按钮的事件
|
||||
orderSeekBtn.addActionListener(this);//订单查询按钮
|
||||
currentUser.addActionListener(this); //菜单-当前用户
|
||||
userInfo.addActionListener(this);//菜单-用户信息
|
||||
//标题颜色改变
|
||||
redTheme.addActionListener(this);
|
||||
blackTheme.addActionListener(this);
|
||||
whiteThem.addActionListener(this);
|
||||
greenTheme.addActionListener(this);
|
||||
blueTheme.addActionListener(this);
|
||||
//信息展示框背景颜色修改
|
||||
transparentBg.addActionListener(this);
|
||||
blackBg.addActionListener(this);
|
||||
redBg.addActionListener(this);
|
||||
blueBg.addActionListener(this);
|
||||
oldBg.addActionListener(this);
|
||||
|
||||
//飞机展示事件
|
||||
airplaneShow.addActionListener(this);
|
||||
//客户信息
|
||||
customerServiceInfo.addActionListener(this);
|
||||
//菜单-关 于
|
||||
systemInfo.addActionListener(this);
|
||||
useManual.addActionListener(this);
|
||||
|
||||
//右键菜单 设置字体大小
|
||||
shi.addActionListener(this);
|
||||
shiwu.addActionListener(this);
|
||||
ershi.addActionListener(this);
|
||||
erhshiwu.addActionListener(this);
|
||||
sanshi.addActionListener(this);
|
||||
//右键菜单 设置字体颜色
|
||||
blackFont.addActionListener(this);
|
||||
yellowFont.addActionListener(this);
|
||||
redFont.addActionListener(this);
|
||||
blueFont.addActionListener(this);
|
||||
greenFont.addActionListener(this);
|
||||
whiteFont.addActionListener(this);
|
||||
|
||||
//右键菜单-刷新
|
||||
refresh.addActionListener(this);
|
||||
|
||||
//右键菜单 -全选
|
||||
all.addActionListener(this);
|
||||
//右键菜单-复制
|
||||
copy.addActionListener(this);
|
||||
//右键菜单-粘贴
|
||||
past.addActionListener(this);
|
||||
|
||||
//右键菜单
|
||||
showInfo.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
super.mouseClicked(e);
|
||||
if (e.getButton() == MouseEvent.BUTTON3) {
|
||||
popupMenu.show(showInfo, e.getX(), e.getY());
|
||||
}
|
||||
if (e.getButton() == MouseEvent.BUTTON1) {
|
||||
popupMenu.setVisible(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
new MainPage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (e.getSource() == closePage) { //菜单-关闭页面事件
|
||||
System.exit(0);
|
||||
}
|
||||
if (e.getSource() == exchangebtn) { //交换按钮事件
|
||||
int city1 = jcb.getSelectedIndex();
|
||||
int city2 = jcb2.getSelectedIndex();
|
||||
// String city1 = jcb.getSelectedItem().toString();
|
||||
if (city1 != city2) {
|
||||
jcb.setSelectedIndex(city2);
|
||||
jcb2.setSelectedIndex(city1);
|
||||
}
|
||||
|
||||
}
|
||||
if (e.getSource() == signOut) { //菜单-退出登录事件
|
||||
this.dispose();
|
||||
new Login();
|
||||
}
|
||||
if (e.getSource() == buyBtn) { //购买按钮
|
||||
new PassengerRegistration();
|
||||
}
|
||||
if (e.getSource() == refundBtn) { //退票按钮
|
||||
new RefundPage();
|
||||
}
|
||||
if (e.getSource() == seekBtn) { //查询按钮
|
||||
if (!checkBox1.isSelected() && !checkBox2.isSelected() && !checkBox3.isSelected() && !checkBox3.isSelected()) {
|
||||
JOptionPane.showMessageDialog(null, "请选择查询的条件!", "提示", JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
}
|
||||
if (e.getSource() == orderSeekBtn) { //定安查询按钮
|
||||
new ShowOrder();
|
||||
}
|
||||
if (e.getSource() == currentUser) {
|
||||
JOptionPane.showMessageDialog(null, "当前登录用户:" + Login.usernameTextField.getText(), "提示", JOptionPane.INFORMATION_MESSAGE);
|
||||
}
|
||||
if (e.getSource() == userInfo) { //用户信息菜单
|
||||
new UserInfo();
|
||||
}
|
||||
//标题颜色设置
|
||||
if (e.getSource() == blackTheme) {
|
||||
titleLab.setForeground(Color.black);
|
||||
}
|
||||
if (e.getSource() == redTheme) {
|
||||
titleLab.setForeground(Color.red);
|
||||
|
||||
}
|
||||
if (e.getSource() == greenTheme) {
|
||||
titleLab.setForeground(Color.green);
|
||||
}
|
||||
if (e.getSource() == whiteThem) {
|
||||
titleLab.setForeground(Color.white);
|
||||
}
|
||||
if (e.getSource() == blueTheme) {
|
||||
titleLab.setForeground(Color.CYAN);
|
||||
}
|
||||
//信息展示框背景改变
|
||||
if (e.getSource() == transparentBg) { //透明背景
|
||||
|
||||
showInfo.setBackground(Color.white);
|
||||
showInfo.setForeground(Color.black);
|
||||
showInfo.setOpaque(false);
|
||||
}
|
||||
if (e.getSource() == oldBg) { //原背景
|
||||
showInfo.setBackground(Color.white);
|
||||
showInfo.setForeground(Color.black);
|
||||
showInfo.setOpaque(true);
|
||||
}
|
||||
if (e.getSource() == blueBg) {
|
||||
showInfo.setBackground(Color.CYAN);
|
||||
}
|
||||
if (e.getSource() == redBg) {
|
||||
showInfo.setBackground(Color.red);
|
||||
showInfo.setForeground(Color.white);
|
||||
}
|
||||
if (e.getSource() == blackBg) {
|
||||
showInfo.setBackground(Color.black);
|
||||
showInfo.setForeground(Color.white);
|
||||
}
|
||||
if (e.getSource() == airplaneShow) {
|
||||
new Carousel();
|
||||
}
|
||||
if (e.getSource() == customerServiceInfo) {
|
||||
new CustomerServiceInfo();
|
||||
}
|
||||
if (e.getSource() == systemInfo) { //菜单-关 于
|
||||
JOptionPane.showMessageDialog(null, "系统中文名:飞机订票系统 \n 系统英文名:Airline Reservation System \n 版本: 1.0 \n 开发团队成员:程永康 董景飞 张皓扬 兰代清 \n 2022-12-12");
|
||||
}
|
||||
if (e.getSource() == useManual) {//菜单-帮助
|
||||
JOptionPane.showMessageDialog(null, "欢迎使用飞机订票系统v1.0\n " +
|
||||
"使用说明:\n" +
|
||||
"1.选择好查询的条件后,必须先选择旁边的添加查询条件,不然查询无法继续.\n" +
|
||||
"2.订票操作,请准备好自己的个人信息(姓名,身份证号,电话...),请登记好个人信息后再购买机票.\n" +
|
||||
"3.购票操作,请提前查询好自己想要的乘坐的航班号,选择座位号,舱位等等,根据航班号来进行购票.\n" +
|
||||
"4.退票操作,请准备好自己的个人信息,以及订购的航班号或者订单号,根据订单号或者航班号来退票.\n" +
|
||||
"5.订单查询操作,请准备好自己的身份证号,根据身份证号查询自己已经订购的机票.\n" +
|
||||
"6.航班查询操作,航班查询查询是查询所有的航班信息.\n" +
|
||||
"7.所有的查询信息将会在右边的信息展示框中显示.\n" +
|
||||
"感谢你的使用,祝你使用愉快!");
|
||||
}
|
||||
//右键菜单-设置字体的大小
|
||||
if (e.getSource() == shi) {
|
||||
showInfo.setFont(new Font("楷体", Font.PLAIN, 10));
|
||||
}
|
||||
if (e.getSource() == shiwu) {
|
||||
showInfo.setFont(new Font("楷体", Font.PLAIN, 15));
|
||||
}
|
||||
if (e.getSource() == ershi) {
|
||||
showInfo.setFont(new Font("楷体", Font.PLAIN, 20));
|
||||
}
|
||||
if (e.getSource() == erhshiwu) {
|
||||
showInfo.setFont(new Font("楷体", Font.PLAIN, 25));
|
||||
}
|
||||
if (e.getSource() == sanshi) {
|
||||
showInfo.setFont(new Font("楷体", Font.PLAIN, 30));
|
||||
}
|
||||
//右键菜单-设置字体的颜色
|
||||
if (e.getSource() == blackFont) {
|
||||
showInfo.setForeground(Color.BLACK);
|
||||
}
|
||||
if (e.getSource() == redFont) {
|
||||
showInfo.setForeground(Color.RED);
|
||||
}
|
||||
if (e.getSource() == yellowFont) {
|
||||
showInfo.setForeground(Color.YELLOW);
|
||||
}
|
||||
if (e.getSource() == blueFont) {
|
||||
showInfo.setForeground(Color.CYAN);
|
||||
}
|
||||
if (e.getSource() == greenFont) {
|
||||
showInfo.setForeground(Color.GREEN);
|
||||
}
|
||||
if (e.getSource() == whiteFont) {
|
||||
showInfo.setForeground(Color.LIGHT_GRAY);
|
||||
}
|
||||
if (e.getSource() == refresh) {
|
||||
showInfo.setText("");
|
||||
showInfo.repaint();
|
||||
}
|
||||
// 右键菜单-全选
|
||||
if (e.getSource() == all) {
|
||||
showInfo.selectAll();
|
||||
}
|
||||
//右键菜单 -复制
|
||||
if (e.getSource() == copy) {
|
||||
showInfo.copy();
|
||||
}//右键菜单-粘贴
|
||||
if (e.getSource() == past) {
|
||||
showInfo.paste();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,142 @@
|
||||
package xjdx.rjxy.airplane.view;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
public class PassengerRegistration extends JFrame implements ActionListener {
|
||||
JTextField nameTextField, idCardTextField, telephoneTextField;
|
||||
JComboBox<String> sexBox;
|
||||
String sexList[] = {"男", "女"};
|
||||
JButton registrationBtn, backBtn;
|
||||
private Icon registrationBtnIco = new ImageIcon("E:\\JavaProjects_IDEA\\Airline Reservation System\\src\\xjdx\\rjxy\\airplane\\view\\images\\工会成员注册.png");
|
||||
|
||||
public PassengerRegistration() {
|
||||
super("飞机订票系统 v1.0>>乘客登记");
|
||||
//改变按钮样式
|
||||
try {
|
||||
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (InstantiationException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (UnsupportedLookAndFeelException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
//设置ICO图标
|
||||
Image im;
|
||||
ImageIcon ig = new ImageIcon("E:\\JavaProjects_IDEA\\Airline Reservation System\\src\\xjdx\\rjxy\\airplane\\view\\images\\ico.jpg");//设置图标图片
|
||||
im = ig.getImage();
|
||||
setIconImage(im);
|
||||
//设置背景图
|
||||
ImageIcon icon = new ImageIcon("E:\\JavaProjects_IDEA\\Airline Reservation System\\src\\xjdx\\rjxy\\airplane\\view\\images\\airplane2.png");//背景图
|
||||
JLabel label = new JLabel(icon);//标签中加入图片
|
||||
label.setBounds(0, 0, icon.getIconWidth(), icon.getIconHeight());//设置标签位置大小为图片大小
|
||||
getLayeredPane().add(label, Integer.valueOf(Integer.MIN_VALUE));//标签添加到第二层面板
|
||||
//获取顶层容器设为透明
|
||||
JPanel Panel = (JPanel) getContentPane();
|
||||
Panel.setOpaque(false);
|
||||
getContentPane().setLayout(null);
|
||||
|
||||
Font font = new Font("楷体", Font.TYPE1_FONT, 20);
|
||||
JLabel label1 = new JLabel("请填以下信息:");
|
||||
label1.setFont(font);
|
||||
label1.setForeground(Color.RED);
|
||||
label1.setBounds(50, 20, 150, 30);
|
||||
this.add(label1);
|
||||
|
||||
JLabel pointLab = new JLabel("*");
|
||||
pointLab.setForeground(Color.red);
|
||||
JLabel pointLab1 = new JLabel("*");
|
||||
pointLab1.setForeground(Color.red);
|
||||
JLabel pointLab2 = new JLabel("*");
|
||||
pointLab2.setForeground(Color.red);
|
||||
|
||||
JPanel pointPan = new JPanel();
|
||||
pointPan.setBounds(310, 50, 6, 80);
|
||||
pointPan.setLayout(new FlowLayout(0, 0, 13));
|
||||
pointPan.setOpaque(false);
|
||||
pointPan.add(pointLab);
|
||||
pointPan.add(pointLab1);
|
||||
pointPan.add(pointLab2);
|
||||
this.add(pointPan);
|
||||
|
||||
|
||||
JLabel nameLab = new JLabel("姓 名:");
|
||||
JLabel idCardLab = new JLabel("身份证:");
|
||||
JLabel sexLab = new JLabel("性 别:");
|
||||
JLabel telephoneLab = new JLabel("电 话:");
|
||||
nameLab.setFont(font);
|
||||
idCardLab.setFont(font);
|
||||
sexLab.setFont(font);
|
||||
telephoneLab.setFont(font);
|
||||
|
||||
|
||||
JPanel pan1 = new JPanel();
|
||||
pan1.setBounds(70, 50, 80, 120);
|
||||
pan1.setOpaque(false);
|
||||
pan1.add(nameLab);
|
||||
pan1.add(idCardLab);
|
||||
|
||||
pan1.add(telephoneLab);
|
||||
pan1.add(sexLab);
|
||||
|
||||
JPanel pan2 = new JPanel();
|
||||
nameTextField = new JTextField(25);
|
||||
idCardTextField = new JTextField(25);
|
||||
telephoneTextField = new JTextField(25);
|
||||
sexBox = new JComboBox<>(sexList);
|
||||
pan2.setBounds(150, 50, 160, 130);
|
||||
pan2.setOpaque(false);
|
||||
pan2.setLayout(new FlowLayout(0, 0, 8));
|
||||
pan2.add(nameTextField);
|
||||
pan2.add(idCardTextField);
|
||||
pan2.add(telephoneTextField);
|
||||
pan2.add(sexBox);
|
||||
|
||||
this.add(pan2);
|
||||
this.add(pan1);
|
||||
|
||||
registrationBtn = new JButton("登记", registrationBtnIco);
|
||||
registrationBtn.setFont(font);
|
||||
registrationBtn.setBounds(150, 180, 100, 30);
|
||||
this.add(registrationBtn);
|
||||
|
||||
backBtn = new JButton("<<");
|
||||
backBtn.setFont(font);
|
||||
backBtn.setBounds(0, 0, 70, 30);
|
||||
backBtn.setContentAreaFilled(false); //设置按钮透明
|
||||
backBtn.setBorder(null); //取消边框
|
||||
this.add(backBtn);
|
||||
|
||||
|
||||
setBounds(600, 300, 400, 300);
|
||||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
setVisible(true);
|
||||
setResizable(false);
|
||||
setTitle(getTitle());
|
||||
|
||||
|
||||
registrationBtn.addActionListener(this);
|
||||
backBtn.addActionListener(this);
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
new PassengerRegistration();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (e.getSource() == registrationBtn) {
|
||||
this.dispose();
|
||||
new BuyPage();
|
||||
}
|
||||
if (e.getSource() == backBtn) {
|
||||
this.dispose();
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,117 @@
|
||||
package xjdx.rjxy.airplane.view;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
public class RefundPage extends JFrame implements ActionListener {
|
||||
JTextField nameTextField, idCardTextField, flightNumberTextField;
|
||||
JButton backBtn, OKBtn;
|
||||
private Icon okBtnIco = new ImageIcon("E:\\JavaProjects_IDEA\\Airline Reservation System\\src\\xjdx\\rjxy\\airplane\\view\\images\\OK.png");
|
||||
|
||||
public RefundPage() {
|
||||
super("飞机订票系统 v1.0>>退票");
|
||||
//改变按钮样式
|
||||
try {
|
||||
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (InstantiationException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (UnsupportedLookAndFeelException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
//设置ICO图标
|
||||
Image im;
|
||||
ImageIcon ig = new ImageIcon("E:\\JavaProjects_IDEA\\Airline Reservation System\\src\\xjdx\\rjxy\\airplane\\view\\images\\ico.jpg");//设置图标图片
|
||||
im = ig.getImage();
|
||||
setIconImage(im);
|
||||
//设置背景图
|
||||
ImageIcon icon = new ImageIcon("E:\\JavaProjects_IDEA\\Airline Reservation System\\src\\xjdx\\rjxy\\airplane\\view\\images\\airplane2.png");//背景图
|
||||
JLabel label = new JLabel(icon);//标签中加入图片
|
||||
label.setBounds(0, 0, icon.getIconWidth(), icon.getIconHeight());//设置标签位置大小为图片大小
|
||||
getLayeredPane().add(label, Integer.valueOf(Integer.MIN_VALUE));//标签添加到第二层面板
|
||||
//获取顶层容器设为透明
|
||||
JPanel Panel = (JPanel) getContentPane();
|
||||
Panel.setOpaque(false);
|
||||
getContentPane().setLayout(null);
|
||||
|
||||
Font font = new Font("楷体", Font.TYPE1_FONT, 20);
|
||||
JLabel label1 = new JLabel("请输入以下信息:");
|
||||
label1.setFont(font);
|
||||
label1.setForeground(Color.red);
|
||||
label1.setBounds(0, 20, 180, 30);
|
||||
this.add(label1);
|
||||
|
||||
JLabel nameLab = new JLabel("姓 名:");
|
||||
nameLab.setFont(font);
|
||||
JLabel idCardLab = new JLabel("身份证号:");
|
||||
idCardLab.setFont(font);
|
||||
JLabel flightNumberLab = new JLabel("航 班 号:");
|
||||
flightNumberLab.setFont(font);
|
||||
|
||||
nameTextField = new JTextField(27);
|
||||
idCardTextField = new JTextField(27);
|
||||
flightNumberTextField = new JTextField(27);
|
||||
|
||||
JPanel pan1 = new JPanel();
|
||||
pan1.setBounds(50, 70, 100, 100);
|
||||
pan1.setOpaque(false);
|
||||
pan1.add(nameLab);
|
||||
pan1.add(idCardLab);
|
||||
pan1.add(flightNumberLab);
|
||||
this.add(pan1);
|
||||
|
||||
JPanel pan2 = new JPanel();
|
||||
pan2.setBounds(155, 70, 200, 100);
|
||||
pan2.setOpaque(false);
|
||||
pan2.setLayout(new FlowLayout(0, 0, 7));
|
||||
pan2.add(nameTextField);
|
||||
pan2.add(idCardTextField);
|
||||
pan2.add(flightNumberTextField);
|
||||
this.add(pan2);
|
||||
|
||||
OKBtn = new JButton(okBtnIco);
|
||||
OKBtn.setBounds(125, 185, 150, 30);
|
||||
OKBtn.setFont(font);
|
||||
this.add(OKBtn);
|
||||
|
||||
|
||||
backBtn = new JButton("<<");
|
||||
backBtn.setFont(font);
|
||||
backBtn.setBounds(0, 0, 70, 30);
|
||||
backBtn.setContentAreaFilled(false); //设置按钮透明
|
||||
backBtn.setBorder(null); //取消边框
|
||||
this.add(backBtn);
|
||||
|
||||
setBounds(600, 300, 400, 300);
|
||||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
setVisible(true);
|
||||
setResizable(false);
|
||||
setTitle(getTitle());
|
||||
|
||||
backBtn.addActionListener(this);
|
||||
OKBtn.addActionListener(this);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
new RefundPage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (e.getSource() == backBtn) {
|
||||
this.dispose();
|
||||
}
|
||||
if (e.getSource() == OKBtn) {
|
||||
int res = JOptionPane.showConfirmDialog(null, "是否确认退票", "提示", JOptionPane.YES_OPTION);
|
||||
if (res == JOptionPane.YES_OPTION) {
|
||||
//确认退票后执行的操作
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,155 @@
|
||||
package xjdx.rjxy.airplane.view;
|
||||
|
||||
import xjdx.rjxy.airplane.service.UserService;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
public class Register extends JFrame implements ActionListener {
|
||||
JButton OKBtn, returnBtn, quitBtn;
|
||||
JTextField usernameTextField, passwordField, configPasswordField;
|
||||
// JPasswordField passwordField, configPasswordField;
|
||||
|
||||
private Icon backIco = new ImageIcon("E:\\JavaProjects_IDEA\\Airline Reservation System\\src\\xjdx\\rjxy\\airplane\\view\\images\\列表返回.png");
|
||||
private Icon OKIco = new ImageIcon("E:\\JavaProjects_IDEA\\Airline Reservation System\\src\\xjdx\\rjxy\\airplane\\view\\images\\OKBtnIco.png");
|
||||
private Icon quitIco = new ImageIcon("E:\\JavaProjects_IDEA\\Airline Reservation System\\src\\xjdx\\rjxy\\airplane\\view\\images\\18.退出_关闭.png");
|
||||
|
||||
public Register() {
|
||||
super("飞机订票系统 v1.0>>注册窗口");
|
||||
//改变按钮样式
|
||||
try {
|
||||
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (InstantiationException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (UnsupportedLookAndFeelException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
//设置ICO图标
|
||||
Image im;
|
||||
ImageIcon ig = new ImageIcon("E:\\JavaProjects_IDEA\\Airline Reservation System\\src\\xjdx\\rjxy\\airplane\\view\\images\\ico.jpg");//设置图标图片
|
||||
im = ig.getImage();
|
||||
setIconImage(im);
|
||||
//设置背景图
|
||||
ImageIcon icon = new ImageIcon("E:\\JavaProjects_IDEA\\Airline Reservation System\\src\\xjdx\\rjxy\\airplane\\view\\images\\airplane2.png");//背景图
|
||||
JLabel label = new JLabel(icon);//标签中加入图片
|
||||
label.setBounds(0, 0, icon.getIconWidth(), icon.getIconHeight());//设置标签位置大小为图片大小
|
||||
getLayeredPane().add(label, Integer.valueOf(Integer.MIN_VALUE));//标签添加到第二层面板
|
||||
//获取顶层容器设为透明
|
||||
JPanel Panel = (JPanel) getContentPane();
|
||||
Panel.setOpaque(false);
|
||||
|
||||
getContentPane().setLayout(null);
|
||||
|
||||
JPanel titlePan = new JPanel();
|
||||
titlePan.setOpaque(false);
|
||||
JLabel titleLab = new JLabel("Airline Reservation System");
|
||||
titlePan.setBounds(0, 50, 600, 55);
|
||||
|
||||
Font font = new Font("楷体", Font.TYPE1_FONT, 30);
|
||||
titleLab.setFont(font);
|
||||
titleLab.setForeground(Color.BLACK);
|
||||
|
||||
titlePan.add(titleLab);
|
||||
getContentPane().add(titlePan);
|
||||
|
||||
JPanel pan1 = new JPanel();
|
||||
pan1.setOpaque(false);
|
||||
JLabel usernameLab = new JLabel("Username:");
|
||||
JLabel passwordLab = new JLabel("Password:");
|
||||
JLabel configPasswordLab = new JLabel("Confirm :");
|
||||
|
||||
Font font1 = new Font("楷体", Font.TYPE1_FONT, 20);
|
||||
usernameLab.setFont(font1);
|
||||
passwordLab.setFont(font1);
|
||||
configPasswordLab.setFont(font1);
|
||||
usernameLab.setForeground(Color.BLACK);
|
||||
passwordLab.setForeground(Color.BLACK);
|
||||
configPasswordLab.setForeground(Color.BLACK);
|
||||
pan1.setBounds(150, 150, 100, 150);
|
||||
pan1.add(usernameLab);
|
||||
pan1.add(passwordLab);
|
||||
pan1.add(configPasswordLab);
|
||||
pan1.setLayout(new FlowLayout(0, 0, 10));
|
||||
getContentPane().add(pan1);
|
||||
|
||||
|
||||
JPanel pan2 = new JPanel();
|
||||
pan2.setOpaque(false);
|
||||
usernameTextField = new JTextField(25);
|
||||
usernameTextField.setToolTipText("please enter username");
|
||||
usernameTextField.setOpaque(false);
|
||||
usernameTextField.setEnabled(true);
|
||||
passwordLab.setEnabled(true);
|
||||
passwordField = new JTextField(25);
|
||||
passwordField.setOpaque(false);
|
||||
passwordField.setToolTipText("please enter password");
|
||||
configPasswordField = new JTextField(25);
|
||||
configPasswordField.setOpaque(false);
|
||||
configPasswordField.setToolTipText("please enter password again");
|
||||
pan2.setBounds(280, 150, 200, 150);
|
||||
|
||||
pan2.add(usernameTextField);
|
||||
pan2.add(passwordField);
|
||||
pan2.add(configPasswordField);
|
||||
pan2.setLayout(new FlowLayout(0, 0, 14));
|
||||
getContentPane().add(pan2);
|
||||
|
||||
|
||||
JPanel pan3 = new JPanel();
|
||||
pan3.setOpaque(false);
|
||||
returnBtn = new JButton("Back");
|
||||
returnBtn.setIcon(backIco);
|
||||
OKBtn = new JButton("OK");
|
||||
OKBtn.setIcon(OKIco);
|
||||
quitBtn = new JButton("Quit");
|
||||
quitBtn.setIcon(quitIco);
|
||||
|
||||
pan3.setBounds(90, 330, 500, 50);
|
||||
pan3.setLayout(new FlowLayout(0, 40, 0));
|
||||
|
||||
pan3.add(returnBtn);
|
||||
pan3.add(OKBtn);
|
||||
pan3.add(quitBtn);
|
||||
|
||||
getContentPane().add(pan3);
|
||||
|
||||
|
||||
setBounds(500, 200, 600, 500);
|
||||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
setVisible(true);
|
||||
setResizable(false);
|
||||
setTitle(getTitle());
|
||||
|
||||
OKBtn.addActionListener(this);
|
||||
returnBtn.addActionListener(this);
|
||||
quitBtn.addActionListener(this);
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
Register register = new Register();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (e.getSource() == returnBtn) {
|
||||
new Login();
|
||||
dispose();
|
||||
}
|
||||
if (e.getSource() == quitBtn) {
|
||||
System.exit(0);
|
||||
}
|
||||
if (e.getSource() == OKBtn) {
|
||||
String username = usernameTextField.getText();
|
||||
String password1 = passwordField.getText();
|
||||
String password2 = configPasswordField.getText();
|
||||
UserService.UserRegister(username, password1, password2);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,113 @@
|
||||
package xjdx.rjxy.airplane.view;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
public class ShowOrder extends JFrame implements ActionListener {
|
||||
|
||||
JTextField nameTextField, idCardTextField;
|
||||
JButton backBtn, OKBtn;
|
||||
private Icon okBtnIco = new ImageIcon("E:\\JavaProjects_IDEA\\Airline Reservation System\\src\\xjdx\\rjxy\\airplane\\view\\images\\OK.png");
|
||||
|
||||
public ShowOrder() {
|
||||
super("飞机订票系统 v1.0>>订单查询");
|
||||
//改变按钮样式
|
||||
try {
|
||||
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (InstantiationException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (UnsupportedLookAndFeelException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
//设置ICO图标
|
||||
Image im;
|
||||
ImageIcon ig = new ImageIcon("E:\\JavaProjects_IDEA\\Airline Reservation System\\src\\xjdx\\rjxy\\airplane\\view\\images\\ico.jpg");//设置图标图片
|
||||
im = ig.getImage();
|
||||
setIconImage(im);
|
||||
//设置背景图
|
||||
ImageIcon icon = new ImageIcon("E:\\JavaProjects_IDEA\\Airline Reservation System\\src\\xjdx\\rjxy\\airplane\\view\\images\\airplane2.png");//背景图
|
||||
JLabel label = new JLabel(icon);//标签中加入图片
|
||||
label.setBounds(0, 0, icon.getIconWidth(), icon.getIconHeight());//设置标签位置大小为图片大小
|
||||
getLayeredPane().add(label, Integer.valueOf(Integer.MIN_VALUE));//标签添加到第二层面板
|
||||
//获取顶层容器设为透明
|
||||
JPanel Panel = (JPanel) getContentPane();
|
||||
Panel.setOpaque(false);
|
||||
getContentPane().setLayout(null);
|
||||
|
||||
Font font = new Font("楷体", Font.TYPE1_FONT, 20);
|
||||
JLabel label1 = new JLabel("请输入以下信息:");
|
||||
label1.setFont(font);
|
||||
label1.setForeground(Color.red);
|
||||
label1.setBounds(0, 20, 180, 30);
|
||||
this.add(label1);
|
||||
|
||||
JLabel nameLab = new JLabel("姓 名:");
|
||||
nameLab.setFont(font);
|
||||
nameLab.setForeground(Color.LIGHT_GRAY);
|
||||
JLabel idCardLab = new JLabel("身份证号:");
|
||||
idCardLab.setFont(font);
|
||||
|
||||
nameTextField = new JTextField("不可编辑状态...等待修复", 27);
|
||||
nameTextField.setForeground(Color.LIGHT_GRAY);
|
||||
idCardTextField = new JTextField(27);
|
||||
nameTextField.setEditable(false); //设置不可编辑
|
||||
|
||||
|
||||
JPanel pan1 = new JPanel();
|
||||
pan1.setBounds(50, 70, 100, 100);
|
||||
pan1.setOpaque(false);
|
||||
pan1.add(nameLab);
|
||||
pan1.add(idCardLab);
|
||||
this.add(pan1);
|
||||
|
||||
JPanel pan2 = new JPanel();
|
||||
pan2.setBounds(155, 70, 200, 100);
|
||||
pan2.setOpaque(false);
|
||||
pan2.setLayout(new FlowLayout(0, 0, 7));
|
||||
pan2.add(nameTextField);
|
||||
pan2.add(idCardTextField);
|
||||
this.add(pan2);
|
||||
|
||||
OKBtn = new JButton(okBtnIco);
|
||||
OKBtn.setBounds(125, 185, 150, 30);
|
||||
OKBtn.setFont(font);
|
||||
this.add(OKBtn);
|
||||
|
||||
|
||||
backBtn = new JButton("<<");
|
||||
backBtn.setFont(font);
|
||||
backBtn.setBounds(0, 0, 70, 30);
|
||||
backBtn.setContentAreaFilled(false); //设置按钮透明
|
||||
backBtn.setBorder(null); //取消边框
|
||||
this.add(backBtn);
|
||||
|
||||
setBounds(600, 300, 400, 300);
|
||||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
setVisible(true);
|
||||
setResizable(false);
|
||||
setTitle(getTitle());
|
||||
|
||||
backBtn.addActionListener(this);
|
||||
OKBtn.addActionListener(this);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
new ShowOrder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (e.getSource() == backBtn) {
|
||||
this.dispose();
|
||||
}
|
||||
if (e.getSource() == OKBtn) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,206 @@
|
||||
package xjdx.rjxy.airplane.view;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
public class UserInfo extends JFrame implements ActionListener {
|
||||
|
||||
JTextField ageTextField, homeTextField, telephoneTextField;
|
||||
JComboBox<String> sexBox, yearBox, monthBox;
|
||||
|
||||
JButton modifyBtn, saveBtn, backBtn;
|
||||
String sex[] = {null, "男", "女", "保密"};
|
||||
String year[] = {null, "保密", "1995", "1996", "1997", "1998", "1999", "2000", "2001", "2002", "2003", "2004", "2005", "2006", "2007", "2008", "2009", "2010", "2012", "2013", "2015", "2016", "2017", "2018", "2019", "2020", "2021", "2022", "2023"};
|
||||
String month[] = {null, "保密", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"};
|
||||
|
||||
private Icon saveBtnIco = new ImageIcon("E:\\JavaProjects_IDEA\\Airline Reservation System\\src\\xjdx\\rjxy\\airplane\\view\\images\\savebtn.png");
|
||||
private Icon modifyBtnIco = new ImageIcon("E:\\JavaProjects_IDEA\\Airline Reservation System\\src\\xjdx\\rjxy\\airplane\\view\\images\\modifyBtn.png");
|
||||
|
||||
public UserInfo() {
|
||||
super("飞机订票系统 v1.0>>当前用户信息");
|
||||
//改变按钮样式
|
||||
try {
|
||||
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (InstantiationException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (UnsupportedLookAndFeelException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
//设置ICO图标
|
||||
Image im;
|
||||
ImageIcon ig = new ImageIcon("E:\\JavaProjects_IDEA\\Airline Reservation System\\src\\xjdx\\rjxy\\airplane\\view\\images\\ico.jpg");//设置图标图片
|
||||
im = ig.getImage();
|
||||
setIconImage(im);
|
||||
//设置背景图
|
||||
ImageIcon icon = new ImageIcon("E:\\JavaProjects_IDEA\\Airline Reservation System\\src\\xjdx\\rjxy\\airplane\\view\\images\\airplane2.png");//背景图
|
||||
JLabel label = new JLabel(icon);//标签中加入图片
|
||||
label.setBounds(0, 0, icon.getIconWidth(), icon.getIconHeight());//设置标签位置大小为图片大小
|
||||
getLayeredPane().add(label, Integer.valueOf(Integer.MIN_VALUE));//标签添加到第二层面板
|
||||
//获取顶层容器设为透明
|
||||
JPanel Panel = (JPanel) getContentPane();
|
||||
Panel.setOpaque(false);
|
||||
getContentPane().setLayout(null);
|
||||
|
||||
SimpleDateFormat sdf = new SimpleDateFormat();// 格式化时间
|
||||
sdf.applyPattern("yyyy-MM-dd HH:mm:ss a");// a为am/pm的标记
|
||||
Date date = new Date();// 获取当前时间
|
||||
|
||||
Font font = new Font("楷体", Font.TYPE1_FONT, 20);
|
||||
|
||||
JLabel userLab = new JLabel("用户:");
|
||||
JLabel user = new JLabel(Login.usernameTextField.getText());
|
||||
user.setBounds(150, 7, 100, 20);
|
||||
this.add(user);
|
||||
//sdf.format(date)
|
||||
JLabel time = new JLabel(sdf.format(date));
|
||||
time.setBounds(150, 180, 200, 20);
|
||||
this.add(time);
|
||||
|
||||
userLab.setFont(font);
|
||||
JLabel ageLab = new JLabel("年龄:");
|
||||
ageLab.setFont(font);
|
||||
JLabel sexLab = new JLabel("性别:");
|
||||
sexLab.setFont(font);
|
||||
JLabel birthDayLab = new JLabel("生日:");
|
||||
birthDayLab.setFont(font);
|
||||
JLabel homeLab = new JLabel("地址:");
|
||||
homeLab.setFont(font);
|
||||
JLabel telephoneLab = new JLabel("电话:");
|
||||
telephoneLab.setFont(font);
|
||||
JLabel timeLab = new JLabel("时间:");
|
||||
//sdf.format(date)
|
||||
timeLab.setFont(font);
|
||||
JPanel pan1 = new JPanel();
|
||||
pan1.setBounds(80, 0, 50, 200);
|
||||
pan1.setOpaque(false);
|
||||
pan1.add(userLab);
|
||||
pan1.add(ageLab);
|
||||
pan1.add(sexLab);
|
||||
pan1.add(birthDayLab);
|
||||
pan1.add(homeLab);
|
||||
pan1.add(telephoneLab);
|
||||
pan1.add(timeLab);
|
||||
this.add(pan1);
|
||||
|
||||
JLabel yearLab = new JLabel("年");
|
||||
// yearLab.setFont(font);
|
||||
JLabel monthLab = new JLabel("月");
|
||||
// monthLab.setFont(font);
|
||||
|
||||
ageTextField = new JTextField(20);
|
||||
ageTextField.setToolTipText("点击修改按钮进行修改");
|
||||
ageTextField.setEditable(false);
|
||||
|
||||
sexBox = new JComboBox(sex);
|
||||
sexBox.setToolTipText("点击修改按钮进行修改");
|
||||
sexBox.setEnabled(false);
|
||||
yearBox = new JComboBox<>(year);
|
||||
yearBox.setToolTipText("点击修改按钮进行修改");
|
||||
yearBox.setEnabled(false);
|
||||
monthBox = new JComboBox<>(month);
|
||||
monthBox.setToolTipText("点击修改按钮进行修改");
|
||||
monthBox.setEnabled(false);
|
||||
|
||||
homeTextField = new JTextField(20);
|
||||
homeTextField.setToolTipText("点击修改按钮进行修改");
|
||||
homeTextField.setEditable(false);
|
||||
|
||||
telephoneTextField = new JTextField(20);
|
||||
telephoneTextField.setToolTipText("点击修改按钮进行修改");
|
||||
telephoneTextField.setEditable(false);
|
||||
|
||||
JPanel panel = new JPanel();
|
||||
panel.setBounds(150, 30, 140, 55);
|
||||
panel.setLayout(new FlowLayout(0, 0, 7));
|
||||
panel.setOpaque(false);
|
||||
panel.add(ageTextField);
|
||||
panel.add(sexBox);
|
||||
this.add(panel);
|
||||
|
||||
|
||||
JPanel panel1 = new JPanel();
|
||||
panel1.setBounds(150, 85, 150, 95);
|
||||
panel1.setOpaque(false);
|
||||
panel1.setLayout(new FlowLayout(0, 0, 8));
|
||||
panel1.add(yearBox);
|
||||
panel1.add(yearLab);
|
||||
panel1.add(monthBox);
|
||||
panel1.add(monthLab);
|
||||
panel1.add(homeTextField);
|
||||
panel1.add(telephoneTextField);
|
||||
this.add(panel1);
|
||||
|
||||
modifyBtn = new JButton("修改", modifyBtnIco);
|
||||
modifyBtn.setFont(font);
|
||||
saveBtn = new JButton("保存", saveBtnIco);
|
||||
saveBtn.setFont(font);
|
||||
|
||||
JPanel panel2 = new JPanel();
|
||||
panel2.setBounds(50, 200, 300, 50);
|
||||
panel2.setOpaque(false);
|
||||
panel2.setLayout(new FlowLayout());
|
||||
panel2.add(modifyBtn);
|
||||
panel2.add(saveBtn);
|
||||
this.add(panel2);
|
||||
|
||||
backBtn = new JButton("<<");
|
||||
backBtn.setFont(font);
|
||||
backBtn.setBounds(0, 0, 70, 30);
|
||||
backBtn.setContentAreaFilled(false); //设置按钮透明
|
||||
backBtn.setBorder(null); //取消边框
|
||||
this.add(backBtn);
|
||||
|
||||
|
||||
setBounds(600, 300, 400, 300);
|
||||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
setVisible(true);
|
||||
setResizable(false);
|
||||
setTitle(getTitle());
|
||||
|
||||
modifyBtn.addActionListener(this);
|
||||
saveBtn.addActionListener(this);
|
||||
backBtn.addActionListener(this);
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
new UserInfo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (e.getSource() == modifyBtn) {
|
||||
ageTextField.setEditable(true);
|
||||
sexBox.setEnabled(true);
|
||||
yearBox.setEnabled(true);
|
||||
monthBox.setEnabled(true);
|
||||
homeTextField.setEditable(true);
|
||||
telephoneTextField.setEditable(true);
|
||||
}
|
||||
if (e.getSource() == saveBtn) {
|
||||
ageTextField.setText(ageTextField.getText());
|
||||
ageTextField.setEditable(false);
|
||||
sexBox.setSelectedIndex(sexBox.getSelectedIndex());
|
||||
sexBox.setEnabled(false);
|
||||
yearBox.setSelectedIndex(yearBox.getSelectedIndex());
|
||||
yearBox.setEnabled(false);
|
||||
monthBox.setSelectedIndex(monthBox.getSelectedIndex());
|
||||
monthBox.setEnabled(false);
|
||||
homeTextField.setText(homeTextField.getText());
|
||||
homeTextField.setEditable(false);
|
||||
telephoneTextField.setText(telephoneTextField.getText());
|
||||
telephoneTextField.setEditable(false);
|
||||
}
|
||||
if (e.getSource() == backBtn) {
|
||||
this.setVisible(false);
|
||||
}
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 674 B |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 722 B |
After Width: | Height: | Size: 797 B |
After Width: | Height: | Size: 245 KiB |
After Width: | Height: | Size: 164 KiB |
After Width: | Height: | Size: 214 KiB |
After Width: | Height: | Size: 291 KiB |
After Width: | Height: | Size: 262 KiB |
After Width: | Height: | Size: 188 KiB |
After Width: | Height: | Size: 294 KiB |
After Width: | Height: | Size: 341 KiB |
After Width: | Height: | Size: 388 KiB |
After Width: | Height: | Size: 322 KiB |
After Width: | Height: | Size: 372 KiB |
After Width: | Height: | Size: 43 KiB |
After Width: | Height: | Size: 198 KiB |
After Width: | Height: | Size: 38 KiB |
After Width: | Height: | Size: 4.5 KiB |
After Width: | Height: | Size: 332 KiB |
After Width: | Height: | Size: 703 B |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 648 B |
After Width: | Height: | Size: 2.5 KiB |
After Width: | Height: | Size: 631 B |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 897 B |
After Width: | Height: | Size: 510 B |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 8.3 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 674 B |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 722 B |
After Width: | Height: | Size: 797 B |
After Width: | Height: | Size: 245 KiB |
After Width: | Height: | Size: 164 KiB |
After Width: | Height: | Size: 214 KiB |
After Width: | Height: | Size: 291 KiB |
After Width: | Height: | Size: 262 KiB |
After Width: | Height: | Size: 188 KiB |
After Width: | Height: | Size: 294 KiB |
After Width: | Height: | Size: 341 KiB |
After Width: | Height: | Size: 388 KiB |
After Width: | Height: | Size: 322 KiB |
After Width: | Height: | Size: 372 KiB |
After Width: | Height: | Size: 43 KiB |
After Width: | Height: | Size: 198 KiB |
After Width: | Height: | Size: 38 KiB |
After Width: | Height: | Size: 4.5 KiB |
After Width: | Height: | Size: 332 KiB |
After Width: | Height: | Size: 703 B |
After Width: | Height: | Size: 1.6 KiB |