first commit

master
fatheryue 5 years ago
commit 78f65e9493

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="11" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/secondhanhands.iml" filepath="$PROJECT_DIR$/secondhanhands.iml" />
</modules>
</component>
</project>

@ -0,0 +1,124 @@
<?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.png" 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.png" 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.png" 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.png" 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.png" 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.png" 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.png" 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.png" 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.png" 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.png" 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.png" 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.png" 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.png" 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.png" 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.png" 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.png" 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.png" 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.png" 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.png" 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.png" 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.png" 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.png" 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.png" 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.png" 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.png" 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.png" 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.png" 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>
</project>

@ -0,0 +1,166 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="61ec644a-7cfe-4205-a727-9c3a7d26de5d" name="Default Changelist" comment="" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="CoverageViewManager">
<option name="myElementSize" value="221" />
</component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="Class" />
</list>
</option>
</component>
<component name="ProjectId" id="1eJ9mK7h7yM0134C7vnJHK797RB" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showExcludedFiles" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
<property name="last_opened_file_path" value="C:/kcsj-master" />
<property name="project.structure.last.edited" value="Modules" />
<property name="project.structure.proportion" value="0.0" />
<property name="project.structure.side.proportion" value="0.0" />
<property name="restartRequiresConfirmation" value="false" />
<property name="settings.editor.selected.configurable" value="editor.preferences.fonts.default" />
</component>
<component name="RunManager" selected="Application.denglu">
<configuration name="Main" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="Main.Main" />
<module name="secondhanhands" />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="Main.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="denglu" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="Main.denglu" />
<module name="secondhanhands" />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="Main.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="liulan" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="Main.liulan" />
<module name="secondhanhands" />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="Main.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<recent_temporary>
<list>
<item itemvalue="Application.denglu" />
<item itemvalue="Application.liulan" />
<item itemvalue="Application.Main" />
</list>
</recent_temporary>
</component>
<component name="SvnConfiguration">
<configuration />
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="61ec644a-7cfe-4205-a727-9c3a7d26de5d" name="Default Changelist" comment="" />
<created>1594028985553</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1594028985553</updated>
</task>
<servers />
</component>
<component name="WindowStateProjectService">
<state x="361" y="74" key="#Notifications" timestamp="1594090705562">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state x="361" y="74" key="#Notifications/0.0.1536.824@0.0.1536.824" timestamp="1594090705562" />
<state x="361" y="74" key="#Project_Structure" timestamp="1594028999445">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state x="361" y="74" key="#Project_Structure/0.0.1536.824@0.0.1536.824" timestamp="1594028999445" />
<state x="574" y="121" key="#com.intellij.ide.util.MemberChooser" timestamp="1594201337011">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state x="574" y="121" key="#com.intellij.ide.util.MemberChooser/0.0.1536.824@0.0.1536.824" timestamp="1594201337011" />
<state x="553" y="302" width="429" height="225" key="#com.intellij.refactoring.move.moveClassesOrPackages.MoveClassesOrPackagesDialog.classes" timestamp="1594293156480">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state x="553" y="302" width="429" height="225" key="#com.intellij.refactoring.move.moveClassesOrPackages.MoveClassesOrPackagesDialog.classes/0.0.1536.824@0.0.1536.824" timestamp="1594293156480" />
<state x="549" y="170" key="FileChooserDialogImpl" timestamp="1594300128223">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state x="549" y="170" key="FileChooserDialogImpl/0.0.1536.824@0.0.1536.824" timestamp="1594300128223" />
<state width="1493" height="210" key="GridCell.Tab.0.bottom" timestamp="1594301513386">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state width="1493" height="210" key="GridCell.Tab.0.bottom/0.0.1536.824@0.0.1536.824" timestamp="1594301513386" />
<state width="1493" height="210" key="GridCell.Tab.0.center" timestamp="1594301513385">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state width="1493" height="210" key="GridCell.Tab.0.center/0.0.1536.824@0.0.1536.824" timestamp="1594301513385" />
<state width="1493" height="210" key="GridCell.Tab.0.left" timestamp="1594301513384">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state width="1493" height="210" key="GridCell.Tab.0.left/0.0.1536.824@0.0.1536.824" timestamp="1594301513384" />
<state width="1493" height="210" key="GridCell.Tab.0.right" timestamp="1594301513385">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state width="1493" height="210" key="GridCell.Tab.0.right/0.0.1536.824@0.0.1536.824" timestamp="1594301513385" />
<state width="1493" height="261" key="GridCell.Tab.1.bottom" timestamp="1594204444028">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state width="1493" height="261" key="GridCell.Tab.1.bottom/0.0.1536.824@0.0.1536.824" timestamp="1594204444028" />
<state width="1493" height="261" key="GridCell.Tab.1.center" timestamp="1594204444028">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state width="1493" height="261" key="GridCell.Tab.1.center/0.0.1536.824@0.0.1536.824" timestamp="1594204444028" />
<state width="1493" height="261" key="GridCell.Tab.1.left" timestamp="1594204444028">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state width="1493" height="261" key="GridCell.Tab.1.left/0.0.1536.824@0.0.1536.824" timestamp="1594204444028" />
<state width="1493" height="261" key="GridCell.Tab.1.right" timestamp="1594204444028">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state width="1493" height="261" key="GridCell.Tab.1.right/0.0.1536.824@0.0.1536.824" timestamp="1594204444028" />
<state x="272" y="57" key="SettingsEditor" timestamp="1594032828757">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state x="272" y="57" key="SettingsEditor/0.0.1536.824@0.0.1536.824" timestamp="1594032828757" />
<state x="431" y="145" width="672" height="678" key="search.everywhere.popup" timestamp="1594204928238">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state x="431" y="145" width="672" height="678" key="search.everywhere.popup/0.0.1536.824@0.0.1536.824" timestamp="1594204928238" />
</component>
<component name="com.intellij.coverage.CoverageDataManagerImpl">
<SUITE FILE_PATH="coverage/secondhanhands$denglu.ic" NAME="denglu Coverage Results" MODIFIED="1594297491300" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="idea" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false">
<FILTER>Main.*</FILTER>
</SUITE>
<SUITE FILE_PATH="coverage/secondhanhands$liulan.ic" NAME="liulan Coverage Results" MODIFIED="1594196151364" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="idea" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false">
<FILTER>Main.*</FILTER>
</SUITE>
</component>
</project>

@ -0,0 +1,11 @@
<?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="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

@ -0,0 +1,25 @@
package Main;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.ArrayList;
public class Fuk {
public Fuk() {}
public String fukuan(Double... dou) {
double sum = 0.0;
if (dou.length == 0) {
sum = 0.0;
} else {
for (int i = 0; i < dou.length; i++) {
sum += dou[i];
}
}
return "" + sum;
}
}

@ -0,0 +1,55 @@
package Main;
import java.util.ArrayList;
public class Js {
int x;
private String[] name;
private double[] price;
private String[] timer;
public Js(Object... obj) {
this.x = obj.length;
this.name = new String[obj.length];
this.price = new double[obj.length];
this.timer = new String[obj.length];
}
//计算总价格的方法
public void js_price(Double... dou) {
for (int i = 0; i < x; i++) {
price[i] = dou[i];
}
}
public void getNames(String... names) {
int i = 0;
for (String s : names) {
name[i] = s;
i++;
}
}
public void getTimer(String... timers) {
int i = 0;
for (String s : timers) {
timer[i] = s;
i++;
}
}
public ArrayList<String> returnInf() {
ArrayList<String> list = new ArrayList<>();
for (int i = 0; i < x; i++) {
list.add("名称:" + name[i] + " 价格:" + price[i] + " 使用时间:" + timer[i]);
}
return list;
}
}

@ -0,0 +1,39 @@
package Main;
public class Things {
private String name;
private double price;
private String timer;
public Things() {}
public Things(String name, double price, String timer) {
this.name = name;
this.price = price;
this.timer = timer;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
public String getTimer() {
return timer;
}
public void setTimer(String timer) {
this.timer = timer;
}
}

@ -0,0 +1,84 @@
package Main;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.Scanner;
public class denglu extends JFrame {
int num;
String t;
String[] userBox = {"555", "123456"};
public static void main(String[] args) {
denglu m = new denglu();
JFrame frame = new JFrame();
Container container = frame.getContentPane();
frame.setTitle("兰州交通大学二手物品交易系统");
frame.setBounds(0,0,600,600);
ImageIcon image=new ImageIcon("C://001.jpg");
JLabel label=new JLabel(image);
ImageIcon image2=new ImageIcon("C://006.gif");
JLabel label2=new JLabel(image2);
ImageIcon image3=new ImageIcon("C://007.gif");
JLabel label3=new JLabel(image3);
ImageIcon image4=new ImageIcon("C://005.gif");
JLabel label4=new JLabel(image4);
frame.setLayout(null);
frame.add(label);
frame.add(label2);
frame.add(label3);
frame.add(label4);
label.setBounds(0,0,600,600);
label2.setBounds(425,0,150,125);
label3.setBounds(50,0,150,125);
label4.setBounds(237,0,150,125);
JButton bu1 = new JButton("点击此处进入二手物品小市场");
bu1.setBounds(150,500,300,40);
bu1.setForeground(Color.black);
container.add(bu1);
bu1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
frame.dispose();
new liulan();
}
});
Scanner input = new Scanner(System.in);
boolean userNameExist = false;
boolean loginSuccess = true;
do {
System.out.println("请输入账号:");
String user = input.nextLine();
System.out.println("请输入密码:");
String password = input.nextLine();
if (m.userBox[0].equals(user)) {
if (m.userBox[1].equals(password)) {
JOptionPane.showMessageDialog(null, "登录成功!");
frame.setVisible(true);
frame.setResizable(false);
loginSuccess = true;
} else {
loginSuccess = false;
JOptionPane.showMessageDialog(null, "密码用户名错误!");
}
userNameExist = true;
} else {
userNameExist = false;
JOptionPane.showMessageDialog(null, "密码用户名错误!");
}
}while((userNameExist!=true)||((userNameExist==true)&&(loginSuccess!=true)));
frame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
}
}

@ -0,0 +1,30 @@
package Main;
import javax.swing.*;
import java.awt.*;
public class fukGui {
fukGui() {
denglu m = new denglu();
JFrame frame = new JFrame();
Container container = frame.getContentPane();
frame.setTitle("付款界面");
frame.setBounds(0, 0, 600, 600);
ImageIcon image = new ImageIcon("C://015.jpg");
JLabel label = new JLabel(image);
ImageIcon image2 = new ImageIcon("C://014.jpg");
JLabel label2 = new JLabel(image2);
frame.setLayout(null);
frame.add(label);
frame.add(label2);
label.setBounds(13, 0, 600, 300);
label2.setBounds(50, 125, 500, 500);
JButton bu1 = new JButton("请选择您的付款方式微信支付or支付宝");
bu1.setBounds(150, 500, 300, 40);
bu1.setForeground(Color.black);
bu1.setBackground(Color.white);
container.add(bu1);
frame.setVisible(true);
}
}

@ -0,0 +1,146 @@
package Main;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.ArrayList;
public class liulan extends JFrame {
liulan() {
JFrame frame = new JFrame();
JPanel panel = new JPanel();
final JTextArea textArea = new JTextArea("编号001 " + "\r\n", 5, 10);
textArea.append("名称:水浒传" + "\r\n");
textArea.append("使用时间:2年" + "\r\n");
textArea.append("价格60¥" + "\r\n");
final JTextArea textArea2 = new JTextArea("编号002 " + "\r\n", 5, 10);
textArea2.append("名称:西游记" + "\r\n");
textArea2.append("使用时间1年" + "\r\n");
textArea2.append("价格120¥" + "\r\n");
textArea2.setForeground(Color.black);
textArea2.setBackground(Color.blue);
textArea.setForeground(Color.black);
textArea.setBackground(Color.green);
JButton bu1 = new JButton("购物车");
JButton bu2 = new JButton("加入购物车");
JButton bu3 = new JButton("加入购物车");
JButton bu4 = new JButton("结算");
ImageIcon image = new ImageIcon("C://004.jpg");
ImageIcon image2 = new ImageIcon("C://005.jpg");
JLabel label = new JLabel(image);
JLabel label2 = new JLabel(image2);
Container container = frame.getContentPane();
frame.setTitle("兰州交通大学二手物品交易系统");
frame.setBounds(0, 0, 1000, 800);
frame.setLayout(null);
label.setBounds(0, 0, 500, 500);
label2.setBounds(500, 0, 500, 500);
bu1.setBounds(800, 700, 150, 50);
bu1.setForeground(Color.black);
bu1.setBackground(Color.white);
bu2.setBounds(240, 600, 150, 50);
bu2.setForeground(Color.black);
bu2.setBackground(Color.white);
bu3.setBounds(700, 600, 150, 50);
bu3.setForeground(Color.black);
bu3.setBackground(Color.white);
bu4.setBounds(600,700,150,50);
bu4.setForeground(Color.black);
bu4.setBackground(Color.white);
frame.add(label);
frame.add(label2);
textArea.setBounds(240, 500, 100, 65);
textArea2.setBounds(700, 500, 100, 65);
frame.add(textArea);
frame.add(textArea2);
Component add = container.add(bu1);
Component add2 = container.add(bu2);
Component add3 = container.add(bu3);
Component add4 = container.add(bu4);
frame.setVisible(true);
frame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
Things shuihuzhuan = new Things("水浒传", 60.0, "2年");
Things xiyouji = new Things("西游记", 120.0, "1年");
ArrayList<Things> list = new ArrayList<>();
bu1.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent actionEvent) {
int x = 0;
Things s1 = new Things();
Things s2 = new Things();
ArrayList<String> list1;
for (Things s : list) {
if (x == 0) {
s1 = s;
} else {
s2 = s;
}
x ++;
}
Js js = new Js(s1, s2);
js.js_price(s1.getPrice(),s2.getPrice());
js.getNames(s1.getName(),s2.getName());
js.getTimer(s1.getTimer(),s2.getTimer());
list1 = js.returnInf();
for (String s :
list1) {
System.out.println(s);
}
JOptionPane.showMessageDialog(null, "已为您在后台打开购物车");
}
});
bu2.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent actionEvent) {
list.add(shuihuzhuan);
JOptionPane.showMessageDialog(null, "加入购物车成功!");
}
});
bu3.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent actionEvent) {
list.add(xiyouji);
JOptionPane.showMessageDialog(null, "加入购物车成功!");
}
});
bu4.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent actionEvent) {
int x = 0;
Things s1 = new Things();
Things s2 = new Things();
ArrayList<String> list1;
for (Things s : list) {
if (x == 0) {
s1 = s;
} else {
s2 = s;
}
x ++;
}
Fuk fu = new Fuk();
System.out.println("您总共需付:");
System.out.println(fu.fukuan(s1.getPrice(), s2.getPrice())+"¥");
frame.dispose();
new fukGui();
JOptionPane.showMessageDialog(null, "已为您在后台结算!");
}
});
}
}
Loading…
Cancel
Save