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

📄 famouseuniversity.java

📁 《JBUILDER精髓》各章的源代码可以直接调入编程开发环境里运行无须更改
💻 JAVA
字号:
package university;import java.awt.*;import java.awt.event.*;import java.applet.*;/** * <p>Title: </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2006</p> * <p>Company: </p> * @author not attributable * @version 1.0 */public class famouseUniversity extends Applet {  private boolean isStandalone = false;  Label label1 = new Label();  TextField textField1 = new TextField();  TextField textField2 = new TextField();  Label label2 = new Label();  Label label3 = new Label();  Label label4 = new Label();  Label label5 = new Label();  Choice choice1 = new Choice();  Choice choice2 = new Choice();  TextArea textArea1 = new TextArea();  Button button1 = new Button();  Button button2 = new Button();  Checkbox checkbox1 = new Checkbox();  Checkbox checkbox2 = new Checkbox();  Checkbox checkbox3 = new Checkbox();  //Get a parameter value  public String getParameter(String key, String def) {    return isStandalone ? System.getProperty(key, def) :      (getParameter(key) != null ? getParameter(key) : def);  }  //Construct the applet  public famouseUniversity() {  }  //Initialize the applet  public void init() {    choice1.addItem("NetSafeness");    choice1.addItem("ComputeSience");    choice1.addItem("SoftwareTechnology");    choice2.addItem("Beiking");    choice2.addItem("HUbei Wuhan");    choice2.addItem("Shanxi Xian");    choice2.addItem("Shanghai");    choice2.addItem("Tianjun");    choice2.addItem("Guangdong Guanzhou");    button1.disable();    try {      jbInit();    }    catch(Exception e) {      e.printStackTrace();    }  }  //Component initialization  private void jbInit() throws Exception {    label1.setForeground(Color.red);    label1.setText("University:");    label1.setBounds(new Rectangle(158, 65, 28, 16));    this.setBackground(SystemColor.info);    this.setFont(new java.awt.Font("Dialog", 1, 11));    this.setLayout(null);    textField1.setText("");    textField1.setBounds(new Rectangle(10, 9, 63, 23));    textField1.addActionListener(new famouseUniversity_textField1_actionAdapter(this));    textField2.setText("");    textField2.setBounds(new Rectangle(20, 20, 63, 23));    textField2.addActionListener(new famouseUniversity_textField2_actionAdapter(this));    label2.setForeground(Color.red);    label2.setText("Location:");    label2.setBounds(new Rectangle(0, 0, 28, 16));    label3.setForeground(Color.red);    label3.setText("NetAdress");    label3.setBounds(new Rectangle(10, 10, 28, 16));    label4.setForeground(Color.red);    label4.setText("Subject");    label4.setBounds(new Rectangle(20, 20, 28, 16));    label5.setForeground(Color.red);    label5.setText("AddMessage");    label5.setBounds(new Rectangle(30, 30, 28, 16));    choice1.setBounds(new Rectangle(179, 108, 27, 22));    choice1.addItemListener(new famouseUniversity_choice1_itemAdapter(this));    choice2.setBounds(new Rectangle(288, 105, 27, 22));    textArea1.setForeground(Color.pink);    textArea1.setText("");    textArea1.setBounds(new Rectangle(100, 173, 75, 39));    button1.setLabel("OK");    button1.setBounds(new Rectangle(73, 138, 69, 25));    button1.addActionListener(new famouseUniversity_button1_actionAdapter(this));    button2.setLabel("empty");    button2.setBounds(new Rectangle(37, 103, 69, 25));    checkbox1.setLabel("NationalImportSubject");    checkbox1.setBounds(new Rectangle(253, 59, 79, 25));    checkbox2.setLabel("DoctorPoint");    checkbox2.setBounds(new Rectangle(274, 190, 79, 25));    checkbox3.setLabel("AcademicianOfTwoOffices");    checkbox3.setBounds(new Rectangle(233, 255, 79, 25));    this.add(textField2, null);    this.add(textField1, null);    this.add(label2, null);    this.add(label3, null);    this.add(label4, null);    this.add(label5, null);    this.add(label1, null);    this.add(choice1, null);    this.add(choice2, null);    this.add(textArea1, null);    this.add(button1, null);    this.add(button2, null);    this.add(checkbox1, null);    this.add(checkbox2, null);    this.add(checkbox3, null);  }  //Get Applet information  public String getAppletInfo() {    return "Applet Information";  }  //Get parameter info  public String[][] getParameterInfo() {    return null;  }  void textField2_actionPerformed(ActionEvent e) {  }  void textField1_actionPerformed(ActionEvent e) {  }  void choice1_itemStateChanged(ItemEvent e) {    textArea1.setText("");    textArea1.setForeground(Color.black);    textArea1.append("Input focus at choice1");  }  void button1_actionPerformed(ActionEvent e) {    textArea1.setForeground(new Color(225,0,0));    textArea1.setFont(new java.awt.Font("Dialog",1,16));    textArea1.setText("");    if(textField1.getText()!=""){      textArea1.appendText("UniversityName"+textField1.getText()+"\r\n");      textArea1.appendText("UniversityLocation"+choice2.getSelectedItem()+"\r\n");      if(choice1.getSelectedItem()=="NetSafeness"){        textArea1.appendText("Subject: Netsafeness\r\n");      }      else if(choice1.getSelectedItem()=="HumanWit"){        textArea1.appendText("Subject: DataTecnology\r\n");      }      else if(choice1.getSelectedItem()=="ComputerTecnology"){        textArea1.appendText("Subject: ComputerTecnology\r\n");      }      else if(choice1.getSelectedItem()=="SoftTecnology"){        textArea1.appendText("Subject: SoftTecnology\r\n");      }      if(checkbox1.isEnabled()==true){        textArea1.appendText("This subject is the empases subject of nation\r\n");      }      if(checkbox2.isEnabled()==true){        textArea1.appendText("This subject own the the docoption\r\n");      }      if(checkbox3.isEnabled()==true){        textArea1.appendText("This subject own doc of two college\r\n");      }      textArea1.appendText("The net addree of university:"+textField2.getText()+"\r\n");      textArea1.appendText("The add message:"+textField1.getText()+"\r\n");    }  }}class famouseUniversity_textField2_actionAdapter implements java.awt.event.ActionListener {  famouseUniversity adaptee;  famouseUniversity_textField2_actionAdapter(famouseUniversity adaptee) {    this.adaptee = adaptee;  }  public void actionPerformed(ActionEvent e) {    adaptee.textField2_actionPerformed(e);  }}class famouseUniversity_textField1_actionAdapter implements java.awt.event.ActionListener {  famouseUniversity adaptee;  famouseUniversity_textField1_actionAdapter(famouseUniversity adaptee) {    this.adaptee = adaptee;  }  public void actionPerformed(ActionEvent e) {    adaptee.textField1_actionPerformed(e);  }}class famouseUniversity_choice1_itemAdapter implements java.awt.event.ItemListener {  famouseUniversity adaptee;  famouseUniversity_choice1_itemAdapter(famouseUniversity adaptee) {    this.adaptee = adaptee;  }  public void itemStateChanged(ItemEvent e) {    adaptee.choice1_itemStateChanged(e);  }}class famouseUniversity_button1_actionAdapter implements java.awt.event.ActionListener {  famouseUniversity adaptee;  famouseUniversity_button1_actionAdapter(famouseUniversity adaptee) {    this.adaptee = adaptee;  }  public void actionPerformed(ActionEvent e) {    adaptee.button1_actionPerformed(e);  }}

⌨️ 快捷键说明

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