⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frame9.java

📁 网上虚拟社区
💻 JAVA
字号:


import java.awt.BorderLayout;
import javax.swing.JPanel;
import javax.swing.JFrame;
import java.awt.Dimension;
import javax.swing.JButton;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.Point;
import java.rmi.Naming;
import java.util.Vector;

import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.ImageIcon;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class Frame9 extends JFrame {

	private static final long serialVersionUID = 1L;

	private JPanel jContentPane = null;

	private JButton jButton = null;

	private JButton jButton1 = null;

	private JButton jButton2 = null;

	private JButton jButton3 = null;

	private JLabel jLabel = null;

	private JScrollPane jScrollPane = null;

	private JTable jTable = null;
	
	private String name = null;

	private String password = null;

	private String genere = null;

	private String url = null;

	private CommunityServerInterface thecommunity;

	private boolean isconnected = false;

	private Vector data;

	private Vector titles;
	private Vector titles1;

	private TbModel tbmodel;
	private int model;

	/**
	 * This is the default constructor
	 */
	public Frame9() {
		super();
		initialize();
	}

	
	public Frame9(String Name, String Password, String Genere,String Url) {
		super();
		name = Name;
		password = Password;
		genere = Genere;
		url = Url;
		titles = new Vector();
		titles.add("软件名");
		titles.add("软件简介");
		titles.add("销量");
		titles.add("目前售价");
		// titles.add("pin");
		
		titles1 = new Vector();
		titles1.add("软件名");
		titles1.add("软件简介");
		titles1.add("投标价格");
		titles1.add("投标公司");
		titles1.add("已经确定(1)");

		initializeRMI();

		try {
			data = thecommunity.finddatabase("Software",0, name);
		} catch (Exception ex) {
			System.out.println(ex);
			JOptionPane.showMessageDialog(null,
					"The internet is busy,please come letter!", "Link error",
					JOptionPane.ERROR_MESSAGE);
		}
		// System.out.println(data);

		initialize();
	}
	/**
	 * This method initializes this
	 * 
	 * @return void
	 */
	private void initialize() {
		this.setSize(537, 555);
		this.setContentPane(getJContentPane());
		this.setTitle("销售公司");
	}

	/**
	 * This method initializes jContentPane
	 * 
	 * @return javax.swing.JPanel
	 */
	private JPanel getJContentPane() {
		if (jContentPane == null) {
			jLabel = new JLabel();
			jLabel.setBounds(new Rectangle(16, 15, 510, 24));
			jLabel.setIcon(new ImageIcon(getClass().getResource("/ball.jpg")));
			jLabel.setText("欢迎您公司到本虚拟社区进行交易,我们将尽我们最大的努力为您提供良好的服务!");
			jContentPane = new JPanel();
			jContentPane.setLayout(null);
			jContentPane.add(getJButton(), null);
			jContentPane.add(getJButton1(), null);
			jContentPane.add(getJButton2(), null);
			jContentPane.add(getJButton3(), null);
			jContentPane.add(jLabel, null);
			jContentPane.add(getJScrollPane(), null);
		}
		return jContentPane;
	}

	/**
	 * This method initializes jButton	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getJButton() {
		if (jButton == null) {
			jButton = new JButton();
			jButton.setPreferredSize(new Dimension(34, 10));
			jButton.setSize(new Dimension(102, 34));
			jButton.setText("销售情况");
			jButton.setLocation(new Point(17, 463));
			jButton.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent evt) {
					jButtonActionPerformed(evt);
				}
			});
		}
		return jButton;
	}

	/**
	 * This method initializes jButton1	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getJButton1() {
		if (jButton1 == null) {
			jButton1 = new JButton();
			jButton1.setBounds(new Rectangle(147, 465, 103, 34));
			jButton1.setText("招标状态");
			jButton1.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent evt) {
					jButton1ActionPerformed(evt);
				}
			});
		}
		return jButton1;
	}

	/**
	 * This method initializes jButton2	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getJButton2() {
		if (jButton2 == null) {
			jButton2 = new JButton();
			jButton2.setBounds(new Rectangle(278, 466, 106, 33));
			jButton2.setText("决定中标");
			jButton2.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent evt) {
					if(model == 1){
					jButton2ActionPerformed(evt);
					}
					else
						JOptionPane.showMessageDialog(null,
								"Please enter \"招标状态\" first", "Message error",
								JOptionPane.ERROR_MESSAGE);
				}
			});
		}
		return jButton2;
	}

	/**
	 * This method initializes jButton3	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getJButton3() {
		if (jButton3 == null) {
			jButton3 = new JButton();
			jButton3.setBounds(new Rectangle(412, 466, 103, 30));
			jButton3.setText("开发新软件");
			jButton3.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent evt) {
					jButton3ActionPerformed(evt);
				}
			});
		}
		return jButton3;
	}

	/**
	 * This method initializes jScrollPane	
	 * 	
	 * @return javax.swing.JScrollPane	
	 */
	private JScrollPane getJScrollPane() {
		if (jScrollPane == null) {
			jScrollPane = new JScrollPane();
			jScrollPane.setBounds(new Rectangle(9, 46, 505, 409));
			jScrollPane.setViewportView(getJTable());
		}
		return jScrollPane;
	}

	/**
	 * This method initializes jTable	
	 * 	
	 * @return javax.swing.JTable	
	 */
	private JTable getJTable() {
		if (jTable == null) {
			tbmodel = new TbModel(data, titles);
			jTable = new JTable(tbmodel);
			model = 0;
			jTable.setColumnSelectionAllowed(false);
			jTable.setSelectionMode(1);
		}
		return jTable;
	}

	private void jButton3ActionPerformed(ActionEvent evt) {
//		System.out.println("jButton3.actionPerformed, event=" + evt);
		Frame13 frame = new Frame13(name, url);
		frame.setVisible(true);
		//TODO add your code for jButton3.actionPerformed
	}

	private void jButton2ActionPerformed(ActionEvent evt) {
//		System.out.println("jButton2.actionPerformed, event=" + evt);
		int[] rows = jTable.getSelectedRows();
		int   num = rows.length;
		int thesame = 0 ;
		String[] softs = new String[num];
		String[] empolders = new String[num];
		double[] prices = new double[num];
		double money = 0;
		for(int i=0,j=0;i<num;i++){
			if(Double.valueOf((String)tbmodel.getValueAt(rows[i],4)) == 0){
			softs[j] = (String)tbmodel.getValueAt(rows[i], 0);
			prices[j] = Double.valueOf((String)tbmodel.getValueAt(rows[i], 2));
			empolders[j] = (String)tbmodel.getValueAt(rows[i], 3);
			for(int s=0;s<j;s++){
				if(empolders[j].equals(empolders[s]))
					thesame = 0;
			}
			money += prices[j];
			j++;
			}
		}
		if(thesame == 0){
		Frame12 frame = new Frame12(name,url,money,softs,1,empolders);
		frame.setVisible(true);
		}
		else{
			JOptionPane.showMessageDialog(null,
					"You have choose two same software to settle!", "Choose error",
					JOptionPane.ERROR_MESSAGE);
		}
		//TODO add your code for jButton2.actionPerformed
	}

	private void jButton1ActionPerformed(ActionEvent evt) {
//		System.out.println("jButton1.actionPerformed, event=" + evt);
		try {
			data = thecommunity.finddatabase("Software", 1, name);
		} catch (Exception ex) {
			System.out.println(ex);
			JOptionPane.showMessageDialog(null,
					"The internet is busy,please retry letter!", "Link error",
					JOptionPane.ERROR_MESSAGE);
		}
		tbmodel = new TbModel(data, titles1);
		jTable.setModel(tbmodel);
		model = 1;
		jTable.updateUI();
		//TODO add your code for jButton1.actionPerformed
	}

	private void jButtonActionPerformed(ActionEvent evt) {
	//	System.out.println("jButton.actionPerformed, event=" + evt);
		try {
			data = thecommunity.finddatabase("Software", 0, name);
		} catch (Exception ex) {
			System.out.println(ex);
			JOptionPane.showMessageDialog(null,
					"The internet is busy,please retry letter!", "Link error",
					JOptionPane.ERROR_MESSAGE);
		}
		tbmodel = new TbModel(data, titles);
		jTable.setModel(tbmodel);
		model = 0;
		jTable.updateUI();
		//TODO add your code for jButton.actionPerformed
	}
	
	protected boolean initializeRMI() {
		if (isconnected)
			return true;
		if (url.equals("default"))
			url = "";
		url = "rmi://" + url + "/";
		try {
			thecommunity = (CommunityServerInterface) Naming.lookup(url
					+ "CommunityServerInterfaceImpl");
			System.out.println("Server object " + thecommunity + " found");
			isconnected = true;
			return true;
		} catch (Exception ex) {
			System.out.println(url);
			System.out.println(ex);
			JOptionPane.showMessageDialog(null, "Please enter right ID!",
					"ID error", JOptionPane.ERROR_MESSAGE);
			return false;
		}
	}

}  //  @jve:decl-index=0:visual-constraint="79,8"

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -