📄 ptchaxun.java~8~
字号:
package infomanagement;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2003</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
import java.awt.*;
import javax.swing.*;
import com.borland.jbcl.layout.*;
import com.borland.dbswing.*;
import com.borland.dx.sql.dataset.*;
import com.borland.dx.dataset.*;
import java.awt.event.*;
import java.awt.Font;
import java.awt.BorderLayout;
import java.sql.Statement;
import java.sql.ResultSet;
/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2003</p>
* <p>Company: </p>
* @author unascribed
* @version 1.0
*/
public class ptchaxun extends JDialog {
private JPanel jPanel1 = new JPanel();
private XYLayout xYLayout1 = new XYLayout();
private JLabel jLabel1 = new JLabel();
private QueryDataSet queryDataSet1 = new QueryDataSet();
private Database database1 = new Database();
private QueryDataSet queryDataSet2 = new QueryDataSet();
private Column column1 = new Column();
JLabel jLabel3 = new JLabel();
JTextField jTextField1 = new JTextField();
JTextArea jTextArea1=new JTextArea();
JButton jButton1 = new JButton();
JButton jButton2 = new JButton();
String[][] po=new String[8][2];
String[] po1={"ID","密码"};
JScrollPane jScrollPane1 = new JScrollPane();
JTable jTable1 ;
public ptchaxun(Frame frame, String title, boolean modal) {
super(frame, title, modal);
try {
jbInit();
pack();
}
catch(Exception ex) {
ex.printStackTrace();
}
}
public ptchaxun() {
this(null, "", false);
}
private void jbInit() throws Exception {
jPanel1.setLayout(xYLayout1);
jLabel1.setFont(new java.awt.Font("Dialog", 0, 23));
jLabel1.setForeground(Color.magenta);
jLabel1.setBorder(BorderFactory.createEtchedBorder());
jLabel1.setText(" 普通管理员查询");
database1.setConnection(new com.borland.dx.sql.dataset.ConnectionDescriptor
("jdbc:odbc:local", "sa", "", false,
"sun.jdbc.odbc.JdbcOdbcDriver"));
column1.setColumnName("NewColumn1");
column1.setDataType(com.borland.dx.dataset.Variant.STRING);
column1.setPreferredOrdinal(0);
column1.setServerColumnName("NewColumn1");
column1.setSqlType(0);
jLabel3.setFont(new java.awt.Font("宋体", Font.PLAIN, 20));
jLabel3.setForeground(Color.magenta);
jLabel3.setText("ID");
jButton1.setText("查询");
jButton1.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
abc(e);
}
});
jButton2.setText("全部");
jButton2.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
abcd(e);
}
});
this.getContentPane().add(jPanel1, BorderLayout.CENTER);
jPanel1.add(jLabel1, new XYConstraints(0, 1, 399, 53));
jPanel1.add(jTextField1, new XYConstraints(144, 71, 140, 24));
jPanel1.add(jLabel3, new XYConstraints(95, 70, -1, -1));
jPanel1.add(jButton2, new XYConstraints(168, 101, 71, 29));
jPanel1.add(jButton1, new XYConstraints(169, 136, 72, 27));
jPanel1.add(jScrollPane1, new XYConstraints(0, 166, 398, 133));
jScrollPane1.getViewport().add(jTable1);
jTable1=new JTable(po,po1);
}
void abClicked(ActionEvent e)
{
shumingchaxun dlg=new shumingchaxun();
Dimension dlgSize = dlg.getPreferredSize();
Dimension frmSize = getSize();
Point loc = getLocation();
dlg.setLocation((frmSize.width - dlgSize.width) / 2 +
loc.x, (frmSize.height - dlgSize.height) / 2 + loc.y);
dlg.setModal(true);
dlg.pack();
dlg.setVisible(true);
}
void acClicked(ActionEvent e)
{
}
void abcd(ActionEvent e)
{
}
void abc(ActionEvent e)
{
String a=jTextField1.getText().trim();
String b="";
if(a!="")
{
try {
dabaco bb=new dabaco();
//System.out.println(a);
String sql = "select * from puguan where ID =" + "'" + a + "'";
//Statement st = bb.conn.createStatement();
//System.out.println(a);
//System.out.println(xy);
ResultSet jk = bb.stmt.executeQuery(sql);
//ResultSet jk=bb.stmt.executeQuery(query);
int u = 0;
while (jk.next()) {
//System.out.println(gg);
for (int i = 0; i <= 1; i++) {
po[u][i] = jk.getString(i + 1);
//System.out.println(rb.getString(i));
//gg=gg+jk.getString(i)+" ";
//System.out.println(gg);
}
//gg=gg+"\n";
u++;
}
jTable1 = new JTable(po, po1);
}
catch(Exception aa)
{
//System.out.println(aa.getMessage());
}
}
}
void cancel()
{
dispose() ;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -