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

📄 qureyjapplet.java~2~

📁 大量java源程序
💻 JAVA~2~
字号:
package javaservlets.tunnel;import java.awt.*;import java.awt.event.*;import java.applet.*;import javax.swing.*;import com.borland.jbcl.layout.*;import java.sql.*;/** * Title: * Description: * Copyright:    Copyright (c) 2002 * Company: * @author * @version 1.0 */public class qureyjapplet extends JApplet {  IndyInterface indy;  boolean isStandalone = false;  JPanel jPanel1 = new JPanel();  BorderLayout borderLayout1 = new BorderLayout();  JPanel jPanel2 = new JPanel();  JButton jButton1 = new JButton();  JButton jButton2 = new JButton();  JPanel jPanel3 = new JPanel();  XYLayout xYLayout1 = new XYLayout();  JTextField jTextField1 = new JTextField();  JLabel jLabel1 = new JLabel();  JButton jButton3 = new JButton();  JLabel jLabel2 = new JLabel();  JTextField jTextField2 = new JTextField();  JButton jButton4 = new JButton();  /**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 qureyjapplet() {  }  /**Initialize the applet*/  public void init() {    try {      jbInit();    }    catch(Exception e) {      e.printStackTrace();    }  }  /**Component initialization*/  private void jbInit() throws Exception {    this.setSize(new Dimension(400,300));    jPanel1.setLayout(borderLayout1);    jButton1.setText("update");    jButton1.addActionListener(new java.awt.event.ActionListener() {      public void actionPerformed(ActionEvent e) {        jButton1_actionPerformed(e);      }    });    jButton2.setText("Delete");    jButton2.addActionListener(new java.awt.event.ActionListener() {      public void actionPerformed(ActionEvent e) {        jButton2_actionPerformed(e);      }    });    jPanel3.setLayout(xYLayout1);    jLabel1.setText("input taskID to delete");    jButton3.setText("insert");    jButton3.addActionListener(new java.awt.event.ActionListener() {      public void actionPerformed(ActionEvent e) {        jButton3_actionPerformed(e);      }    });    jLabel2.setText("input taskID to insert");    jButton4.setText("save");    jButton4.addActionListener(new java.awt.event.ActionListener() {      public void actionPerformed(ActionEvent e) {        jButton4_actionPerformed(e);      }    });    this.getContentPane().add(jPanel1, BorderLayout.CENTER);    jPanel1.add(jPanel2, BorderLayout.NORTH);    jPanel2.add(jButton1, null);    jPanel2.add(jButton2, null);    jPanel2.add(jButton3, null);    jPanel2.add(jButton4, null);    jPanel1.add(jPanel3, BorderLayout.CENTER);    jPanel3.add(jTextField1,     new XYConstraints(206, 19, 110, -1));    jPanel3.add(jLabel1,        new XYConstraints(53, 19, 142, 20));    jPanel3.add(jLabel2,     new XYConstraints(55, 80, 126, -1));    jPanel3.add(jTextField2,    new XYConstraints(206, 78, 110, -1));  try {        indy = new RemoteIndyClient("http://localhost:7001/servlet/");//(getCodeBase() + "servlet/");        // Open the database connection        boolean rc = indy.connect();        if (!rc) {          System.out.println("Connection not initialized");          indy = null;        }      }      catch (Exception ex) {        ex.printStackTrace();      }  }  /**Start the applet*/  public void start() {  }  /**Stop the applet*/  public void stop() {  }  /**Destroy the applet*/  public void destroy() {  }  /**Get Applet information*/  public String getAppletInfo() {    return "Applet Information";  }  /**Get parameter info*/  public String[][] getParameterInfo() {    return null;  }  /**Main method*/  public static void main(String[] args) {    qureyjapplet applet = new qureyjapplet();    applet.isStandalone = true;    JFrame frame = new JFrame();    //EXIT_ON_CLOSE == 3    frame.setDefaultCloseOperation(3);    frame.setTitle("Applet Frame");    frame.getContentPane().add(applet, BorderLayout.CENTER);    applet.init();    applet.start();    frame.setSize(400,320);    Dimension d = Toolkit.getDefaultToolkit().getScreenSize();    frame.setLocation((d.width - frame.getSize().width) / 2, (d.height - frame.getSize().height) / 2);    frame.setVisible(true);  }  //static initializer for setting look & feel  static {    try {      //UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());      //UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());    }    catch(Exception e) {    }  }  void jButton1_actionPerformed(ActionEvent e) {     if (indy == null) {          System.out.println("Indy is null");          return;        }        // Get the indy record        IndyRecord[] r = indy.query();        System.out.println("At qureyjapplet: "+r[0].taskID);        // Populate        if (r != null) {          for(int i=0;i<r.length;i++)          {           //jTextArea1.setText(r[i].taskID);           System.out.println("At qureyjapplet: "+r[i].taskID);           System.out.println("At qureyjapplet: "+r[i].describe);           System.out.println("At qureyjapplet: "+r[i].ef);          }      }  }  void jButton2_actionPerformed(ActionEvent e) {          if (indy == null) {          System.out.println("Indy is null");          return;        }        // delete the  record         indy.delete(jTextField1.getText());  }  void jButton3_actionPerformed(ActionEvent e) {   if (indy == null) {          System.out.println("Indy is null");          return;        }        IndyRecord re=new IndyRecord();        re.taskID=jTextField2.getText();        re.describe="wang";        re.ygongqi=1;        re.sgongqi=1;        re.centigrade=0;        re.es=Date.valueOf("2001-01-01");        re.ef=Date.valueOf("2001-01-01");        re.floatime=0;        // insert the  record         indy.insert(re);  }  void jButton4_actionPerformed(ActionEvent e) {   if (indy == null) {          System.out.println("Indy is null");          return;        }        IndyRecord re=new IndyRecord();        re.taskID=jTextField2.getText();        re.describe="wang";        re.ygongqi=1;        re.sgongqi=1;        re.centigrade=0;        re.es=Date.valueOf("2001-01-01");        re.ef=Date.valueOf("2001-01-01");        re.floatime=0;        // update the  record         indy.update(re);  }}

⌨️ 快捷键说明

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