📄 putong1.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;
import javax.swing.DebugGraphics;
/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2003</p>
* <p>Company: </p>
* @author unascribed
* @version 1.0
*/
public class putong1 extends JDialog {
ImageIcon icon=new ImageIcon("D:\\tupian\\海岸·岛屿 (5).jpg");
//Image image=icon.getImage();
private XYLayout xYLayout1 = new XYLayout();
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 jLabel1 ;
public putong1(Frame frame, String title, boolean modal) {
super(frame, title, modal);
try {
jbInit();
pack();
}
catch(Exception ex) {
ex.printStackTrace();
}
}
public putong1()
{
this(null, "", false);
}
private void jbInit() throws Exception
{
JPanel jPanel1 = new JPanel()
{
protected void paintComponent(Graphics g)
{
// Dispaly image at at full size
g.drawImage(icon.getImage(), 0, 0, null);
// Scale image to size of component
// Dimension d = getSize();
// g.drawImage(icon.getImage(), 0, 0, d.width, d.height, null);
// Fix the image position in the scroll pane
// Point p = scrollPane.getViewport().getViewPosition();
// g.drawImage(icon.getImage(), p.x, p.y, null);
super.paintComponent(g);
}
};
jPanel1.setOpaque( false );
jPanel1.setPreferredSize( new Dimension(400, 400) );
this.setTitle("普通管理员窗口");
this.setSize(400,300);
jPanel1.setLayout(xYLayout1);
//jLabel4.setBorder(BorderFactory.createEtchedBorder());
String driverName = "com.microsoft.jdbc.sqlserver.SQLServerDriver";
String dbURL = "jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=info"; //默认断口为1433
//setSize(500,600);
((JPanel)this.getContentPane()).setOpaque(false);
ImageIcon img = new ImageIcon("D:\\tupian\\ll.jpg");
//JLabel background
jLabel1 = new JLabel(img);
this.getLayeredPane().add(jLabel1, new Integer(Integer.MIN_VALUE));
jLabel1.setBounds(0, 0, img.getIconWidth(), img.getIconHeight());
String userName = "sa"; //SQL用户名
String userPwd = ""; //密码
Connection dbConn;
jLabel4.setFont(new java.awt.Font("宋体", Font.PLAIN, 18));
jLabel4.setForeground(Color.magenta);
jLabel4.setDebugGraphicsOptions(0);
jLabel4.setDisabledIcon(icon);
JMenuBar jMenuBar1 = new JMenuBar();
JMenu m1=new JMenu("图书");
JMenuItem n0=new JMenuItem("借出");
JMenuItem n1=new JMenuItem("还回");
JMenuItem n2=new JMenuItem("查询");
JMenuItem n3=new JMenuItem("负责预定");
JMenuItem n9=new JMenuItem("续借");
n0.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
abClicked(e);
}
});
n1.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
abbClicked(e);
}
});
n2.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
aac(e);
}
});
jLabel1.setText("");
m1.add(n0);
m1.add(n1);
m1.add(n2);
m1.add(n3);
m1.add(n9);
jMenuBar1.add(m1);
JMenu m2=new JMenu("学生");
JMenuItem n4=new JMenuItem("查询");
m2.add(n4);
jMenuBar1.add(m2);
n3.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
bbcClicked(e);
}
});
n4.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
aaa(e);
}
});
JMenu m3=new JMenu("历史记录");
JMenuItem n5=new JMenuItem("历史记录");
m3.add(n5);
jMenuBar1.add(m3);
n5.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
aab(e);
}
});
n9.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
aabbb(e);
}
});
this.getContentPane().add(jMenuBar1, BorderLayout.NORTH);
this.getContentPane().add(jPanel1, java.awt.BorderLayout.WEST);
jPanel1.add(jLabel4, new XYConstraints(84, 39, -1, -1));
jPanel1.add(jLabel1, new XYConstraints(12, 73, 382, 205));
try
{
Class.forName(driverName);
dbConn = DriverManager.getConnection(dbURL, userName, userPwd);
}
catch(SQLException ex)
{
}
// 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);
}
//public void paint(Graphics g)
// {
// g=jPanel1.getGraphics();
// g.drawImage(image,0,0,null);
//}
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)
{
history dlg=new history();
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 aabbb(ActionEvent e)
{
xujie dlg=new xujie();
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 abbClicked(ActionEvent e)
{
huanshu dlg=new huanshu();
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 bbcClicked(ActionEvent e)
{
fuzeyuding dlg=new fuzeyuding();
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)
{
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 abClicked(ActionEvent e)
{
jiechu dlg=new jiechu();
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 + -