📄 qureyjapplet.java~10~
字号:
package javaservlets.tunnel;import java.awt.*;import java.awt.event.*;import java.applet.*;import javax.swing.*;/** * 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(); JScrollPane jScrollPane1 = new JScrollPane(); JTextArea jTextArea1 = new JTextArea(); /**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("jButton1"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { jButton1_actionPerformed(e); } }); jTextArea1.setText("jTextArea1"); this.getContentPane().add(jPanel1, BorderLayout.CENTER); jPanel1.add(jPanel2, BorderLayout.NORTH); jPanel2.add(jButton1, null); jPanel1.add(jScrollPane1, BorderLayout.CENTER); jScrollPane1.getViewport().add(jTextArea1, null); 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); } } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -