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

📄 addperspectivedlg.java

📁 《Java网络程序设计.rar》包括三个网络程序的源代码。
💻 JAVA
字号:
package org.impact.stars.appclient.concept;

/**
 * Insert the type's description here.
 * Creation date: (7/28/00 12:42:27 PM)
 * @author: Jian Cai
 */
import java.awt.Insets;
import java.awt.Point;
import java.awt.Component;
import java.awt.Frame;
import javax.swing.*;
import java.awt.Font;
import java.awt.Dimension;
import java.awt.Container;
import java.awt.Event;
import java.awt.event.*;
import java.awt.*;

import org.impact.stars.appclient.concept.model.*;

public class Addperspectivedlg extends javax.swing.JDialog
{
	
	boolean registerButtonPressed = false;
	Concept theConcept = null;

	
	int ConceptID;
	String Name;
	String Type;
	String Discription;
	String Proposer;
	String ViewGroup;
	String Status;
	String Addtime;
	int Parent;
	String Comment;
	
	
	
	// Used for addNotify check.
	boolean fComponentsAdjusted = false;


	//{{DECLARE_CONTROLS
	javax.swing.JLabel label1 = new javax.swing.JLabel();
	javax.swing.JTextField TypeTextField = new javax.swing.JTextField();
	javax.swing.JLabel label2 = new javax.swing.JLabel();
	javax.swing.JTextField NameTextField = new javax.swing.JTextField();
	javax.swing.JLabel label3 = new javax.swing.JLabel();
	javax.swing.JTextField DiscriptionTextField = new javax.swing.JTextField();
	javax.swing.JLabel label4 = new javax.swing.JLabel();
	javax.swing.JTextField ProposerTextField = new javax.swing.JTextField();
	javax.swing.JLabel label5 = new javax.swing.JLabel();
	javax.swing.JTextField ViewGroupChoice = new javax.swing.JTextField();
	
	//javax.swing.JComboBox ViewGroupChoice = new javax.swing.JComboBox();
	
	javax.swing.JLabel label6 = new javax.swing.JLabel();
	javax.swing.JTextField AddtimeTextField = new javax.swing.JTextField();
	javax.swing.JLabel label7 = new javax.swing.JLabel();
	//javax.swing.JLabel label8 = new javax.swing.JLabel();
	//javax.swing.JComboBox StatusChoice = new javax.swing.JComboBox();
	javax.swing.JButton registerButton = new JButton();
	javax.swing.JButton cancelButton = new JButton();
	javax.swing.JLabel label9 = new javax.swing.JLabel("Comments");
	javax.swing.JScrollPane Textpane1= new javax.swing.JScrollPane();
	javax.swing.JTextArea commentTextArea = new javax.swing.JTextArea();
		
	//}}

	class SymWindow extends java.awt.event.WindowAdapter
	{
		public void windowClosing(java.awt.event.WindowEvent event)
		{
			Object object = event.getSource();
			if (object == Addperspectivedlg.this)
				Dialog1_WindowClosing(event);
		}
	}
	
	class SymAction implements java.awt.event.ActionListener
	{
		public void actionPerformed(java.awt.event.ActionEvent event)
		{
			Object object = event.getSource();
			if (object == cancelButton)
				cancelButton_Action(event);
			else if (object == registerButton)
				registerButton_Action(event);
		}
	}

/**
 * Addperspectivedlg constructor comment.
 */
public Addperspectivedlg() {
	super();
}
public Addperspectivedlg(JFrame parent, String title, boolean modal)
{
		this(parent, modal);
		setTitle(title);
}
public Addperspectivedlg(JFrame parent, boolean modal)
{
	super(parent, modal);
		parent.setResizable(false);

		/*GridLayout layout = new GridLayout(6,5);
		layout.setVgap(20);
		layout.setHgap(24);
		getContentPane().setLayout(layout);*/
		getContentPane().setLayout(null);
		setSize(620,350);
		setVisible(false);
		label1.setText("Name");
		label1 = new javax.swing.JLabel("Name");
		label1.setBounds(12,24,84,24);
		getContentPane().add(label1);
		TypeTextField = new javax.swing.JTextField();
		TypeTextField.setBounds(120,24,140,25);
		label2.setText("Type");
		getContentPane().add(TypeTextField);
		label2 = new javax.swing.JLabel("Type");
		label2.setBounds(300,24,96,24);
		getContentPane().add(label2);
		NameTextField = new javax.swing.JTextField();
		NameTextField.setBounds(432,24,140,25);
		label3.setText("Content");
		getContentPane().add(NameTextField);
		label3 = new javax.swing.JLabel("Content");
		label3.setBounds(12,60,84,24);
		getContentPane().add(label3);
		DiscriptionTextField = new javax.swing.JTextField();
		DiscriptionTextField.setBounds(120,60,139,24);
		label4.setText("Context");
		getContentPane().add(DiscriptionTextField);
		label4 = new javax.swing.JLabel("Context");
		label4.setBounds(300,60,120,24);
		getContentPane().add(label4);
		ProposerTextField = new javax.swing.JTextField();
		ProposerTextField.setBounds(432,60,140,25);
		label5.setText("Purpose");
		getContentPane().add(ProposerTextField);
		label5 = new javax.swing.JLabel("Purpose");
		label5.setBounds(12,96,72,24);
		getContentPane().add(label5);
		ViewGroupChoice = new javax.swing.JTextField();
		/*
		ViewGroupChoice.addItem("-- SELECT A Group --");
		ViewGroupChoice.addItem("Overall Group");
		ViewGroupChoice.addItem("Customer Group");
		ViewGroupChoice.addItem("Design Consultant Group");
		ViewGroupChoice.addItem("Design Engieer Group");
		ViewGroupChoice.addItem("Project Management Group");
		ViewGroupChoice.addItem("Bussiness Owner Group");
		ViewGroupChoice.addItem("Other Group");
		ViewGroupChoice.setBackground(java.awt.Color.white);
		try {
			//ViewGroupChoice.select(0);
		}
		catch (IllegalArgumentException e) { }*/
		getContentPane().add(ViewGroupChoice);
		ViewGroupChoice.setBounds(120,96,156,25);
		label6.setText("Add Time");
		label6 = new javax.swing.JLabel("Add Time");
		label6.setBounds(300,96,96,24);
		getContentPane().add(label6);
		AddtimeTextField = new javax.swing.JTextField();
		AddtimeTextField.setBounds(432,96,139,25);
		label7.setText("(yyyy-mm-dd)");
		getContentPane().add(AddtimeTextField);
		label7 = new javax.swing.JLabel("(yyyy-mm-dd)");
		label7.setBounds(444,132,84,13);
		//label8.setText("Status");
		label7.setFont(new Font("Dialog", Font.ITALIC, 12));
		getContentPane().add(label7);
		
		label9 = new javax.swing.JLabel("Comments");
		label9.setBounds(getInsets().left + 12,getInsets().top + 168,120,25);
		getContentPane().add(label9);
		commentTextArea = new javax.swing.JTextArea();
		//commentTextArea.setBounds(getInsets().left + 12,getInsets().top + 204,480,89);
		//commentTextArea.setBounds(0,0,500,100);
		
		commentTextArea.setLineWrap(true);
		commentTextArea.setColumns(10);
		commentTextArea.setVisible(true);
		Textpane1= new javax.swing.JScrollPane();
		Textpane1.setBounds(getInsets().left + 12,getInsets().top + 204,550,90);
		//Textpane1.setLayout(new BorderLayout());
		Textpane1.add(commentTextArea);
		Textpane1.setViewportView(commentTextArea);
		getContentPane().add(Textpane1, Textpane1.getName());
		
		registerButton = new JButton("Add Perspective");
		
		registerButton.setBounds(324,312,120,24);
		registerButton.setBackground(java.awt.Color.green);
		getContentPane().add(registerButton);
		cancelButton = new JButton("Cancel");
		cancelButton.setBounds(432,312,100,24);
		cancelButton.setBackground(java.awt.Color.red);
		getContentPane().add(cancelButton);
		setTitle("Add New Concept");
		this.setResizable(false);
		//}}

		//{{REGISTER_LISTENERS
		SymWindow aSymWindow = new SymWindow();
		this.addWindowListener(aSymWindow);
		SymAction lSymAction = new SymAction();
		cancelButton.addActionListener(lSymAction);
		registerButton.addActionListener(lSymAction);
		//}}
		
	}
	public void addNotify()
	{
  	    // Record the size of the window prior to calling parents addNotify.
	    Dimension d = getSize();

		super.addNotify();

		if (fComponentsAdjusted)
			return;

		// Adjust components according to the insets
		setSize(getInsets().left + getInsets().right + d.width, getInsets().top + getInsets().bottom + d.height);
		Component components[] = getComponents();
		for (int i = 0; i < components.length; i++)
		{
			Point p = components[i].getLocation();
			p.translate(getInsets().left, getInsets().top);
			components[i].setLocation(p);
		}
		fComponentsAdjusted = true;
	}
	void cancelButton_Action(java.awt.event.ActionEvent event)
	{
		// to do: code goes here.
		registerButtonPressed = false;		
		this.setVisible(false);
	}
	void Dialog1_WindowClosing(java.awt.event.WindowEvent event)
	{
		dispose();
	}
	public Concept getConcept()
	{
	    return theConcept;    
	}
	public boolean isRegisterButtonPressed()
	{
	    return registerButtonPressed;    
	}
	void registerButton_Action(java.awt.event.ActionEvent event)
	{
		// to do: code goes here.
		registerButtonPressed = true;
		
		Name = NameTextField.getText().trim();
		Type = TypeTextField.getText().trim();
		Discription = DiscriptionTextField.getText().trim();
		Proposer = ProposerTextField.getText().trim();
		Addtime = AddtimeTextField.getText().trim();
		//ViewGroup = (String)ViewGroupChoice.getSelectedItem();
		//Status = (String)StatusChoice.getSelectedItem();
		Comment= commentTextArea.getText().trim();

		if (Comment.length() == 0)
		{
			Comment = "none";
		}

		ConceptID=0;
		Parent=0;
		
		// create a Concept object based on form data
		theConcept = new Concept(ConceptID, Type, Name, Discription,
		                         Proposer,ViewGroup,
		                         Status, Addtime, Parent, Comment);
		                         
		// close this window and return to caller
		this.setVisible(false);
		
	}
}

⌨️ 快捷键说明

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