📄 dailypperationmagezinsystempanel.java
字号:
jTpRightBottomjPanel2.add(jTxpurchaseMoneyX);
jTpRightBottomjPanel2.add(jtxbookTypeX);
jTpRightBottom.add(jTpRightBottomjPanel4, "jTpRightBottomjPanel4");
jTpRightBottomjPanel3.add(jTxNumberG);
jTpRightBottomjPanel3.add(jLabel29);
jTpRightBottomjPanel3.add(jLabel19);
jTpRightBottomjPanel3.add(jLabel1);
jTpRightBottomjPanel3.add(jLabel16);
jTpRightBottomjPanel3.add(jTxbookTypeG);
jTpRightBottomjPanel3.add(jTxbookConcernG);
jTpRightBottomjPanel3.add(jTxpurchaseMoneyG);
jTpRightBottomjPanel3.add(jButton1);
jTpRightBottomjPanel3.add(jTxReaderNumG);
jTpRightBottomjPanel3.add(jLabel18);
jTpRightBottomjPanel3.add(jtxbooksNameG);
jTpRightBottomjPanel3.add(jLabel17);
jTpRightBottomjPanel3.add(jTxbookNumG);
jTpRightBottomjPanel3.add(jLabel15);
jTpRightBottomjPanel3.add(jTxbookAuthorG);
jTpRightBottomjPanel3.add(jLabel30);
jTpRightBottomjPanel3.add(btnReturnBooks);
jTpRightBottomjPanel4.add(jLabel23);
jTpRightBottomjPanel4.add(jtxbooksNamexD);
jTpRightBottomjPanel4.add(jTxbookNumD);
jTpRightBottomjPanel4.add(jLabel22);
jTpRightBottomjPanel4.add(jLabel20);
jTpRightBottomjPanel4.add(jTxbookAuthorD);
jTpRightBottomjPanel4.add(jTxReaderNumD);
jTpRightBottomjPanel4.add(jLabel32);
jTpRightBottomjPanel4.add(BtnQuerenD);
jTpRightBottomjPanel4.add(btnRsectD);
jTpRightBottomjPanel4.add(jLabel21);
jTpRightBottomjPanel4.add(jLabel3);
jTpRightBottomjPanel4.add(jLabel24);
jTpRightBottomjPanel4.add(jLabel31);
jTpRightBottomjPanel4.add(jTxNumberD);
jTpRightBottomjPanel4.add(jTxpurchaseMoneyD);
jTpRightBottomjPanel4.add(jTxbookConcernD);
jTpRightBottomjPanel4.add(jTxbookTypeD);
jTpRightBottom.setSelectedComponent(jTpRightBottomPane1);
}
public void loginTree()
{
ResultSet re = null;
DefaultMutableTreeNode magazinetypeFather[];
DefaultMutableTreeNode magazinetypeChilkl[];
int size = 0;
int j = 0;
int i = 0;
int arry[] = new int[26];
//连接数据库
// if (db.getconn()) {
//获得结果集
re = db.searchMagazinTree();
try
{
while (re.next()) {
size++;
}
magazinetypeFather = new DefaultMutableTreeNode[size];
magazinetypeChilkl = new DefaultMutableTreeNode[size];
boolean a = re.first();
String TypeFather = "";
String TypeChild = "";
for (i = 0, j = 0; a; i++) {
String TypeFather1 = re.getString(2).trim();
String TypeChild1 = re.getString(3).trim();
if(!TypeFather.trim().equals(TypeFather1))
{ TypeFather = TypeFather1;
magazinetypeFather[j] = new DefaultMutableTreeNode(TypeFather);
qikan.add(magazinetypeFather[j]);
j++;
}
magazinetypeChilkl[i] = new DefaultMutableTreeNode(TypeChild1);
magazinetypeFather[j-1].add( magazinetypeChilkl[i]);
a=re.next();
}
jTreeqikan.updateUI();
}
catch (SQLException ex) {
System.out.println(ex.toString());
}
db.myClose(1);
}
public void display()
{
DefaultMutableTreeNode clickNode = (DefaultMutableTreeNode) jTreeqikan.getLastSelectedPathComponent();
String sql="";
String sql2= "";
String bti="";
//数据库表没有见
if (clickNode != null ) {
//查询条件许转换
if(clickNode.toString().trim().equals("所有期刊"))
{
bti="%";
}
else
{
sql = "select TypeID from typechaxun where magazinTypeName='"+clickNode.toString().trim() + "'";
sql2 = "select TypeID1 from typechaxun where typeName='"+clickNode.toString().trim() + "'";
db.search(sql);
try {
if (db.rs.next())
bti = db.rs.getString(1).trim();
else
{
db.myClose(1);
db.search(sql2);
if (db.rs.next())
bti = db.rs.getString(1).trim();
}
} catch (SQLException ex) {
System.out.println(ex.toString());
}
db.myClose(1);
}
sql = "select * from magazineInfo where typenumbers like'"+bti.trim()+"'+'%'";
// jlbM.setText(clickNode.toString().trim()+"类 期刊信息列表");
// jtxBookType1.setText(clickNode.toString().trim());
// jtxBookType2.setText(clickNode.toString().trim());
fenlei=clickNode.toString().trim();
tableDisp(sql);
}
}
public void tableDisp(String sql)
{
String[][] data;
ResultSet rs;
try
{
rs = db.booksInfosearch(sql);
int count = 0;
while (rs.next())
count++;
rs.first();
data = new String[count][title.length];
for (int i = 0; i < count; i++) {
for (int j = 0; j < title.length; j++)
{
String s = "";
if(j==8)
s= (new Float( rs.getFloat(j+2))).toString().trim()+"元";
else
s= rs.getString(j + 2);
if (s == null)
s = "null";
data[i][j] = s.trim();
}
rs.next();
}
DefaultTableModel model = new DefaultTableModel(data, title);
jTabRightTop.setModel(model);
jTabRightTop.updateUI();
}
catch(SQLException sex)
{
System.out.println(sex.toString());
// sex.printStackTrace();
}
db.myClose(1);
}
public void jScright_ancestorResized(HierarchyEvent e) {
jPanRight.setSize((jScright.getWidth()-1),(jScright.getHeight()-1));
}
public void jScright_componentResized(ComponentEvent e) {
jPanRight.setSize((jSpSystemPanel.getWidth()- jScleft.getWidth()),(jSpSystemPanel.getHeight()-1));
}
public void jPaneRightBottom_componentResized(ComponentEvent e) {
jTpRightBottom.setSize(jPaneRightBottom.getWidth()-1,jPaneRightBottom.getHeight()-1);
}
public void jSpSystemPanel_componentResized(ComponentEvent e) {
jPanRight.setSize((jSpSystemPanel.getWidth()- jScleft.getWidth()),(jSpSystemPanel.getHeight()-1));
}
public void jTreBooks_mouseClicked(MouseEvent e) {
display();
}
public void jTabRightTop_mouseClicked(MouseEvent e) {
if(e.getButton()==e.BUTTON1)
{
/*
jTxbookNum.setText("");
jTxbookAuthor.setText("");
jTxbookConcern.setText("");
jTxpurchaseMoney.setText("");
*/
//表的行从0开始编号
//JOptionPane.showMessageDialog(null,""+jTabRightTop.getSelectedRow());
//获取书名
String name=jTabRightTop.getValueAt(jTabRightTop.getSelectedRow(),1).toString();
jTxbookName.setText(name);
jtxbooksNameG.setText(name);
jtxbooksNamex.setText(name);
jtxbooksNamexD.setText(name);
//获取书的编号
String bokksNum = jTabRightTop.getValueAt(jTabRightTop.getSelectedRow(),0).toString();
jTxbookNum.setText(bokksNum);
jTxbookNumD.setText(bokksNum);
jtxbooksNumX.setText(bokksNum);
jTxbookNumG.setText(bokksNum);
//获取书的作者
String author = jTabRightTop.getValueAt(jTabRightTop.getSelectedRow(),4).toString();
jTxbookAuthor.setText(author);
jTxbookAuthorD.setText(author);
jTxbookAuthorG.setText(author);
jTxbookAuthorX.setText(author);
//获取出版社
String concern = jTabRightTop.getValueAt(jTabRightTop.getSelectedRow(),3).toString();
jTxbookConcern.setText(concern);
jTxbookConcernD.setText(concern);
jTxbookConcernG.setText(concern);
jTxbookConcernX.setText(concern);
//获取定价
String money = jTabRightTop.getValueAt(jTabRightTop.getSelectedRow(),8).toString();
jTxpurchaseMoney.setText(money);
jTxpurchaseMoneyD.setText(money);
jTxpurchaseMoneyG.setText(money);
jTxpurchaseMoneyX.setText(money);
//获取书的类型
jTxbookType.setText(fenlei);
jTxbookTypeD.setText(fenlei);
jTxbookTypeG.setText(fenlei);
jtxbookTypeX.setText(fenlei);
}
}
public void btnReset_actionPerformed(ActionEvent e) {
jTxbookNum.setText("");
jTxbookAuthor.setText("");
jTxbookConcern.setText("");
jTxpurchaseMoney.setText("");
jTxbookName.setText("");
jTxbookType.setText("");
jTxreaderNum.setText("");
jTxNumber.setText("点击查询当前读者的借书数量");
}
public void jTxNumber_mouseClicked(MouseEvent e) {
//查询读者的借书数量
borrowBooksNum();
}
public void jPanRight_componentResized(ComponentEvent e) {
jPanelRightTop.setSize((jPanRight.getWidth()-1),
(jPanRight.getHeight()) / 2-3);
jScrollPane1.setSize((jPanelRightTop.getWidth()),jPanelRightTop.getHeight());
// jSpSystemPanel.setDividerLocation(0.21);
jPaneRightBottom.setBounds(jPanRight.getX(),jPanRight.getHeight()/2-1,(jPanRight.getWidth()-1),
(jPanRight.getHeight()) / 2-1);
}
public void this_componentResized(ComponentEvent e) {
jSpSystemPanel.setSize( (this.getWidth())-5,(this.getHeight()-30));
jSpSystemPanel.setDividerLocation(0.26);
jPanRight.setSize((jSpSystemPanel.getWidth()- jScleft.getWidth()),(jSpSystemPanel.getHeight()-1));
}
public void this_ancestorResized(HierarchyEvent e) {
jSpSystemPanel.setSize( (this.getWidth())-5,(this.getHeight()-30));
jSpSystemPanel.setDividerLocation(0.26);
jPanRight.setSize((jSpSystemPanel.getWidth()- jScleft.getWidth()),(jSpSystemPanel.getHeight()-1));
jPanelSystemTop.setSize(this.getWidth()-5,30);
}
public void jTxReaderNumG_mouseClicked(MouseEvent e) {
inputReaderNum();
}
public void inputReaderNum()
{
String bianhao="";
try {
bianhao= JOptionPane.showInputDialog(null,"请输入读者编号 例如 ","A0000001").trim();
} catch (Exception ex) {
// JOptionPane.showMessageDialog(null, "你没有输入读者信息");
}
if(!bianhao.equals("")){
if ((int)bianhao.charAt(0)>='A' && (int)bianhao.charAt(0) <= 'Z' ) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -