📄 gaoji1.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.*;
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 com.borland.jbcl.control.ChoiceControl;
import java.sql.*;
import java.net.URL;
import java.awt.Font;
import java.awt.BorderLayout;
/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2003</p>
* <p>Company: </p>
* @author unascribed
* @version 1.0
*/
public class gaoji1 extends JDialog {
private JPanel jPanel1 = new JPanel();
private XYLayout xYLayout1 = new XYLayout();
private JLabel jLabel4 = new JLabel("请选择您要进行的操作方式");
//private JLabel jLabel4;
private QueryDataSet queryDataSet1 = new QueryDataSet();
private Database database1 = new Database();
private QueryDataSet queryDataSet2 = new QueryDataSet();
private Column column1 = new Column();
String query="select 书名 from book where 出版社='qls' ";
JTextArea jTextArea1 ;
JLabel jLabel2=new JLabel() ;
public gaoji1(Frame frame, String title, boolean modal) {
super(frame, title, modal);
try {
jbInit();
pack();
}
catch(Exception ex) {
ex.printStackTrace();
}
}
public gaoji1()
{
this(null, "", false);
}
private void jbInit() throws Exception
{
this.setTitle("高级管理员窗口");
jPanel1.setLayout(xYLayout1);
jLabel4.setFont(new java.awt.Font("宋体", Font.PLAIN, 18));
jLabel4.setForeground(Color.green);
jPanel1.add(jLabel2, new XYConstraints(55, 127, 280, 126));
jPanel1.add(jLabel4, new XYConstraints(76, 174, -1, -1));
ImageIcon img = new ImageIcon("D:\\tupian\\dd.gif");
jLabel2 = new JLabel(img);
jPanel1.add(jLabel2, new Integer(Integer.MIN_VALUE));
jLabel2.setBounds(0, 0, img.getIconWidth(), img.getIconHeight());
JMenuBar jMenuBar1 = new JMenuBar();
JMenu m1=new JMenu("图书");
JMenuItem n0=new JMenuItem("添加");
JMenuItem n1=new JMenuItem("删除");
JMenuItem n2=new JMenuItem("查询");
n0.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
afg(e);
}
});
n1.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
afh(e);
}
});
n2.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
aff(e);
}
});
m1.add(n0);
m1.add(n1);
m1.add(n2);
jMenuBar1.add(m1);
JMenu m2=new JMenu("学生");
JMenuItem n3=new JMenuItem("添加");
JMenuItem n4=new JMenuItem("删除");
JMenuItem n5=new JMenuItem("查询");
m2.add(n3);
m2.add(n4);
m2.add(n5);
jMenuBar1.add(m2);
n3.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
aab(e);
}
});
n4.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
aac(e);
}
});
n5.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
aaa(e);
}
});
JMenu m3=new JMenu("普通管理员");
JMenuItem n6=new JMenuItem("添加");
JMenuItem n7=new JMenuItem("删除");
JMenuItem n8=new JMenuItem("查询");
m3.add(n6);
m3.add(n7);
m3.add(n8);
jMenuBar1.add(m3);
n6.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
afj(e);
}
});
n7.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
afk(e);
}
});
n8.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
afl(e);
}
});
this.getContentPane().add(jMenuBar1, BorderLayout.NORTH);
this.getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER); // database1.setConnection(new com.borland.dx.sql.dataset.ConnectionDescriptor
column1.setColumnName("NewColumn1");
column1.setDataType(com.borland.dx.dataset.Variant.STRING);
column1.setPreferredOrdinal(0);
column1.setServerColumnName("NewColumn1");
column1.setSqlType(0);
}
//public void paint(Graphics g)
// {
// g=jPanel1.getGraphics();
// g.drawImage(image,0,0,null);
//}
public void condatabase()
{//连接数据库的方法
try{
//Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch(ClassNotFoundException e){
System.out.println(e);
}
try{
String url="jdbc:odbc:jnbus";
String user="";
String password="";
Connection conn=DriverManager.getConnection(url,user,password);
Statement stmt=conn.createStatement();
}
catch(SQLException e){
}
}
void aaa(ActionEvent e)
{
xueshengchaxun dlg=new xueshengchaxun();
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 aab(ActionEvent e)
{
xueshengjia dlg=new xueshengjia();
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 aac(ActionEvent e)
{
xueshengjian dlg=new xueshengjian();
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 aff(ActionEvent e)
{
shuchaxun dlg=new shuchaxun();
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 afg(ActionEvent e)
{
shujia dlg=new shujia();
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 afh(ActionEvent e)
{
shujian dlg=new shujian();
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 afj(ActionEvent e)
{
ptjia dlg=new ptjia();
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 afk(ActionEvent e)
{
ptjian dlg=new ptjian();
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 afl(ActionEvent e)
{
ptchaxun dlg=new ptchaxun();
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 cancel(){
dispose() ;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -