📄 ptjian.java
字号:
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.BorderLayout;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.Font;
import com.borland.jbcl.layout.XYLayout;
import java.awt.Color;
import com.borland.dx.dataset.Column;
import javax.swing.JDialog;
import javax.swing.JTextField;
import java.awt.Frame;
import com.borland.dx.sql.dataset.Database;
import com.borland.dx.sql.dataset.QueryDataSet;
import javax.swing.JLabel;
import com.borland.jbcl.layout.XYConstraints;
import javax.swing.JButton;
import java.awt.event.MouseEvent;
import java.awt.Dimension;
import java.awt.Point;
import java.sql.*;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2003</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class ptjian extends JDialog {
private JPanel jPanel1 = new JPanel();
private XYLayout xYLayout1 = new XYLayout();
private JLabel jLabel1 = new JLabel();
private JLabel jLabel4 = new JLabel();
private QueryDataSet queryDataSet1 = new QueryDataSet();
private Database database1 = new Database();
private QueryDataSet queryDataSet2 = new QueryDataSet();
private Column column1 = new Column();
JLabel jLabel5 = new JLabel();
JTextField jTextField2 = new JTextField();
JButton jButton1 = new JButton();
JLabel jLabel2 = new JLabel();
public ptjian(Frame frame, String title, boolean modal) {
super(frame, title, modal);
try {
jbInit();
pack();
}
catch(Exception ex) {
ex.printStackTrace();
}
}
public ptjian() {
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(" 普通管理员删除窗口");
jLabel4.setBorder(BorderFactory.createEtchedBorder());
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);
jLabel5.setFont(new java.awt.Font("宋体", Font.PLAIN, 20));
jLabel5.setForeground(Color.magenta);
jLabel5.setText("ID");
jButton1.setText("删除");
jButton1.addMouseListener(new java.awt.event.MouseAdapter()
{
//判断输入是否正确,是就进入,否就弹出一个对话框提示错误
public void mouseClicked(MouseEvent e){
abClicked(e);
}
}
);
jLabel2.setFont(new java.awt.Font("宋体", Font.PLAIN, 20));
jLabel2.setForeground(Color.red);
jLabel2.setText("请输入要删除普通管理员的ID");
this.getContentPane().add(jPanel1, BorderLayout.CENTER);
jPanel1.add(jLabel1, new XYConstraints(0, 1, 399, 53));
jPanel1.add(jButton1, new XYConstraints(165, 231, -1, -1));
jPanel1.add(jLabel2, new XYConstraints(92, 67, -1, -1));
jPanel1.add(jLabel5, new XYConstraints(124, 144, -1, -1));
jPanel1.add(jTextField2, new XYConstraints(172, 146, 90, -1));
jPanel1.add(jLabel4, new XYConstraints(3, 94, 397, 202));
}
void abClicked(MouseEvent e)
{
String bb=jTextField2.getText();
String aa="delete from puguan where ID="+"'"+bb+"'";
try
{
dabaco ggh=new dabaco();
if (bb.length()!=0)
{
ResultSet ggh1=ggh.stmt.executeQuery(aa);
}
else
{
String st="输入信息不能为空";
cheng dlg=new cheng();
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);
}
}
catch(SQLException ex)
{
}
}
void cancel(){
dispose() ;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -