📄 insoftcompany.java
字号:
package softwarecompanyserver;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.net.*;
import java.util.*;
import javax.swing.*;
import java.awt.Rectangle;
import java.awt.Font;
public class inSoftCompany extends JDialog {
private Socket socket;
private DataInputStream in;
private DataOutputStream out;
private Company aCompany ;
private Item aItem;
private String str; //标识投资项目的公司
private String itemInfo;
private double income ;
private String time; //开发时间
private double loan;
String comName ;
String comAccount;
String comId ;
String comNum;
String comTime ;
String comInfo ;
JPanel contentPanel = new JPanel();
JTabbedPane jTabbedPane1 = new JTabbedPane();
JPanel investPanel = new JPanel();
JTabbedPane jTabbedPane2 = new JTabbedPane();
JPanel jPanel3 = new JPanel();
JPanel jPanel4 = new JPanel();
JPanel jPanel5 = new JPanel();
JPanel jPanel6 = new JPanel();
JPanel jPanel7 = new JPanel();
JPanel jPanel8 = new JPanel();
JButton okButton = new JButton();
JButton noButton = new JButton();
JLabel jLabel1 = new JLabel();
JLabel jLabel2 = new JLabel();
JLabel jLabel3 = new JLabel();
JLabel jLabel4 = new JLabel();
JLabel jLabel5 = new JLabel();
JTextField nameField = new JTextField();
JTextField idField = new JTextField();
JTextField classifyField = new JTextField();
JTextField timeField = new JTextField();
JTextField moneyField = new JTextField();
JPanel jPanel9 = new JPanel();
JTextArea itemArea = new JTextArea();
JScrollPane jScrollPane1 = new JScrollPane();
JButton jButton3 = new JButton();
JButton analyzeButton = new JButton();
JPanel jPanel10 = new JPanel();
JPanel jPanel11 = new JPanel();
JTextArea sellArea = new JTextArea();
JButton sellButton = new JButton();
JButton jButton6 = new JButton();
JButton aboutButton = new JButton();
JTextField companyNameField = new JTextField();
JPanel companyInfoPanel = new JPanel();
JPanel jPanel13 = new JPanel();
JPanel jPanel14 = new JPanel();
JLabel jLabel6 = new JLabel();
JPanel jPanel15 = new JPanel();
JLabel jLabel7 = new JLabel();
JTextField comIdField = new JTextField();
JPanel jPanel16 = new JPanel();
JLabel jLabel8 = new JLabel();
JTextField comAccountField = new JTextField();
JPanel jPanel17 = new JPanel();
JLabel jLabel9 = new JLabel();
JTextField comNumField = new JTextField();
JPanel jPanel18 = new JPanel();
JTextField comTimeField = new JTextField();
JLabel jLabel10 = new JLabel();
GridLayout gridLayout1 = new GridLayout();
GridLayout gridLayout2 = new GridLayout();
GridLayout gridLayout3 = new GridLayout();
GridLayout gridLayout4 = new GridLayout();
GridLayout gridLayout5 = new GridLayout();
JTextField comNameField = new JTextField();
JPanel jPanel19 = new JPanel();
JPanel jPanel20 = new JPanel();
JPanel jPanel21 = new JPanel();
JLabel jLabel11 = new JLabel();
BorderLayout borderLayout1 = new BorderLayout();
JScrollPane jScrollPane2 = new JScrollPane();
JTextArea jTextArea1 = new JTextArea();
JButton modifyButton = new JButton();
JButton cancelButton = new JButton();
JButton startButton = new JButton();
JPanel jPanel2 = new JPanel();
JLabel jLabel12 = new JLabel();
JPanel jPanel22 = new JPanel();
JLabel jLabel13 = new JLabel();
JLabel jLabel14 = new JLabel();
JLabel jLabel15 = new JLabel();
JLabel jLabel16 = new JLabel();
JLabel jLabel17 = new JLabel();
JTextField jTextField1 = new JTextField();
JTextField jTextField2 = new JTextField();
JTextField jTextField3 = new JTextField();
JTextField jTextField4 = new JTextField();
JTextField jTextField5 = new JTextField();
JButton paintButton = new JButton();
FlowLayout flowLayout1 = new FlowLayout();
JButton exitButton = new JButton();
JScrollPane jScrollPane3 = new JScrollPane();
public inSoftCompany(Frame owner, String title, boolean modal,Socket s,Company c) //新建公司构造函数
{
super(owner, title, modal);
jbInit();
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
socket = s;
aCompany = c;
try {
in = new DataInputStream(socket.getInputStream());
out = new DataOutputStream(socket.getOutputStream());
} catch (IOException ex) {
System.out.println(ex.toString());
}
CompanyDA.initialize();
boolean find = CompanyDA.find(aCompany.getId());
if (find == true)
try {
out.writeBoolean(true);
} catch (IOException ex) {
System.out.println(ex.getMessage());
}
else
{
JOptionPane.showMessageDialog(this, "一个新公司注册!");
try {
out.writeBoolean(false);
} catch (IOException ex) {
System.out.println(ex.toString());
}
CompanyDA.addNew(aCompany);
CompanyDA.terminate();
companyNameField.setText(aCompany.getName());
comIdField.setText(aCompany.getId());
comAccountField.setText(aCompany.getAccount());
comNumField.setText(aCompany.getNum());
comTimeField.setText(aCompany.getTime());
comNameField.setText(aCompany.getName());
jTextArea1.setText(aCompany.getInfo());
investPanel.setEnabled(false);
this.setSize(456, 400);
this.setLocation(350, 180);
this.setVisible(true);
}
}
/////////////////////////////////////////////////////////////////新建项目构造函数
public inSoftCompany(Socket s,Item item ,String x)
{
jbInit();
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
socket = s;
aItem = item;
str = x;
CompanyDA.initialize();
aCompany = new Company();
aCompany = CompanyDA.findcompany(str);
CompanyDA.terminate();
try {
in = new DataInputStream(socket.getInputStream());
out = new DataOutputStream(socket.getOutputStream());
} catch (IOException ex) {
System.out.println(ex.toString());
}
comName = aCompany.getName();
comAccount = aCompany.getAccount();
comId = aCompany.getId();
comNum = aCompany.getNum();
comTime = aCompany.getTime();
comInfo = aCompany.getInfo();
nameField.setText(aItem.getName());
idField.setText(aItem.getId());
classifyField.setText(aItem.getClassify());
timeField.setText(aItem.getTime());
moneyField.setText(aItem.getMoney());
companyNameField.setText(comName);
comIdField.setText(comId);
comAccountField.setText(comAccount);
comNumField.setText(comNum);
comTimeField.setText(comTime);
comNameField.setText(comName);
jTextArea1.setText(comInfo);
System.out.println("iteminfo"+itemInfo);
this.setSize(456, 400);
this.setLocation(350, 180);
this.setVisible(true);
}
public inSoftCompany(Socket s,Company c) {
this(new Frame(), "inSoftCompany",false,s,c);
}
private void jbInit() {
contentPanel.setLayout(null);
investPanel.setLayout(null);
jTabbedPane2.setTabPlacement(JTabbedPane.LEFT);
jTabbedPane2.setOpaque(true);
jTabbedPane2.setBounds(new Rectangle(5, 8, 419, 243));
jPanel3.setLayout(null);
jPanel4.setLayout(null);
okButton.setBounds(new Rectangle(243, 152, 75, 26));
okButton.setText("接受");
okButton.addActionListener(new inSoftCompany_okButton_actionAdapter(this));
noButton.setBounds(new Rectangle(243, 190, 75, 25));
noButton.setText("拒绝");
noButton.addActionListener(new inSoftCompany_noButton_actionAdapter(this));
jLabel1.setText("项目名称:");
jLabel1.setBounds(new Rectangle(10, 24, 63, 20));
jLabel2.setText("项目编号:");
jLabel2.setBounds(new Rectangle(10, 62, 65, 20));
jPanel8.setLayout(null);
jLabel3.setText("项目类别:");
jLabel3.setBounds(new Rectangle(10, 98, 64, 24));
jLabel4.setText("开发时间:");
jLabel4.setBounds(new Rectangle(10, 137, 60, 24));
jLabel5.setText("注册资金:");
jLabel5.setBounds(new Rectangle(10, 181, 61, 19));
nameField.setEditable(false);
nameField.setBounds(new Rectangle(75, 21, 90, 25));
idField.setEditable(false);
idField.setBounds(new Rectangle(75, 59, 90, 25));
classifyField.setEditable(false);
classifyField.setBounds(new Rectangle(75, 97, 90, 25));
timeField.setEditable(false);
timeField.setBounds(new Rectangle(75, 136, 90, 25));
moneyField.setEditable(false);
moneyField.setBounds(new Rectangle(75, 177, 90, 25));
jPanel5.setLayout(null);
jButton3.setBounds(new Rectangle(10, 57, 89, 23));
jButton3.setText("申请贷款");
jButton3.addActionListener(new inSoftCompany_jButton3_actionAdapter(this));
analyzeButton.setBounds(new Rectangle(11, 22, 88, 23));
analyzeButton.setText("分析");
analyzeButton.addActionListener(new
inSoftCompany_analyzeButton_actionAdapter(this));
jPanel6.setLayout(null);
jPanel7.setLayout(null);
sellArea.setEditable(false);
sellArea.setText("jTextArea2");
sellButton.setBounds(new Rectangle(198, 105, 94, 26));
sellButton.setText("开始销售");
sellButton.addActionListener(new inSoftCompany_sellButton_actionAdapter(this));
jButton6.setBounds(new Rectangle(198, 147, 96, 25));
jButton6.setText("偿还贷款");
aboutButton.setBounds(new Rectangle(198, 187, 96, 25));
aboutButton.setText("项目总结");
aboutButton.addActionListener(new
inSoftCompany_aboutButton_actionAdapter(this));
jPanel9.setBackground(Color.pink);
jPanel9.setBounds(new Rectangle(227, 124, 109, 101));
jPanel9.setLayout(null);
jPanel6.setBackground(SystemColor.control);
jPanel10.setBackground(Color.cyan);
jPanel10.setBounds(new Rectangle(10, 18, 300, 32));
companyNameField.setEditable(false);
companyNameField.setBounds(new Rectangle(17, 15, 211, 31));
companyInfoPanel.setLayout(null);
jPanel13.setBackground(SystemColor.control);
jPanel13.setOpaque(true);
jPanel13.setBounds(new Rectangle(9, 23, 185, 223));
jPanel13.setLayout(null);
jPanel14.setOpaque(true);
jPanel14.setBounds(new Rectangle(18, 13, 162, 25));
jPanel14.setLayout(gridLayout5);
jLabel6.setText("公司名称:");
jPanel15.setOpaque(true);
jPanel15.setBounds(new Rectangle(19, 51, 161, 25));
jPanel15.setLayout(gridLayout4);
jLabel7.setText("公司编号:");
jPanel16.setOpaque(true);
jPanel16.setBounds(new Rectangle(20, 88, 160, 25));
jPanel16.setLayout(gridLayout3);
jLabel8.setText("帐户资金:");
jPanel17.setOpaque(true);
jPanel17.setBounds(new Rectangle(19, 124, 161, 25));
jPanel17.setLayout(gridLayout2);
jLabel9.setText("员工数:");
jPanel18.setOpaque(true);
jPanel18.setBounds(new Rectangle(19, 162, 161, 25));
jPanel18.setLayout(gridLayout1);
jLabel10.setText("注册时间:");
jPanel19.setLayout(null);
jPanel19.setBackground(Color.green);
jPanel19.setBounds(new Rectangle(207, 29, 189, 194));
jLabel11.setText("公司信息");
jPanel20.setLayout(borderLayout1);
modifyButton.setText("修改");
modifyButton.addActionListener(new
inSoftCompany_modifyButton_actionAdapter(this));
cancelButton.setText("取消");
cancelButton.addActionListener(new
inSoftCompany_cancelButton_actionAdapter(this));
startButton.setBounds(new Rectangle(206, 135, 87, 24));
startButton.setText("开始开发");
startButton.addActionListener(new
inSoftCompany_startButton_actionAdapter(this));
jPanel2.setBackground(Color.pink);
jLabel12.setText("请稍等,项目开发中...");
jPanel2.setVisible(false);
jPanel2.setBounds(new Rectangle(57, 76, 156, 34));
jLabel13.setText("项目名称:");
jLabel13.setBounds(new Rectangle(21, 34, 69, 19));
jLabel14.setText("项目编号:");
jLabel14.setBounds(new Rectangle(21, 68, 69, 21));
jLabel15.setText("项目类别:");
jLabel15.setBounds(new Rectangle(21, 101, 68, 22));
jLabel16.setText("开发时间:");
jLabel16.setBounds(new Rectangle(21, 138, 68, 23));
jLabel17.setText("项目收益:");
jLabel17.setBounds(new Rectangle(21, 179, 69, 23));
jPanel22.setLayout(null);
jTextField1.setEditable(false);
jTextField1.setText("");
jTextField1.setBounds(new Rectangle(90, 31, 108, 23));
jTextField2.setEditable(false);
jTextField2.setText("");
jTextField2.setBounds(new Rectangle(89, 66, 109, 23));
jTextField3.setEditable(false);
jTextField3.setText("");
jTextField3.setBounds(new Rectangle(89, 100, 109, 23));
jTextField4.setEditable(false);
jTextField4.setText("");
jTextField4.setBounds(new Rectangle(89, 138, 109, 23));
jTextField5.setEditable(false);
jTextField5.setText("");
jTextField5.setBounds(new Rectangle(89, 178, 109, 23));
paintButton.setBounds(new Rectangle(10, 10, 95, 38));
paintButton.setText("项目总结");
paintButton.addActionListener(new inSoftCompany_jButton1_actionAdapter(this));
jTabbedPane1.setOpaque(true);
jTabbedPane1.setBounds(new Rectangle(5, 58, 437, 287));
jPanel8.setBackground(Color.pink);
jPanel8.setBounds(new Rectangle(11, 5, 200, 218));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -