请帮助它不紧急 [英] plz help its NOT urgent

查看:107
本文介绍了请帮助它不紧急的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

导入java.awt.*;
导入java.awt.event.*;
导入java.util.*;
导入java.sql.*;
导入javax .swing.*;
导入javax.swing.event.*;
导入javax.swing.border.*;
导入java.io. *;
导入java.text.*;
import java.net.*;
import javax.help.*;

import java.awt.*;
import java.awt.event.*;
import java.util.*;
import java.sql.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.border.*;
import java.io.*;
import java.text.*;
import java.net.*;
import javax.help.*;

导入表.*;
导入对话框.*;
导入事务.*;
导入实用程序**;
导入数据库.*;
导入报告.*;
>导入安全性.*;

import Tables.*;
import Dialog.*;
import Transaction.*;
import Utils.*;
import Database.*;
import Reports.*;
import Security.*;

公共类Menu扩展了JFrame {

public class Menu extends JFrame {

//指向单个对话框的指针
受保护的BorrowerListMenu listBorrowerDialog = null;受保护的CategoryListMenu listCategoryDialog = null;
受保护的CategoryCategoryDialog listCategoryDialog = null;
受保护的AddCategoryDialog addCategoryDialog = null;受保护的AddBorrowerDialog addBorrowerDialog = null;受保护的AddItemDialog addItemDialog = null;受保护的FindItemDialog findItemDialog = null;受保护的FindBorrowerDialog findBorrowerDialog = null;受保护的FindCategoryDialog findCategoryDialog = null;受保护的BorrowDialog brdg = null;
br>受保护的ReturnDialog retdg = null;受保护的ModifyManagerSettingDialog userdg = null;受保护的ModifyPolicySettingDialog policydg = null;受保护的OverdueReportMenu Overdueptr = null;受保护的FinesSummaryReportMenu FinesSummaryptr = null;受保护的ItemOutReportMenu Itemoutptr = null;受保护的ReserveReportMenu Reservedg = null;受保护的Top10Repor tMenu Top10ptr = null;受保护的BorrowerSuspendedReportMenu Borrowersuspendedptr = null;受保护的BorrowerHoldingReportMenu Borrowerholdingptr = null;受保护的JFrame helpdg = null;受保护的LoginDialog logindg = null;受保护的CalendarDialog calendardg = null;
受保护的BorrowerTypeDialogborrowertypedg = null;

// Pointers to individual Dialog
protected BorrowerListMenu listBorrowerDialog = null;
protected ItemListMenu listItemDialog = null;
protected CategoryListMenu listCategoryDialog = null;
protected AddCategoryDialog addCategoryDialog = null;
protected AddBorrowerDialog addBorrowerDialog = null;
protected AddItemDialog addItemDialog = null;
protected FindItemDialog findItemDialog = null;
protected FindBorrowerDialog findBorrowerDialog = null;
protected FindCategoryDialog findCategoryDialog = null;
protected BorrowDialog brdg = null;
protected ReturnDialog retdg = null;
protected ArchiveManager archiveDialog = null;
protected ModifyUserSettingDialog userdg = null;
protected ModifyPolicySettingDialog policydg = null;
protected OverdueReportMenu Overdueptr = null;
protected FinesSummaryReportMenu FinesSummaryptr = null;
protected ItemOutReportMenu Itemoutptr = null;
protected ReserveReportMenu Reservedg = null;
protected Top10ReportMenu Top10ptr = null;
protected BorrowerSuspendedReportMenu Borrowersuspendedptr = null;
protected BorrowerHoldingReportMenu Borrowerholdingptr = null;
protected JFrame helpdg = null;
protected LoginDialog logindg = null;
protected CalendarDialog calendardg = null;
protected BorrowerTypeDialog borrowertypedg = null;

//ActionListener变量
受保护的ActionListener quitActionListener = null;
受保护的ActionListener LogoffActionListener = null;
受保护的ActionListener借款动作= null;
受保护的ActionListener returnAction = null;
受保护的ActionListener listBorrowerActionListener = null;受保护的ActionListener listItemActionListener = null;受保护的ActionListener OverdueActionListener = null;受保护的ActionListener ItemoutActionListener = null;受保护的ActionListener Top10ActionListener = null;受保护的ActionListener BorrowerSuspendedActionListener = null;
受保护的ActionListener BorrowerHoldingActionListener = null;
受保护的ActionListener findItemActionListener = null;
受保护的ActionListener findBorrowerActionListener = null;

// ActionListener variables
protected ActionListener quitActionListener = null;
protected ActionListener LogoffActionListener = null;
protected ActionListener borrowAction = null;
protected ActionListener returnAction = null;
protected ActionListener listBorrowerActionListener = null;
protected ActionListener listItemActionListener = null;
protected ActionListener OverdueActionListener = null;
protected ActionListener ItemoutActionListener = null;
protected ActionListener Top10ActionListener = null;
protected ActionListener BorrowerSuspendedActionListener = null;
protected ActionListener BorrowerHoldingActionListener = null;
protected ActionListener findItemActionListener = null;
protected ActionListener findBorrowerActionListener = null;

//状态栏指针
私有StatusBar statusBar = null;

//Status bar pointer
private StatusBar statusBar = null;

//哈希表变量
受保护的哈希表m_lfs;
私有LogWriter LGWRITER = LogWriter.GetInstance();
静态私有最终int UI_STYLE_METAL = 0;
静态私有最终int UI_STYLE_MOTIF = 1;静态私有最终int UI_STYLE_WINDOWS = 2;静态私有最终int UI_STYLE_MALACHITELF = 3;私人私有CURRENT_UI_SYTLE = Integer.valueOf(LGWRITER.getParameter(LogWriter.UI_STYLE)).intValue();
私有字符串用户名= LGWRITER.getParameter(LogWriter.USER_NAME);

// Hash Tables Variables
protected Hashtable m_lfs;
private LogWriter LGWRITER = LogWriter.GetInstance();
static private final int UI_STYLE_METAL = 0;
static private final int UI_STYLE_MOTIF = 1;
static private final int UI_STYLE_WINDOWS = 2;
static private final int UI_STYLE_MALACHITELF = 3;
private int CURRENT_UI_SYTLE = Integer.valueOf( LGWRITER.getParameter(LogWriter.UI_STYLE) ).intValue();
private String username = LGWRITER.getParameter(LogWriter.USER_NAME);

//QueryManager的实例
私有QueryManager queryMgr = QueryManager.GetInstance();

// Instance of QueryManager
private QueryManager queryMgr = QueryManager.GetInstance();

//对于扫描器
private JButton sidebutton = new JButton();
private int buff_i = -1;
private char buff [] = new char [30];
private ReturnReader Scannerdg ;

// For Scanner
private JButton sidebutton = new JButton();
private int buff_i = -1;
private char buff[] = new char[30];
private ReturnReader scannerdg;

/**
*用于安装新UI Manager的函数
*/
private void addLookAndFeel(){尝试
{
LookAndFeel孔雀石=新孔雀石.MalachiteLF() ;
UIManager.LookAndFeelInfo信息= <新的UIManager.LookAndFeelInfo(malachite.getName(),
malachite.getClass().getName());
UIManager.installLookAndFeel(info);
}
catch(异常例外)
{
ex.printStackTrace();
}
}

/**
* Function to install new UI Manager
*/
private void addLookAndFeel() {
try
{
LookAndFeel malachite = new malachite.MalachiteLF();
UIManager.LookAndFeelInfo info =
new UIManager.LookAndFeelInfo(malachite.getName(),
malachite.getClass().getName());
UIManager.installLookAndFeel(info);
}
catch (Exception ex)
{
ex.printStackTrace();
}
}

/**
*设置外观的函数
*/
private void setUIMgr(){

/**
* Function to set Look and Feel
*/
private void setUIMgr() {

try {
int ui = Integer.valueOf(LGWRITER.getParameter(LogWriter.UI_STYLE)).intValue();
switch(ui){ UIManager.setLookAndFeel( "com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
CURRENT_UI_SYTLE = UI_STYLE_WINDOWS;
break; UI_STYLE_MOTIF:
UIManager.setLookAndFeel("com.sun.java.swing .plaf.motif.MotifLookAndFeel);
CURRENT_UI_SYTLE = UI_STYLE_MOTIF;
break;
case UI_STYLE_MALACHITELF:
UIManager.setLookAndFeel(" malachite.MalachiteLF);
CURRENT_UI_SYTLE > break;
默认值:
CURRENT_UI_SYTLE = UI_STYLE_METAL;
break;
}
}
catch(异常例外){
ex.printStackTrace();
}
}

try {
int ui = Integer.valueOf( LGWRITER.getParameter(LogWriter.UI_STYLE) ).intValue();
switch(ui) {
case UI_STYLE_WINDOWS :
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
CURRENT_UI_SYTLE = UI_STYLE_WINDOWS;
break;
case UI_STYLE_MOTIF :
UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");
CURRENT_UI_SYTLE = UI_STYLE_MOTIF;
break;
case UI_STYLE_MALACHITELF :
UIManager.setLookAndFeel("malachite.MalachiteLF");
CURRENT_UI_SYTLE = UI_STYLE_MALACHITELF;
break;
default:
CURRENT_UI_SYTLE = UI_STYLE_METAL;
break;
}
}
catch (Exception ex) {
ex.printStackTrace();
}
}

/**
*用于保存用户的UI设置的功能
*/
受保护的同步void saveUISettings(){

/**
* Function to save User''s UI Settings
*/
protected synchronized void saveUISettings() {

int ui = Integer.valueOf(LGWRITER.getParameter(LogWriter.UI_STYLE)).intValue();
if(CURRENT_UI_SYTLE!= ui){
int userid = Integer.valueOf(LGWRITER.getParameter(LogWriter .USER_ID)).intValue();
字符串sqlstr ="UPDATE Users SET" +
"UIStyle =" + CURRENT_UI_SYTLE +
"WHERE UserID =" + userid;

int ui = Integer.valueOf( LGWRITER.getParameter(LogWriter.UI_STYLE) ).intValue();
if (CURRENT_UI_SYTLE != ui) {
int userid = Integer.valueOf( LGWRITER.getParameter(LogWriter.USER_ID) ).intValue();
String sqlstr = "UPDATE Users SET " +
"UIStyle = " + CURRENT_UI_SYTLE +
" WHERE UserID = " + userid;

if(queryMgr.dmlOperations("jndi-library",sqlstr)){
LGWRITER.writeLog(LogWriter.MSG_SETTINGS,用户名+修改UI设置"));
}
System.out. println("\ n \ tUI设置成功保存");
}否则System.out.println("\ n \ tUI设置未保存");

if ( queryMgr.dmlOperations("jndi-library", sqlstr) ) {
LGWRITER.writeLog(LogWriter.MSG_SETTINGS, username + " modifys UI SETTINGS" );
}
System.out.println("\n\tUI Settings successfully saved");
} else System.out.println("\n\tUI Settings not saved");

}

/**
*重新加载配置文件的功能
*/
私有无效reloadProfile(){ LGWRITER.setUserNull();
用户名= LGWRITER.getParameter(LogWriter.USER_NAME) ;
statusBar.setPaneText(username);
}

/**
* Function to reload profile
*/
private void reloadProfile() {
LGWRITER.setUserNull();
username = LGWRITER.getParameter(LogWriter.USER_NAME);
statusBar.setPaneText(username);
}

公共菜单(){

//Initialise
super(Constants.DEFAULT_TITLE);
//setUndecorated(true);
//getRootPane().setWindowDecorationStyle(JRootPane.FRAME);
addLookAndFeel();
setUIMgr();
//setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JMenuBar menuBar = new JMenuBar();
setJMenuBar(menuBar);
addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){ aveUISettings();
queryMgr.closeQueryManager();
LGWRITER.writeLog(LogWriter.MSG_SECURTY,用户名+已注销");
LGWRITER.closeLog( );
}

//Initialise
super(Constants.DEFAULT_TITLE);
//setUndecorated(true);
//getRootPane().setWindowDecorationStyle(JRootPane.FRAME);
addLookAndFeel();
setUIMgr();
//setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JMenuBar menuBar = new JMenuBar();
setJMenuBar(menuBar);
addWindowListener( new WindowAdapter() {
public void windowClosing(WindowEvent e) {
saveUISettings();
queryMgr.closeQueryManager();
LGWRITER.writeLog(LogWriter.MSG_SECURTY, username + " logged out");
LGWRITER.closeLog();
}

public void windowActivated(WindowEvent e){
//System.out.println("focus");
//sidebutton.requestFocusInWindow();
requestFocusInWindow();
}

public void windowActivated(WindowEvent e) {
// System.out.println("focus");
//sidebutton.requestFocusInWindow();
requestFocusInWindow();
}

});

ActionListener actionListener = new ActionListener(){ void actionPerformed(ActionEvent event){ event.getActionCommand()+" "已激活",
菜单项已激活",JOptionPane.INFORMATION_MESSAGE);
}
};

ActionListener actionListener = new ActionListener() {
public void actionPerformed(ActionEvent event) {
JOptionPane.showMessageDialog(Menu.this, "Menu item ''" +
event.getActionCommand() + "'' was activated",
"Menu Item Activated", JOptionPane.INFORMATION_MESSAGE);
}
};

ActionListener aboutActionListener =新的ActionListener(){ JOptionPane.showMessageDialog(Menu.this,Constants.DEFAULT_TITLE +"CCD DVD Trading Version 1.0 \ nCopyright @Nov 2009"
,Constants.DEFAULT_TITLE,JOptionPane.INFORMATION_MESSAGE);
}
};

ActionListener aboutActionListener = new ActionListener() {
public void actionPerformed(ActionEvent event) {
JOptionPane.showMessageDialog(Menu.this, Constants.DEFAULT_TITLE + " CCD DVD Trading Version 1.0\nCopyright @Nov 2009"
, Constants.DEFAULT_TITLE, JOptionPane.INFORMATION_MESSAGE);
}
};

//退出
quitActionListener = new ActionListener(){
public void actionPerformed(ActionEvent event){ LGWRITER.writeLog(LogWriter.MSG_SECURTY,用户名+已注销");

// Quit
quitActionListener = new ActionListener() {
public void actionPerformed(ActionEvent event) {
LGWRITER.writeLog(LogWriter.MSG_SECURTY, username + " logged out");

int结果= JOptionPane.showConfirmDialog(Menu.this,
确认退出吗?",
Constants.DEFAULT_TITLE,
JOptionPane.YES_NO_OPTION);
如果(结果== 0){
saveUISettings();
queryMgr.closeQueryManager();
LGWRITER.closeLog();
System.exit(0);
}
}
};

int result = JOptionPane.showConfirmDialog(Menu.this,
"Confirm Exit?",
Constants.DEFAULT_TITLE,
JOptionPane.YES_NO_OPTION);
if (result == 0) {
saveUISettings();
queryMgr.closeQueryManager();
LGWRITER.closeLog();
System.exit(0);
}
}
};

//注销
LogoffActionListener = new ActionListener(){ public void actionPerformed(ActionEvent event){
Menu.this.setVisible(false);
//密码菜单
工具箱theKit = Menu.this.getToolkit();
Dimension wndSize = theKit.getScreenSize();
if(logindg == null){ logindg =新的LoginDialog(Menu.this);
logindg.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){}
});
logindg.setBounds(wndSize.width /3,wndSize.height/3,300,150);
} else
logindg.resetFields();
logindg.setVisible(true);
//重新加载配置文件
reloadProfile( );
Menu.this.setVisible(true);
}
};

// Log off
LogoffActionListener = new ActionListener() {
public void actionPerformed(ActionEvent event) {
Menu.this.setVisible(false);
// Password Menu
Toolkit theKit = Menu.this.getToolkit();
Dimension wndSize = theKit.getScreenSize();
if (logindg == null) {
logindg = new LoginDialog(Menu.this);
logindg.addWindowListener( new WindowAdapter() {
public void windowClosing(WindowEvent e) {
logindg.setVisible(false);
}
});
logindg.setBounds(wndSize.width/3, wndSize.height/3, 300, 150);
} else
logindg.resetFields();
logindg.setVisible(true);
// Reload profile
reloadProfile();
Menu.this.setVisible(true);
}
};

//Reports
Top10ActionListener = new ActionListener(){
public void actionPerformed(ActionEvent event){

//Reports
Top10ActionListener = new ActionListener() {
public void actionPerformed(ActionEvent event) {

if(Top10ptr == null){
Top10ptr = new Top10ReportMenu();
Top10ptr.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
Top10ptr.setSize(650,400);
Top10ptr. setResizable(false);
Top10ptr.setVisible(true);
Top10ptr.addWindowListener(new WindowAdapter(){ Top10ptr.ST.close();
} catch(SQLException se){se.printStackTrace();}
Top10ptr = null;
}

if (Top10ptr == null ) {
Top10ptr = new Top10ReportMenu();
Top10ptr.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
Top10ptr.setSize(650, 400);
Top10ptr.setResizable(false);
Top10ptr.setVisible(true);
Top10ptr.addWindowListener( new WindowAdapter() {
public void windowClosed(WindowEvent e) {
try {
Top10ptr.RS.close();
Top10ptr.ST.close();
} catch(SQLException se) { se.printStackTrace(); }
Top10ptr = null;
}

});
}
}
};

});
}
}
};

OverdueActionListener =新的ActionListener(){
public void actionPerformed(ActionEvent事件){

OverdueActionListener = new ActionListener() {
public void actionPerformed(ActionEvent event) {

if(Overdueptr == null){
Overdueptr = new OverdueReportMenu();
Overdueptr.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
Overdueptr.setSize(700,400);
Overdueptr. setResizable(false);
Overdueptr.setVisible(true);
Overdueptr.addWindowListener(new WindowAdapter(){ Overdueptr.ST.close();
} catch(SQLException se){se.printStackTrace();}
Overdueptr = null;
}

if (Overdueptr == null ) {
Overdueptr = new OverdueReportMenu();
Overdueptr.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
Overdueptr.setSize(700, 400);
Overdueptr.setResizable(false);
Overdueptr.setVisible(true);
Overdueptr.addWindowListener( new WindowAdapter() {
public void windowClosed(WindowEvent e) {
try {
Overdueptr.RS.close();
Overdueptr.ST.close();
} catch(SQLException se) { se.printStackTrace(); }
Overdueptr = null;
}

});
}
}
};

});
}
}
};

ItemoutActionListener = new ActionListener(){
public void actionPerformed(ActionEvent event){

ItemoutActionListener = new ActionListener() {
public void actionPerformed(ActionEvent event) {

if(Itemoutptr == null){
Itemoutptr = new ItemOutReportMenu();
Itemoutptr.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
Itemoutptr.setSize(700,400);
Itemoutptr. setResizable(false);
Itemoutptr.setVisible(true);
Itemoutptr.addWindowListener(new WindowAdapter(){ Itemoutptr.ST.close();
} catch(SQLException se){se.printStackTrace();}
Itemoutptr = null;
}

if (Itemoutptr == null ) {
Itemoutptr = new ItemOutReportMenu();
Itemoutptr.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
Itemoutptr.setSize(700, 400);
Itemoutptr.setResizable(false);
Itemoutptr.setVisible(true);
Itemoutptr.addWindowListener( new WindowAdapter() {
public void windowClosed(WindowEvent e) {
try {
Itemoutptr.RS.close();
Itemoutptr.ST.close();
} catch(SQLException se) { se.printStackTrace(); }
Itemoutptr = null;
}

});
}
}
};

});
}
}
};

ActionListener ReserveActionListener = new ActionListener(){
public void actionPerformed(ActionEvent event){

ActionListener ReserveActionListener = new ActionListener() {
public void actionPerformed(ActionEvent event) {

if(Reservedg == null){
Reservedg = new ReserveReportMenu();
Reservedg.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
Reservedg.setSize(700,400);
Reservedg. setResizable(false);
Reservedg.setVisible(true);
Reservedg.addWindowListener(new WindowAdapter(){ windowClosed(WindowEvent e){ close();
Reservedg.ST.close();
} catch(SQLException se){se.printStackTrace();}
Reservedg = null;
}

if (Reservedg == null ) {
Reservedg = new ReserveReportMenu();
Reservedg.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
Reservedg.setSize(700, 400);
Reservedg.setResizable(false);
Reservedg.setVisible(true);
Reservedg.addWindowListener( new WindowAdapter() {
public void windowClosed(WindowEvent e) {
try {
Reservedg.RS.close();
Reservedg.ST.close();
} catch(SQLException se) { se.printStackTrace(); }
Reservedg = null;
}

});
}
}
};

});
}
}
};

BorrowerSuspendedActionListener = new ActionListener(){
public void actionPerformed(ActionEvent event){

BorrowerSuspendedActionListener = new ActionListener() {
public void actionPerformed(ActionEvent event) {

if(Borrowersuspendedptr == null){
Borrowersuspendedptr = new BorrowerSuspendedReportMenu();
Borrowersuspendedptr.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
Borrowersuspendedptr.setSize(600,450) setResizable(false);
Borrowersuspendedptr.setVisible(true);
Borrowersuspendedptr.addWindowListener(new WindowAdapter(){ Borrowersuspendedptr.ST.close();
} catch(SQLException se){se.printStackTrace();}
Borrowersuspendedptr = null;
}

if (Borrowersuspendedptr == null ) {
Borrowersuspendedptr = new BorrowerSuspendedReportMenu();
Borrowersuspendedptr.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
Borrowersuspendedptr.setSize(600, 450);
Borrowersuspendedptr.setResizable(false);
Borrowersuspendedptr.setVisible(true);
Borrowersuspendedptr.addWindowListener( new WindowAdapter() {
public void windowClosed(WindowEvent e) {
try {
Borrowersuspendedptr.RS.close();
Borrowersuspendedptr.ST.close();
} catch(SQLException se) { se.printStackTrace(); }
Borrowersuspendedptr = null;
}

});
}
}
};

});
}
}
};

BorrowerHoldingActionListener = new ActionListener(){
public void actionPerformed(ActionEvent event){

BorrowerHoldingActionListener = new ActionListener() {
public void actionPerformed(ActionEvent event) {

if(Borrowerholdingptr == null){
Borrowerholdingptr = new BorrowerHoldingReportMenu();
Borrowerholdingptr.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
Borrowerholdingptr.setSize(600,450);
setResizable(false);
Borrowerholdingptr.setVisible(true);
Borrowerholdingptr.addWindowListener(new WindowAdapter(){ Borrowerholdingptr.ST.close();
} catch(SQLException se){se.printStackTrace();}
Borrowerholdingptr = null;
}

if (Borrowerholdingptr == null ) {
Borrowerholdingptr = new BorrowerHoldingReportMenu();
Borrowerholdingptr.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
Borrowerholdingptr.setSize(600, 450);
Borrowerholdingptr.setResizable(false);
Borrowerholdingptr.setVisible(true);
Borrowerholdingptr.addWindowListener( new WindowAdapter() {
public void windowClosed(WindowEvent e) {
try {
Borrowerholdingptr.RS.close();
Borrowerholdingptr.ST.close();
} catch(SQLException se) { se.printStackTrace(); }
Borrowerholdingptr = null;
}

});
}
}
};

});
}
}
};

ActionListener FinesSummaryActionListener = new ActionListener(){
public void actionPerformed(ActionEvent event){

ActionListener FinesSummaryActionListener = new ActionListener() {
public void actionPerformed(ActionEvent event) {

if(FinesSummaryptr == null){
FinesSummaryptr = new FinesSummaryReportMenu();
FinesSummaryptr.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
FinesSummaryptr.setBounds(50,50,650,500).
setResizable(false);
FinesSummaryptr.setVisible(true);
FinesSummaryptr.addWindowListener(new WindowAdapter(){ FinesSummaryptr.ST.close();
} catch(SQLException se){se.printStackTrace();}
FinesSummaryptr = null;
}

if (FinesSummaryptr == null ) {
FinesSummaryptr = new FinesSummaryReportMenu();
FinesSummaryptr.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
FinesSummaryptr.setBounds(50,50,650,500);
FinesSummaryptr.setResizable(false);
FinesSummaryptr.setVisible(true);
FinesSummaryptr.addWindowListener( new WindowAdapter() {
public void windowClosed(WindowEvent e) {
try {
FinesSummaryptr.RS.close();
FinesSummaryptr.ST.close();
} catch(SQLException se) { se.printStackTrace(); }
FinesSummaryptr = null;
}

});
}
}
};

});
}
}
};

//交易
borrowAction = new ActionListener(){
public void actionPerformed(ActionEvent event){

// Transaction
borrowAction = new ActionListener() {
public void actionPerformed(ActionEvent event) {

if(brdg == null){
brdg = new BorrowDialog("Borrow Dialog");
brdg.setResizable(false);
brdg.setBounds(50,50,600,500);
brdg.addWindowListener(new WindowAdapter(){
public void windowClosed(WindowEvent e){}
});
}
}
};

if (brdg == null ) {
brdg = new BorrowDialog("Borrow Dialog");
brdg.setResizable(false);
brdg.setBounds(50,50,600,500);
brdg.addWindowListener( new WindowAdapter() {
public void windowClosed(WindowEvent e) {
brdg = null;
}
});
}
}
};

returnAction = new ActionListener(){
public void actionPerformed(ActionEvent event){

returnAction = new ActionListener() {
public void actionPerformed(ActionEvent event) {

if(retdg == null){
retdg = new ReturnDialog(返回对话框");
retdg.setResizable(false);
retdg.setBounds(50,50,600,500);
retdg.addWindowListener(new WindowAdapter(){
public void windowClosed(WindowEvent e){ retdg = null;
}
});
}
}
};

if (retdg == null ) {
retdg = new ReturnDialog("Return Dialog");
retdg.setResizable(false);
retdg.setBounds(50,50,600,500);
retdg.addWindowListener( new WindowAdapter() {
public void windowClosed(WindowEvent e) {
retdg = null;
}
});
}
}
};


ActionListener ArchiveListener = new ActionListener(){
public void actionPerformed(ActionEvent event){


ActionListener ArchiveListener = new ActionListener() {
public void actionPerformed(ActionEvent event) {

if(archiveDialog == null){
archiveDialog = new ArchiveManager(Menu.this);

if (archiveDialog == null ) {
archiveDialog = new ArchiveManager(Menu.this);

archiveDialog.addWindowListener(new WindowAdapter(){
public void windowClosed(WindowEvent e){
archiveDialog = null;
}
});
}
}
};

archiveDialog.addWindowListener( new WindowAdapter() {
public void windowClosed(WindowEvent e) {
archiveDialog = null;
}
});
}
}
};

//借款人对话框
ActionListener addBorrowerActionListener = new ActionListener(){
public void actionPerformed(ActionEvent event){

// Borrower Dialogs
ActionListener addBorrowerActionListener = new ActionListener() {
public void actionPerformed(ActionEvent event) {

if(addBorrowerDialog == null){
addBorrowerDialog = new AddBorrowerDialog(Menu.this);

if (addBorrowerDialog == null ) {
addBorrowerDialog = new AddBorrowerDialog(Menu.this);

addBorrowerDialog.addWindowListener(new WindowAdapter(){
public void windowClosed(WindowEvent e){
addBorrowerDialog = null;
}
});
}
}
};

addBorrowerDialog.addWindowListener( new WindowAdapter() {
public void windowClosed(WindowEvent e) {
addBorrowerDialog = null;
}
});
}
}
};

findBorrowerActionListener = new ActionListener(){
public void actionPerformed(ActionEvent event){

findBorrowerActionListener = new ActionListener() {
public void actionPerformed(ActionEvent event) {

if(findBorrowerDialog == null){
findBorrowerDialog = new FindBorrowerDialog();
findBorrowerDialog.setResizable(false);
findBorrowerDialog.setVisible(true);
findBorrowerDialog.addWindowListener(new WindowAdapter (){
public void windowClosed(WindowEvent e){
//尝试{
//findBorrowerDialog.result_Set.close();
//} catch(SQLException se){}
findBorrowerDialog = null;
}
});
}
}
};

if (findBorrowerDialog == null ) {
findBorrowerDialog = new FindBorrowerDialog();
findBorrowerDialog.setResizable(false);
findBorrowerDialog.setVisible(true);
findBorrowerDialog.addWindowListener( new WindowAdapter() {
public void windowClosed(WindowEvent e) {
//try {
// findBorrowerDialog.result_Set.close();
//} catch(SQLException se) {}
findBorrowerDialog = null;
}
});
}
}
};

listBorrowerActionListener = new ActionListener(){
public void actionPerformed(ActionEvent event){

listBorrowerActionListener = new ActionListener() {
public void actionPerformed(ActionEvent event) {

if(listBorrowerDialog == null){
listBorrowerDialog = new BorrowerListMenu();
listBorrowerDialog.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
listBorrowerDialog.setSize(700,500);
listBorrowerDialog. setResizable(true);
listBorrowerDialog.setVisible(true);
listBorrowerDialog.addWindowListener(new WindowAdapter(){ listBorrowerDialog.ST.close();
} catch(SQLException se){se.printStackTrace();}
listBorrowerDialog = null;
}

if (listBorrowerDialog == null ) {
listBorrowerDialog = new BorrowerListMenu();
listBorrowerDialog.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
listBorrowerDialog.setSize(700, 500);
listBorrowerDialog.setResizable(true);
listBorrowerDialog.setVisible(true);
listBorrowerDialog.addWindowListener( new WindowAdapter() {
public void windowClosed(WindowEvent e) {
try {
listBorrowerDialog.RS.close();
listBorrowerDialog.ST.close();
} catch(SQLException se) { se.printStackTrace(); }
listBorrowerDialog = null;
}

});
}
}
};

});
}
}
};

ActionListener listBorrowerTypeActionListener = new ActionListener(){<公共无效actionPerformed(ActionEvent事件){ borrowertypedg.setResizable( false);
borrowertypedg.addWindowListener(new WindowAdapter(){
public void windowClosed(WindowEvent e){
borrowertypedg = null;
}
});
}
}
};

ActionListener listBorrowerTypeActionListener = new ActionListener() {
public void actionPerformed(ActionEvent event) {
if (borrowertypedg == null ) {
borrowertypedg = new BorrowerTypeDialog();
borrowertypedg.setResizable(false);
borrowertypedg.addWindowListener( new WindowAdapter() {
public void windowClosed(WindowEvent e) {
borrowertypedg = null;
}
});
}
}
};

//项目对话框
ActionListener addItemActionListener = new ActionListener(){
public void actionPerformed(ActionEvent event){

//Item Dialogs
ActionListener addItemActionListener = new ActionListener() {
public void actionPerformed(ActionEvent event) {

if(addItemDialog == null){
addItemDialog = new AddItemDialog(Menu.this);
addItemDialog.setBounds(50,50,600,250);
addItemDialog.addWindowListener(new WindowAdapter(){
public void windowClosed(WindowEvent e){
addItemDialog = null;
}
});
}
}
};

if (addItemDialog == null ) {
addItemDialog = new AddItemDialog(Menu.this);
addItemDialog.setBounds(50,50,600,250);
addItemDialog.addWindowListener( new WindowAdapter() {
public void windowClosed(WindowEvent e) {
addItemDialog = null;
}
});
}
}
};

findItemActionListener = new ActionListener(){
public void actionPerformed(ActionEvent event){

findItemActionListener = new ActionListener() {
public void actionPerformed(ActionEvent event) {

if(findItemDialog == null){
findItemDialog = new FindItemDialog();
findItemDialog.setResizable(false);
findItemDialog.setVisible(true);
findItemDialog.addWindowListener(new WindowAdapter (){
public void windowClosed(WindowEvent e){
findItemDialog = null;
}
});
}
}
};

if (findItemDialog == null ) {
findItemDialog = new FindItemDialog();
findItemDialog.setResizable(false);
findItemDialog.setVisible(true);
findItemDialog.addWindowListener( new WindowAdapter() {
public void windowClosed(WindowEvent e) {
findItemDialog = null;
}
});
}
}
};

listItemActionListener = new ActionListener(){
public void actionPerformed(ActionEvent event){

listItemActionListener = new ActionListener() {
public void actionPerformed(ActionEvent event) {

if(listItemDialog == null){
listItemDialog = new ItemListMenu();
listItemDialog.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
listItemDialog.setBounds(50,50,650,500);
listItemDialog. setResizable(true);
listItemDialog.setVisible(true);
listItemDialog.addWindowListener(new WindowAdapter(){ listItemDialog.ST.close();
} catch(SQLException se){se.printStackTrace();}
listItemDialog = null;
}
});
}
}
};

if (listItemDialog == null ) {
listItemDialog = new ItemListMenu();
listItemDialog.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
listItemDialog.setBounds(50,50,650,500);
listItemDialog.setResizable(true);
listItemDialog.setVisible(true);
listItemDialog.addWindowListener( new WindowAdapter() {
public void windowClosed(WindowEvent e) {
try {
listItemDialog.RS.close();
listItemDialog.ST.close();
} catch(SQLException se) { se.printStackTrace();}
listItemDialog = null;
}
});
}
}
};

//类别对话框
ActionListener addCategoryActionListener = new ActionListener(){
public void actionPerformed(ActionEvent event){

//Category Dialogs
ActionListener addCategoryActionListener = new ActionListener() {
public void actionPerformed(ActionEvent event) {

if(addCategoryDialog == null){
addCategoryDialog = new AddCategoryDialog(Menu.this);

if (addCategoryDialog == null ) {
addCategoryDialog = new AddCategoryDialog(Menu.this);

addCategoryDialog.addWindowListener(new WindowAdapter(){
public void windowClosed(WindowEvent e){
addCategoryDialog = null;
}
});
}
}
};

addCategoryDialog.addWindowListener( new WindowAdapter() {
public void windowClosed(WindowEvent e) {
addCategoryDialog = null;
}
});
}
}
};

ActionListener findCategoryActionListener = new ActionListener(){
public void actionPerformed(ActionEvent event){

ActionListener findCategoryActionListener = new ActionListener() {
public void actionPerformed(ActionEvent event) {

if(findCategoryDialog == null){
findCategoryDialog = new FindCategoryDialog();
findCategoryDialog.setResizable(false);
findCategoryDialog.setVisible(true);
findCategoryDialog.addWindowListener(new WindowAdapter (){
public void windowClosed(WindowEvent e){
findCategoryDialog = null;
}
});
}
}
};

if (findCategoryDialog == null ) {
findCategoryDialog = new FindCategoryDialog();
findCategoryDialog.setResizable(false);
findCategoryDialog.setVisible(true);
findCategoryDialog.addWindowListener( new WindowAdapter() {
public void windowClosed(WindowEvent e) {
findCategoryDialog = null;
}
});
}
}
};

ActionListener listCategoryActionListener = new ActionListener(){
public void actionPerformed(ActionEvent event){

ActionListener listCategoryActionListener = new ActionListener() {
public void actionPerformed(ActionEvent event) {

if(listCategoryDialog == null){
listCategoryDialog = new CategoryListMenu();
listCategoryDialog.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
listCategoryDialog.setBounds(50,50,650,500);
listCategoryDialog. setResizable(true);
listCategoryDialog.setVisible(true);
listCategoryDialog.addWindowListener(new WindowAdapter(){ void windowClosed(WindowEvent e){
try { CategoryDialog.RS. close();
listCategoryDialog.ST.close();
} catch(SQLException se){se.printStackTrace();}
listCategoryDialog = null;
}
});
}
}
};

if (listCategoryDialog == null ) {
listCategoryDialog = new CategoryListMenu();
listCategoryDialog.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
listCategoryDialog.setBounds(50,50,650,500);
listCategoryDialog.setResizable(true);
listCategoryDialog.setVisible(true);
listCategoryDialog.addWindowListener( new WindowAdapter() {
public void windowClosed(WindowEvent e) {
try {
listCategoryDialog.RS.close();
listCategoryDialog.ST.close();
} catch(SQLException se) { se.printStackTrace(); }
listCategoryDialog = null;
}
});
}
}
};

//常规
ActionListener userSettingAction =新的ActionListener(){ void actionPerformed(ActionEvent事件){(userdg == null){ userdg.setResizable(false);
userdg.addWindowListener(new WindowAdapter(){
public void windowClosed(WindowEvent e){
userdg = null;
}
});
}
}
};

// General
ActionListener userSettingAction = new ActionListener() {
public void actionPerformed(ActionEvent event) {
if (userdg == null ) {
userdg = new ModifyUserSettingDialog(Menu.this, "User Settings");
userdg.setResizable(false);
userdg.addWindowListener( new WindowAdapter() {
public void windowClosed(WindowEvent e) {
userdg = null;
}
});
}
}
};

ActionListener policySettingAction =新ActionListener(){ void actionPerformed(ActionEvent事件){(policydg == null){
policydg = new ModifyPolicySettingDialog(Menu.this,"Policy Settings") ;
policydg.setResizable(false);
policydg.addWindowListener(new WindowAdapter(){
public void windowClosed(WindowEvent e){
policydg = null;
}
}) ;
}
}
};

ActionListener policySettingAction = new ActionListener() {
public void actionPerformed(ActionEvent event) {
if (policydg == null ) {
policydg = new ModifyPolicySettingDialog(Menu.this, "Policy Settings");
policydg.setResizable(false);
policydg.addWindowListener( new WindowAdapter() {
public void windowClosed(WindowEvent e) {
policydg = null;
}
});
}
}
};

ActionListener calendarSettingAction =新ActionListener(){(calendardg == null){ calendardg = new CalendarDialog();
calendardg.setResizable( false);
calendardg.addWindowListener(new WindowAdapter(){
public void windowClosed(WindowEvent e){
calendardg = null;
}
});
}
}
};

ActionListener calendarSettingAction = new ActionListener() {
public void actionPerformed(ActionEvent event) {
if (calendardg == null ) {
calendardg = new CalendarDialog();
calendardg.setResizable(false);
calendardg.addWindowListener( new WindowAdapter() {
public void windowClosed(WindowEvent e) {
calendardg = null;
}
});
}
}
};

ActionListener lookFeelAction =新的ActionListener()
{
public void actionPerformed(ActionEvent e)
{
String str = e.getActionCommand();

ActionListener lookFeelAction = new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
String str = e.getActionCommand();

if(str.compareTo("Windows")== 0)CURRENT_UI_SYTLE = UI_STYLE_WINDOWS;
否则,if(str.compareTo("CDE/Motif")== 0)CURRENT_UI_SYTLE = UI_STYLE_MOTIF;
否则(str.compareTo("Malachite")== 0)CURRENT_UI_SYTLE = UI_STYLE_MALACHITELF;
else CURRENT_UI_SYTLE = UI_STYLE_METAL;
对象obj = m_lfs.get(str);
if(obj!= null)
try
{
String className =(String)obj;
Class lnfClass = Class.forName(className);
UIManager.setLookAndFeel(
(LookAndFeel)(lnfClass.newInstance()) );
SwingUtilities.updateComponentTreeUI(
Menu.this);
}
catch(异常例外)
{
ex.printStackTrace();
System.err.println (ex.toString());
}
}
};

if ( str.compareTo("Windows") == 0 ) CURRENT_UI_SYTLE = UI_STYLE_WINDOWS;
else if ( str.compareTo("CDE/Motif") == 0 ) CURRENT_UI_SYTLE = UI_STYLE_MOTIF;
else if ( str.compareTo("Malachite") == 0 ) CURRENT_UI_SYTLE = UI_STYLE_MALACHITELF;
else CURRENT_UI_SYTLE = UI_STYLE_METAL;
Object obj = m_lfs.get(str);
if (obj != null)
try
{
String className = (String)obj;
Class lnfClass = Class.forName(className);
UIManager.setLookAndFeel(
(LookAndFeel)(lnfClass.newInstance()));
SwingUtilities.updateComponentTreeUI(
Menu.this);
}
catch (Exception ex)
{
ex.printStackTrace();
System.err.println(ex.toString());
}
}
};

ActionListener helpAction =新的ActionListener(){(helpdg == null){
尝试{帮助集set =新的HelpSet(null,helpsetURL);
JHelp帮助=新的JHelp(set);
helpdg =新的JFrame(" NBS库应用程序帮助);
Toolkit theKit = Menu.this.getToolkit();
图片图标= theKit.getImage("images/default.gif");
helpdg.setIconImage(icon);
helpdg.setDefaultCloseOperation( JFrame.DISPOSE_ON_CLOSE);
helpdg.setContentPane(help);
helpdg.setBounds(50,50,850,450);
helpdg.setResizable(false);
helpdg.setVisible(true);
helpdg.addWindowListener(new WindowAdapter(){
public void windowClosed(WindowEvent e){}
});
} catch(Exception e){e.printStackTrace ();}
}
}
};

ActionListener helpAction = new ActionListener() {
public void actionPerformed(ActionEvent event) {
if (helpdg == null ) {
try {
URL helpsetURL = new URL("file:./help.hs");
HelpSet set = new HelpSet(null, helpsetURL);
JHelp help = new JHelp(set);
helpdg = new JFrame("NBS Library Application Help");
Toolkit theKit = Menu.this.getToolkit();
Image icon = theKit.getImage("images/default.gif");
helpdg.setIconImage(icon);
helpdg.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
helpdg.setContentPane(help);
helpdg.setBounds(50,50,850,450 );
helpdg.setResizable(false);
helpdg.setVisible(true);
helpdg.addWindowListener( new WindowAdapter() {
public void windowClosed(WindowEvent e) {
helpdg = null;
}
});
} catch(Exception e) {e.printStackTrace();}
}
}
};

//事务性菜单
/* JMenu transMenu = new JMenu("Transaction");
JMenuItem item1_1 = new JMenuItem("Borrow");
item1_1.addActionListener(borrowAction);
transMenu.add(item1_1);
JMenuItem item1_2 =新的JMenuItem("Return");
item1_2.addActionListener(returnAction);
transMenu.add(item1_2);
transMenu.addSeparator();
JMenuItem item1_3 =新的JMenuItem(存档管理器");
item1_3.addActionListener(ArchiveListener);
transMenu.add(item1_3);
menuBar.add(transMenu); */

// Transactional Menu
/* JMenu transMenu = new JMenu("Transaction");
JMenuItem item1_1 = new JMenuItem("Borrow");
item1_1.addActionListener(borrowAction);
transMenu.add(item1_1);
JMenuItem item1_2 = new JMenuItem("Return");
item1_2.addActionListener(returnAction);
transMenu.add(item1_2);
transMenu.addSeparator();
JMenuItem item1_3 = new JMenuItem("Archive Manager");
item1_3.addActionListener(ArchiveListener);
transMenu.add(item1_3);
menuBar.add(transMenu);*/

//报告菜单
JMenu reportMenu =新的JMenu(报告");
JMenu item2_1 =新的JMenu("DVD相关");
/* JMenuItem item2_1_1 =新的JMenuItem(过期);
item2_1_1.addActionListener(OverdueActionListener);
item2_1.add(item2_1_1);
JMenuItem item2_1_2 = new JMenuItem(" Borrowed Out);
item2_1_2.addActionListener(ItemoutActionListener);
item2_1.add(item2_1_2); */
JMenuItem item2_1_3 =新的JMenuItem(未完成预留");
item2_1_3.addActionListener(ReserveActionListener);
item2_1.add(item2_1_3);
JMenuItem item2_1_4 = new JMenuItem("Top 10");
item2_1_4.addActionListener(Top10ActionListener);
item2_1.add(item2_1_4);
reportMenu.add(item2_1);
JMenu item2_2 = new JMenu(与消费者有关");
/*item2_2.addActionListener(actionListener);
JMenuItem item2_2_1 =新的JMenuItem("Suspended");
item2_2_1.addActionListener(BorrowerSuspendedActionListener);
item2_2.add(item2_2_1) );
JMenuItem item2_2_2 = new JMenuItem("Holding items");
item2_2_2.a ddActionListener(BorrowerHoldingActionListener);
item2_2.add(item2_2_2);
JMenuItem item2_2_3 = new JMenuItem("Fines Summary");
item2_2_3.addActionListener(FinesSummaryActionListener);
item2_2.add(item2_2_3) */
reportMenu.add(item2_2);
menuBar.add(reportMenu);

// Reports Menu
JMenu reportMenu = new JMenu("Reports");
JMenu item2_1 = new JMenu("DVD-Related");
/*JMenuItem item2_1_1 = new JMenuItem("Overdue");
item2_1_1.addActionListener(OverdueActionListener);
item2_1.add(item2_1_1);
JMenuItem item2_1_2 = new JMenuItem("Borrowed Out");
item2_1_2.addActionListener(ItemoutActionListener);
item2_1.add(item2_1_2);*/
JMenuItem item2_1_3 = new JMenuItem("Reserve Outstanding");
item2_1_3.addActionListener(ReserveActionListener);
item2_1.add(item2_1_3);
JMenuItem item2_1_4 = new JMenuItem("Top 10");
item2_1_4.addActionListener(Top10ActionListener);
item2_1.add(item2_1_4);
reportMenu.add(item2_1);
JMenu item2_2 = new JMenu("Consumer-Related");
/*item2_2.addActionListener(actionListener);
JMenuItem item2_2_1 = new JMenuItem("Suspended");
item2_2_1.addActionListener(BorrowerSuspendedActionListener);
item2_2.add(item2_2_1);
JMenuItem item2_2_2 = new JMenuItem("Holding items");
item2_2_2.addActionListener(BorrowerHoldingActionListener);
item2_2.add(item2_2_2);
JMenuItem item2_2_3 = new JMenuItem("Fines Summary");
item2_2_3.addActionListener(FinesSummaryActionListener);
item2_2.add(item2_2_3);*/
reportMenu.add(item2_2);
menuBar.add(reportMenu);

//管理菜单
JMenu AdministrationMenu =新的JMenu("Administration");
JMenu item3_1 =新的JMenu("DVD");
JMenuItem item3_1_1 =新的JMenuItem(添加DVD") ;
item3_1_1.addActionListener(addItemActionListener);
item3_1.add(item3_1_1);
JMenuItem item3_1_2 =新的JMenuItem(查找DVD");
item3_1_2.addActionListener(findItemActionListener);
item3_1.add(item3_1_2);
item3_1.addSeparator();
JMenuItem item3_1_3 = new JMenuItem(列出所有DVD");
item3_1_3.addActionListener(listItemActionListener);
item3_1.add(item3_1_3) );
administrationMenu.add(item3_1);
JMenu item3_2 =新的JMenu(消费者");
JMenuItem item3_2_1 =新的JMenuItem(添加消费者");
item3_2_1.addActionListener(addBorrowerActionListener );
item3_2.add(item3_2_1);
JMenuItem item3_2_2 = new JMenuItem(寻找消费者");
item3_2_2.addActionListener(findBorrowerActionListener);
item3_2.add(item3_2_2);
item3_2.addSeparator();
JMenuItem item3_2_3 = new JMenuItem("List所有消费者");
item3_2_3.addActionListener(listBorrowerActionListener);
item3_2.add(item3_2_3);
item3_2.addSeparator();
JMenuItem item3_2_4 = new JMenuItem("Consumer Category");
item3_2_4.addActionListener(listBorrowerTypeActionListener);
item3_2.add(item3_2_4);
administrationMenu.add(item3_2);
JMenu item3_3 = new JMenu("DVD Category");
JMenuItem item3_3_1 = new JMenuItem(添加DVD类别");
item3_3_1.addActionListener(addCategoryActionListener);
item3_3.add(item3_3_1);
JMenuItem item3_3_2 = new JMenuItem(查找DVD类别");
item3_3_2.addActionListener(findCategoryActionListener);
item3_3.add(item3_3_2);
item3_3.addSeparator();
JMenuItem item3_3_3 = new JMenuItem(列出所有DVD类别");
item3_3_3.3.addActionListener (listCategoryActionListener);
item3_3.add(item3_3_3);
administrationMenu.add(item3_3);
menuBar.add(administrationMenu);

//Administration Menu
JMenu administrationMenu = new JMenu("Administration");
JMenu item3_1 = new JMenu("DVD");
JMenuItem item3_1_1 = new JMenuItem("Add a DVD");
item3_1_1.addActionListener(addItemActionListener);
item3_1.add(item3_1_1);
JMenuItem item3_1_2 = new JMenuItem("Find a DVD");
item3_1_2.addActionListener(findItemActionListener);
item3_1.add(item3_1_2);
item3_1.addSeparator();
JMenuItem item3_1_3 = new JMenuItem("List all DVDs");
item3_1_3.addActionListener(listItemActionListener);
item3_1.add(item3_1_3);
administrationMenu.add(item3_1);
JMenu item3_2 = new JMenu("Consumer");
JMenuItem item3_2_1 = new JMenuItem("Add a Consumer");
item3_2_1.addActionListener(addBorrowerActionListener);
item3_2.add(item3_2_1);
JMenuItem item3_2_2 = new JMenuItem("Find a Consumer");
item3_2_2.addActionListener(findBorrowerActionListener);
item3_2.add(item3_2_2);
item3_2.addSeparator();
JMenuItem item3_2_3 = new JMenuItem("List all Comsumers");
item3_2_3.addActionListener(listBorrowerActionListener);
item3_2.add(item3_2_3);
item3_2.addSeparator();
JMenuItem item3_2_4 = new JMenuItem("Consumer Category");
item3_2_4.addActionListener(listBorrowerTypeActionListener);
item3_2.add(item3_2_4);
administrationMenu.add(item3_2);
JMenu item3_3 = new JMenu("DVD Category");
JMenuItem item3_3_1 = new JMenuItem("Add a DVD Category");
item3_3_1.addActionListener(addCategoryActionListener);
item3_3.add(item3_3_1);
JMenuItem item3_3_2 = new JMenuItem("Find a DVD Category");
item3_3_2.addActionListener(findCategoryActionListener);
item3_3.add(item3_3_2);
item3_3.addSeparator();
JMenuItem item3_3_3 = new JMenuItem("List all DVD Categories");
item3_3_3.addActionListener(listCategoryActionListener);
item3_3.add(item3_3_3);
administrationMenu.add(item3_3);
menuBar.add(administrationMenu);

//常规菜单
JMenu generalMenu =新的JMenu(常规");
JMenuItem item4_1 =新的JMenuItem(策略设置");
item4_1.addActionListener(policySettingAction);
generalMenu .add(item4_1);
JMenuItem item4_2 =新的JMenuItem(用户设置");
item4_2.addActionListener(userSettingAction);
generalMenu.add(item4_2);
JMenuItem item4_3 =新的JMenuItem( 日历设置");
item4_3.addActionListener(calendarSettingAction);
generalMenu.add(item4_3);

//General Menu
JMenu generalMenu = new JMenu("General");
JMenuItem item4_1 = new JMenuItem("Policy Settings");
item4_1.addActionListener(policySettingAction);
generalMenu.add(item4_1);
JMenuItem item4_2 = new JMenuItem("User Settings");
item4_2.addActionListener(userSettingAction);
generalMenu.add(item4_2);
JMenuItem item4_3 = new JMenuItem("Calendar Settings");
item4_3.addActionListener(calendarSettingAction);
generalMenu.add(item4_3);

JMenu item4_4 =新的JMenu("Look& Feel");
m_lfs =新的Hashtable();
UIManager.LookAndFeelInfo lfs [] = UIManager.getInstalledLookAndFeels();
ButtonGroup组= new ButtonGroup();
for(int k = 0; k< lfs.length; k ++)
{
字符串名称= lfs [k] .getName();
JRadioButtonMenuItem radioMenu = new JRadioButtonMenuItem(name);
m_lfs.put(name,lfs [k] .getClassName());
radioMenu.addActionListener(lookFeelAction);
如果(k == CURRENT_UI_SYTLE)radioMenu.setSelected(true );
group.add(radioMenu);
item4_4.add(radioMenu);
}

JMenu item4_4 = new JMenu("Look&Feel");
m_lfs = new Hashtable();
UIManager.LookAndFeelInfo lfs[] =
UIManager.getInstalledLookAndFeels();
ButtonGroup group = new ButtonGroup();
for (int k = 0; k < lfs.length; k++ )
{
String name = lfs[k].getName();
JRadioButtonMenuItem radioMenu = new JRadioButtonMenuItem(name);
m_lfs.put(name, lfs[k].getClassName());
radioMenu.addActionListener(lookFeelAction);
if (k == CURRENT_UI_SYTLE ) radioMenu.setSelected(true);
group.add(radioMenu);
item4_4.add(radioMenu);
}

generalMenu.add(item4_4);
generalMenu.addSeparator();
JMenuItem item4_5 = new JMenuItem("About");
item4_5.addActionListener(aboutActionListener);
generalMenu.add( item4_5);
JMenuItem item4_6 =新的JMenuItem("Help");
item4_6.addActionListener(helpAction);
generalMenu.add(item4_6);
generalMenu.addSeparator();
JMenuItem item4_7 =新的JMenuItem(注销");
item4_7.addActionListener(LogoffActionListener);
generalMenu.add(item4_7);
menuBar.add(generalMenu);
generalMenu.addSeparator();
JMenuItem item4_8 =新的JMenuItem("Quit");
item4_8.addActionListener(quitActionListener);
generalMenu.add(item4_8);
menuBar.add(generalMenu);

generalMenu.add(item4_4);
generalMenu.addSeparator();
JMenuItem item4_5 = new JMenuItem("About");
item4_5.addActionListener(aboutActionListener);
generalMenu.add(item4_5);
JMenuItem item4_6 = new JMenuItem("Help");
item4_6.addActionListener(helpAction);
generalMenu.add(item4_6);
generalMenu.addSeparator();
JMenuItem item4_7 = new JMenuItem("Log Off");
item4_7.addActionListener(LogoffActionListener);
generalMenu.add(item4_7);
menuBar.add(generalMenu);
generalMenu.addSeparator();
JMenuItem item4_8 = new JMenuItem("Quit");
item4_8.addActionListener(quitActionListener);
generalMenu.add(item4_8);
menuBar.add(generalMenu);

//状态栏
statusBar =新的StatusBar();
statusBar.setPaneText(用户名);
getContentPane().add(statusBar,BorderLayout.SOUTH);

//Status bar
statusBar = new StatusBar();
statusBar.setPaneText(username);
getContentPane().add(statusBar, BorderLayout.SOUTH);

//Toolbar
getContentPane().add(new ToolBar(),BorderLayout.NORTH);

//Toolbar
getContentPane().add(new ToolBar(), BorderLayout.NORTH);

//背景图像
(((JPanel)getContentPane()).setOpaque(false);
ImageIcon earth = new ImageIcon(queryMgr.BKGRD_IMAGES);
JLabel backlabel = new JLabel(earth);
getLayeredPane().add(backlabel,new Integer(Integer.MIN_VALUE));
backlabel.setBounds(0,0,earth.getIconWidth(),
earth.getIconHeight());

//Background Image
((JPanel)getContentPane()).setOpaque(false);
ImageIcon earth = new ImageIcon(queryMgr.BKGRD_IMAGES);
JLabel backlabel = new JLabel(earth);
getLayeredPane().add(backlabel, new Integer(Integer.MIN_VALUE));
backlabel.setBounds(0,0,earth.getIconWidth(),
earth.getIconHeight());

//扫描器
sidebutton.setPreferredSize(new Dimension(0,1));
this.getContentPane().add(sidebutton,BorderLayout.WEST);
attachKeyListener(this);
scannerdg = new ReturnReader(this);
}

// Scanner
sidebutton.setPreferredSize( new Dimension(0,1) );
this.getContentPane().add(sidebutton, BorderLayout.WEST);
attachKeyListener(this);
scannerdg = new ReturnReader(this);
}

公共类ReturnReader扩展了JDialog {

public class ReturnReader extends JDialog {

私有JTextField txItemNo;
私有JTextArea m_title;

private JTextField txItemNo;
private JTextArea m_title;

public ReturnReader(JFrame父级)
{
super(父级,扫描项对话框",true);
工具包theKit = this.getToolkit();尺寸wndSize = theKit. getScreenSize();
this.setBounds(wndSize.width/3,10,280,180);

public ReturnReader( JFrame parent )
{
super( parent, "Scanned-Item Dialog", true );
Toolkit theKit = this.getToolkit();
Dimension wndSize = theKit.getScreenSize();
this.setBounds(wndSize.width/3, 10, 280, 180);

addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){}
});

addWindowListener( new WindowAdapter() {
public void windowClosing(WindowEvent e) {
dispose();
}
});

setDefaultCloseOperation(DISPOSE_ON_CLOSE);

setDefaultCloseOperation(DISPOSE_ON_CLOSE);

//创建一个面板来容纳我所有的组件
JPanel panel = new JPanel(new BorderLayout());
panel.setLayout(new GridBagLayout());
//给面板一个5个像素的边框间隙
panel.setBorder(new CompoundBorder(
new EtchedBorder(EtchedBorder.RAISED),
newEmptyBorder(5,5,5,5)));
getContentPane(). add(BorderLayout.NORTH,panel);

// Creates a panel to hold all my components
JPanel panel = new JPanel( new BorderLayout() );
panel.setLayout( new GridBagLayout() );
// give the panel a border gap of 5 pixels
panel.setBorder(new CompoundBorder(
new EtchedBorder(EtchedBorder.RAISED),
new EmptyBorder(5,5,5,5)));
getContentPane().add( BorderLayout.NORTH, panel );

GridBagConstraints c =新的GridBagConstraints();

GridBagConstraints c = new GridBagConstraints();

//为我的输入字段定义首选大小
Dimension shortField = new Dimension(60,20);
Dimension mediumField = new Dimension(120,20);
Dimension longField = new Dimension(180 ,20);

// Define preferred sizes for my entry fields
Dimension shortField = new Dimension( 60, 20 );
Dimension mediumField = new Dimension( 120, 20 );
Dimension longField = new Dimension( 180, 20 );

//标签与字段之间的间距
EmptyBorder border = newEmptyBorder(new Insets(0,0,0,10));

// Spacing between the label and the field
EmptyBorder border = new EmptyBorder( new Insets( 0, 0, 0, 10 ) );

//字体
字体fn =新字体("Arial",Font.PLAIN,10);

// Fonts
Font fn = new Font("Arial", Font.PLAIN, 10);

///在我所有的组件周围添加一些空间以避免混乱
c.insets = new Insets(2,2,2,2);

// add some space around all my components to avoid cluttering
c.insets = new Insets( 2, 2, 2, 2 );

//将我所有的组件锚定在西方
c.anchor = GridBagConstraints.WEST;

// anchors all my components to the west
c.anchor = GridBagConstraints.WEST;

//日期标签和组合框
JLabel lbl0 = new JLabel(请确认您要退货的项目.");
lbl0.setFont(fn);
lbl0.setForeground(new Color(150,10,10));
c.gridwidth = 2;
c.gridx = 0;
c.gridy = 0;
panel.add(lbl0,c);

// Date label and combo box
JLabel lbl0 = new JLabel("Please Confirm the Item You want to Return.");
lbl0.setFont(fn);
lbl0.setForeground(new Color(150,10,10));
c.gridwidth = 2;
c.gridx = 0;
c.gridy = 0;
panel.add( lbl0, c );

JLabel lbl1 =新的JLabel(产品编号");
lbl1.setBorder(border);
c.gridx = 0;
c.gridy ++;
c.gridwidth = 1;
c.fill = GridBagConstraints.NONE;
panel.add(lbl1,c);

JLabel lbl1 = new JLabel( "Item No" );
lbl1.setBorder( border );
c.gridx = 0;
c.gridy++;
c.gridwidth = 1;
c.fill = GridBagConstraints.NONE;
panel.add( lbl1, c );

txItemNo =新的JTextField();
txItemNo.setPreferredSize(shortField);
c.gridx ++;
txItemNo.setEnabled(false);
//txItemNo.requestFocus();
panel.add(txItemNo,c);

txItemNo = new JTextField();
txItemNo.setPreferredSize( shortField );
c.gridx++;
txItemNo.setEnabled(false);
//txItemNo.requestFocus();
panel.add( txItemNo, c );

m_title =新的JTextArea(",4,26);
m_title.setFont(fn);
m_title.setLineWrap(true);
m_title.setWrapStyleWord(true);
m_title .setForeground(Color.white);
m_title.setBackground(Color.black);
m_title.setEditable(false);
c.gridx = 0;
c.gridy ++;
c .gridwidth = 2;
c.fill = GridBagConstraints.REMAINDER;
panel.add(new JScrollPane(m_title),c);

m_title = new JTextArea("", 4, 26);
m_title.setFont(fn);
m_title.setLineWrap(true);
m_title.setWrapStyleWord(true);
m_title.setForeground(Color.white);
m_title.setBackground(Color.black);
m_title.setEditable(false);
c.gridx = 0;
c.gridy++;
c.gridwidth = 2;
c.fill = GridBagConstraints.REMAINDER;
panel.add(new JScrollPane(m_title), c);

JPanel btnpanel =新的JPanel();
btnpanel.setBorder(新的EmptyBorder(3,5,3,5));
btnpanel.setLayout(新的FlowLayout(FlowLayout.CENTER,0,0))) ;

JPanel btnpanel = new JPanel();
btnpanel.setBorder( new EmptyBorder(3,5,3,5) );
btnpanel.setLayout( new FlowLayout( FlowLayout.CENTER, 0, 0 ) );


ActionListener操作=新的ActionListener(){
public void actionPerformed(ActionEvent evt){
getTransaction();
}
};


ActionListener action = new ActionListener() {
public void actionPerformed(ActionEvent evt) {
getTransaction();
}
};

JButton confirmBtn = new JButton( "Confirm" );
confirmBtn.setPreferredSize(new Dimension(80,20));
confirmBtn.addActionListener(action);
getRootPane().setDefaultButton(confirmBtn);
getRootPane().registerKeyboardAction(action,
KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0),
JComponent.WHEN_IN_FOCUSED_WINDOW);
btnpanel.add(confirmBtn);
action = new ActionListener() {
public void actionPerformed(ActionEvent evt) {
dispose();
}
};

JButton confirmBtn = new JButton( "Confirm" );
confirmBtn.setPreferredSize(new Dimension(80,20));
confirmBtn.addActionListener(action);
getRootPane().setDefaultButton(confirmBtn);
getRootPane().registerKeyboardAction(action,
KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0),
JComponent.WHEN_IN_FOCUSED_WINDOW);
btnpanel.add(confirmBtn);
action = new ActionListener() {
public void actionPerformed(ActionEvent evt) {
dispose();
}
};

JButton cancelBtn = new JButton( "Cancel" );
cancelBtn.addActionListener(action);
cancelBtn.setPreferredSize(new Dimension(80,20));
c.gridx ++;
btnpanel.add(cancelBtn);
getContentPane().add( BorderLayout.SOUTH, btnpanel );
setVisible(false);
}

JButton cancelBtn = new JButton( "Cancel" );
cancelBtn.addActionListener(action);
cancelBtn.setPreferredSize(new Dimension(80,20));
c.gridx ++;
btnpanel.add(cancelBtn);
getContentPane().add( BorderLayout.SOUTH, btnpanel );
setVisible(false);
}

/**
* Function to find Item Number scanned in
*/
private void findItem(String x) {
if (x.length() > 0) {

/**
* Function to find Item Number scanned in
*/
private void findItem(String x) {
if (x.length() > 0) {

String sqlstr = "SELECT Title from Item WHERE ItemNo = ''" + x + "''";
try {
Statement st = queryMgr.createStatement();
ResultSet result_Set = queryMgr.getResultQuery(sqlstr, st);
boolean ResultSetOk = queryMgr.CheckNull(result_Set);
if ( ResultSetOk ) {
m_title.setText( result_Set.getString("Title") );
result_Set.close();
result_Set = null;
scannerdg.setVisible(true);
}
result_Set.close();
result_Set = null;
st.close();
st = null;

String sqlstr = "SELECT Title from Item WHERE ItemNo = ''" + x + "''";
try {
Statement st = queryMgr.createStatement();
ResultSet result_Set = queryMgr.getResultQuery(sqlstr, st);
boolean ResultSetOk = queryMgr.CheckNull(result_Set);
if ( ResultSetOk ) {
m_title.setText( result_Set.getString("Title") );
result_Set.close();
result_Set = null;
scannerdg.setVisible(true);
}
result_Set.close();
result_Set = null;
st.close();
st = null;

}
catch (SQLException sqle) { sqle.printStackTrace();}

}
catch (SQLException sqle) { sqle.printStackTrace();}

}
}

/**
* Function to find transaction
*/
private void getTransaction() {
String x = txItemNo.getText().trim();
if (x.length() != 0) {
String sqlstr = "SELECT MAX( TransactionNo ) As TxNo FROM BorrowTransaction" +
" WHERE ItemNo = ''" + x + "''";

/**
* Function to find transaction
*/
private void getTransaction() {
String x = txItemNo.getText().trim();
if (x.length() != 0) {
String sqlstr = "SELECT MAX( TransactionNo ) As TxNo FROM BorrowTransaction" +
" WHERE ItemNo = ''" + x + "''";

try {
Statement st = queryMgr.createStatement();
ResultSet result_Set = queryMgr.getResultQuery(sqlstr, st);
boolean ResultSetOk = queryMgr.CheckNull(result_Set);
boolean NotFound = false;
if ( ResultSetOk ) {
int tranno = result_Set.getInt("TxNo");
result_Set.close();
result_Set = null;
if (tranno != 0)
updateTransaction(tranno, x);
else
NotFound = true;
}

try {
Statement st = queryMgr.createStatement();
ResultSet result_Set = queryMgr.getResultQuery(sqlstr, st);
boolean ResultSetOk = queryMgr.CheckNull(result_Set);
boolean NotFound = false;
if ( ResultSetOk ) {
int tranno = result_Set.getInt("TxNo");
result_Set.close();
result_Set = null;
if (tranno != 0)
updateTransaction(tranno, x);
else
NotFound = true;
}

if (NotFound) {
JOptionPane.showMessageDialog(ReturnReader.this,
"Cannot find any transaction for Item " + x,
"Return Operation",
JOptionPane.ERROR_MESSAGE);
scannerdg.setVisible(false);
}
result_Set.close();
result_Set = null;
st.close();
st = null;

if (NotFound) {
JOptionPane.showMessageDialog(ReturnReader.this,
"Cannot find any transaction for Item " + x,
"Return Operation",
JOptionPane.ERROR_MESSAGE);
scannerdg.setVisible(false);
}
result_Set.close();
result_Set = null;
st.close();
st = null;


}
catch (SQLException sqle) { sqle.printStackTrace();}
}
}


}
catch (SQLException sqle) { sqle.printStackTrace();}
}
}


/**
* Function to update transaction
*/
private void updateTransaction(int txno, String itemno) {
//boolean success = false;
String sqlstr = "SELECT Returned, Datedue, BorrowerNo FROM BorrowTransaction" +
" WHERE TransactionNo = " +txno;
try {
Statement st = queryMgr.createStatement();
ResultSet result_Set = queryMgr.getResultQuery(sqlstr, st);
String returned = result_Set.getString("Returned");
if (returned.compareTo("Y") == 0)
JOptionPane.showMessageDialog(ReturnReader.this,
"Item " + itemno + " already RETURNED.",
"Return Operation",
JOptionPane.ERROR_MESSAGE);
else {
//To calculate whether any overdue
String borrowerno = result_Set.getString("BorrowerNo");
java.util.Date datedue = result_Set.getDate("Datedue");
DateUtils du = new DateUtils(datedue);
long days = du.getNoofDays();


/**
* Function to update transaction
*/
private void updateTransaction(int txno, String itemno) {
//boolean success = false;
String sqlstr = "SELECT Returned, Datedue, BorrowerNo FROM BorrowTransaction" +
" WHERE TransactionNo = " +txno;
try {
Statement st = queryMgr.createStatement();
ResultSet result_Set = queryMgr.getResultQuery(sqlstr, st);
String returned = result_Set.getString("Returned");
if (returned.compareTo("Y") == 0)
JOptionPane.showMessageDialog(ReturnReader.this,
"Item " + itemno + " already RETURNED.",
"Return Operation",
JOptionPane.ERROR_MESSAGE);
else {
//To calculate whether any overdue
String borrowerno = result_Set.getString("BorrowerNo");
java.util.Date datedue = result_Set.getDate("Datedue");
DateUtils du = new DateUtils(datedue);
long days = du.getNoofDays();

Calendar today = Calendar.getInstance();

Calendar today = Calendar.getInstance();

sqlstr = "UPDATE BorrowTransaction SET " +
"Returned = ''Y'', DateReturned =''" + queryMgr.STD_DATE_FORMAT.format( today.getTime() ) + "''" +
" WHERE TransactionNo = " + txno;
queryMgr.dmlOperations("jndi-library", sqlstr);

sqlstr = "UPDATE BorrowTransaction SET " +
"Returned = ''Y'', DateReturned =''" + queryMgr.STD_DATE_FORMAT.format( today.getTime() ) + "''" +
" WHERE TransactionNo = " + txno;
queryMgr.dmlOperations("jndi-library", sqlstr);

int reserveid = checkReserve(itemno);
if (reserveid == 0) {
sqlstr = "UPDATE Item SET " +
"Status = ''IN'' WHERE ItemNo = ''" + itemno + "'' AND Status <> ''RESERVE''";
queryMgr.dmlOperations("jndi-library", sqlstr);
System.out.println("\n\tScanner Return: No Reservation records");
//success = true;
//JOptionPane.showMessageDialog(ReturnReader.this,
//itemno + " RETURNED Successfully.",
//"Return Operation",
//JOptionPane.INFORMATION_MESSAGE);
} else {
SendNotificationEmail(reserveid);
sqlstr = "UPDATE Item SET " +
"Status = ''RESERVE'' WHERE ItemNo = ''" + itemno + "''" +
" AND (Status <> ''RESERVE'' OR Status <> ''LOST'')";
queryMgr.dmlOperations("jndi-library", sqlstr);
System.out.println("\n\tScanner Return: Item " + itemno + " Status changed to RESERVED");
}

int reserveid = checkReserve(itemno);
if (reserveid == 0) {
sqlstr = "UPDATE Item SET " +
"Status = ''IN'' WHERE ItemNo = ''" + itemno + "'' AND Status <> ''RESERVE''";
queryMgr.dmlOperations("jndi-library", sqlstr);
System.out.println("\n\tScanner Return: No Reservation records");
//success = true;
//JOptionPane.showMessageDialog(ReturnReader.this,
// itemno + " RETURNED Successfully.",
// "Return Operation",
// JOptionPane.INFORMATION_MESSAGE);
} else {
SendNotificationEmail(reserveid);
sqlstr = "UPDATE Item SET " +
"Status = ''RESERVE'' WHERE ItemNo = ''" + itemno + "''" +
" AND (Status <> ''RESERVE'' OR Status <> ''LOST'')";
queryMgr.dmlOperations("jndi-library", sqlstr);
System.out.println("\n\tScanner Return: Item " + itemno + " Status changed to RESERVED");
}

//Update Renew
updateRenew(itemno, borrowerno);

// Update Renew
updateRenew(itemno, borrowerno);

if (days > 0) {
double fines = days * queryMgr.FINESAMOUNT;
sqlstr = "UPDATE Fines SET" +
" FinesAmount = " + fines +
" WHERE TransactionNo = " + txno;
queryMgr.dmlOperations("jndi-library", sqlstr);
LGWRITER.writeLog(LogWriter.MSG_TRANSACTION, username + " adds a RETURN TRANSACTION (" +
itemno + ", fines:$" + fines + ")" );
JOptionPane.showMessageDialog(ReturnReader.this,
"Transaction: Item (" + itemno + ") is returned with FINE. (" + days + " ) day(s) OVERDUE. Pls Check Borrower No :" + borrowerno,
"Scanner Return Operation",
JOptionPane.INFORMATION_MESSAGE);
} else {

if (days > 0) {
double fines = days * queryMgr.FINESAMOUNT;
sqlstr = "UPDATE Fines SET" +
" FinesAmount = " + fines +
" WHERE TransactionNo = " + txno;
queryMgr.dmlOperations("jndi-library", sqlstr);
LGWRITER.writeLog(LogWriter.MSG_TRANSACTION, username + " adds a RETURN TRANSACTION (" +
itemno + ", fines:$" + fines + ")" );
JOptionPane.showMessageDialog(ReturnReader.this,
"Transaction: Item (" + itemno + ") is returned with FINE. (" + days + " ) day(s) OVERDUE. Pls Check Borrower No :" + borrowerno,
"Scanner Return Operation",
JOptionPane.INFORMATION_MESSAGE);
} else {

//No fine
JOptionPane.showMessageDialog(ReturnReader.this,
itemno + " RETURNED Successfully.",
"Return Operation",
JOptionPane.INFORMATION_MESSAGE);

// No fine
JOptionPane.showMessageDialog(ReturnReader.this,
itemno + " RETURNED Successfully.",
"Return Operation",
JOptionPane.INFORMATION_MESSAGE);

}


}
scannerdg.setVisible(false);
result_Set.close();
result_Set = null;
st.close();
st = null;
}
catch (SQLException sqle) { sqle.printStackTrace();}
}


}
scannerdg.setVisible(false);
result_Set.close();
result_Set = null;
st.close();
st = null;
}
catch (SQLException sqle) { sqle.printStackTrace();}
}

/**
* Function to check whether item is in RESERVE table
*/
private int checkReserve(String itemno) {
String sql = "SELECT MIN(r.ReserveNo) as id FROM Reserve r, Item i WHERE " +
"r.ItemNo = ''" + itemno + "''" +
" AND r.ItemNo = i.ItemNo " +
" AND r.EmailNotify = ''N'' AND r.Completed = ''N''";
int found = 0;
try {
Statement st = queryMgr.createStatement();
ResultSet rs = queryMgr.getResultQuery(sql, st);
if (queryMgr.CheckNull(rs))
found = rs.getInt("id");
rs.close();
rs = null;
st.close();
st = null;
} catch(SQLException se) { se.printStackTrace();}

/**
* Function to check whether item is in RESERVE table
*/
private int checkReserve(String itemno) {
String sql = "SELECT MIN(r.ReserveNo) as id FROM Reserve r, Item i WHERE " +
"r.ItemNo = ''" + itemno + "''" +
" AND r.ItemNo = i.ItemNo " +
" AND r.EmailNotify = ''N'' AND r.Completed = ''N''";
int found = 0;
try {
Statement st = queryMgr.createStatement();
ResultSet rs = queryMgr.getResultQuery(sql, st);
if (queryMgr.CheckNull(rs))
found = rs.getInt("id");
rs.close();
rs = null;
st.close();
st = null;
} catch(SQLException se) { se.printStackTrace();}

return found;
}

return found;
}

/**
* Function to update any renewal record
*/
private void updateRenew(String itemno, String userno) {
String sql = "UPDATE Renew Set Status=''COMPLETED'' WHERE ItemNo = ''" + itemno +
"'' AND BorrowerNo = ''" + userno + "''";
System.out.println(sql);
queryMgr.dmlOperations("jndi-library", sql);
LGWRITER.writeLog(LogWriter.MSG_TRANSACTION, username + " updating Renew record of ''" +
itemno + "'' which belongs to ''" + userno + "''" );
}

/**
* Function to update any renewal record
*/
private void updateRenew(String itemno, String userno) {
String sql = "UPDATE Renew Set Status=''COMPLETED'' WHERE ItemNo = ''" + itemno +
"'' AND BorrowerNo = ''" + userno + "''";
System.out.println(sql);
queryMgr.dmlOperations("jndi-library", sql);
LGWRITER.writeLog(LogWriter.MSG_TRANSACTION, username + " updating Renew record of ''" +
itemno + "'' which belongs to ''" + userno + "''" );
}


/**
* Function to Send Email to Borrower who RESERVE the book
*/
private void SendNotificationEmail(int resid) {


/**
* Function to Send Email to Borrower who RESERVE the book
*/
private void SendNotificationEmail(int resid) {

DateUtils du = new DateUtils();
String sql = "SELECT b.Name, b.Email, i.ItemNo, i.Title, r.DateReserved FROM Reserve r, Borrower b, Item i" +
" WHERE r.BorrowerNo = b.BorrowerNo AND r.ItemNo = i.ItemNo AND r.ReserveNo = " + resid;
try {
Statement st = queryMgr.createStatement();
ResultSet rs = queryMgr.getResultQuery(sql, st);
if (queryMgr.CheckNull(rs)) {
String name = rs.getString("Name");
String itemno = rs.getString("ItemNo");
String title = rs.getString("Title");
String email = rs.getString("Email");
String datestr = (String) queryMgr.STD_DATE_FORMAT.format( rs.getDate("DateReserved") );
if (email.compareTo("") != 0) {
try {
MailManager Mailmgr = MailManager.GetInstance();
Conf conf = Mailmgr.getConf();
Mailmgr.setHTML(false);
Vector recp = new Vector();
recp.add(new String(email));
Mailmgr.postMail(recp, conf.getReserveSubject(),
"<div style=''font-family:verdana;font-size:9pt''>" +
"<p style=''margin-left:30.0pt''>Dear " + name + ",<p>" +
"<p style=''margin-left:30.0pt''>" + conf.getReserveMessage1() +
"<br>NO : " + itemno +
"<br>TITLE : " + title +
"</p><p style=''margin-left:30.0pt''>" + conf.getReserveMessage2() +
queryMgr.RESERVEVALIDDAYS +
" DAY(s) from the following that date you have reserved : <p><p style=''margin-left:30.0pt''>" + datestr +
"</p><p style=''margin-left:30.0pt''>" + conf.getFrom() +
"<br>" + conf.getDepartment() + "<p>" +
"</div>",
conf.getEmail() );
LGWRITER.writeLog(LogWriter.MSG_TRANSACTION," Reservation Notice EMail of " + itemno + " sent to " + email);
System.out.println("\n\tScanner Return: Reservation Notice EMail sent to " + email);
recp.removeAllElements();
} catch (javax.mail.MessagingException me) { System.out.println("\n\tReturn: Mail Sent Error");}
}

DateUtils du = new DateUtils();
String sql = "SELECT b.Name, b.Email, i.ItemNo, i.Title, r.DateReserved FROM Reserve r, Borrower b, Item i" +
" WHERE r.BorrowerNo = b.BorrowerNo AND r.ItemNo = i.ItemNo AND r.ReserveNo = " + resid;
try {
Statement st = queryMgr.createStatement();
ResultSet rs = queryMgr.getResultQuery(sql, st);
if (queryMgr.CheckNull(rs)) {
String name = rs.getString("Name");
String itemno = rs.getString("ItemNo");
String title = rs.getString("Title");
String email = rs.getString("Email");
String datestr = (String) queryMgr.STD_DATE_FORMAT.format( rs.getDate("DateReserved") );
if (email.compareTo("") != 0) {
try {
MailManager Mailmgr = MailManager.GetInstance();
Conf conf = Mailmgr.getConf();
Mailmgr.setHTML(false);
Vector recp = new Vector();
recp.add(new String(email));
Mailmgr.postMail(recp, conf.getReserveSubject(),
"<div style=''font-family:verdana;font-size:9pt''>" +
"<p style=''margin-left:30.0pt''>Dear " + name + ",<p>" +
"<p style=''margin-left:30.0pt''>" + conf.getReserveMessage1() +
"<br>NO : " + itemno +
"<br>TITLE : " + title +
"</p><p style=''margin-left:30.0pt''>" + conf.getReserveMessage2() +
queryMgr.RESERVEVALIDDAYS +
" DAY(s) from the following that date you have reserved : <p><p style=''margin-left:30.0pt''>" + datestr +
"</p><p style=''margin-left:30.0pt''>" + conf.getFrom() +
"<br>" + conf.getDepartment() + "<p>" +
"</div>",
conf.getEmail() );
LGWRITER.writeLog(LogWriter.MSG_TRANSACTION," Reservation Notice EMail of " + itemno + " sent to " + email);
System.out.println("\n\tScanner Return: Reservation Notice EMail sent to " + email);
recp.removeAllElements();
} catch (javax.mail.MessagingException me) { System.out.println("\n\tReturn: Mail Sent Error");}
}

String todaystr = du.getShortTodayDate();
sql = "UPDATE Reserve SET EmailNotify = ''Y'', DateNotified = ''" + todaystr + "''" +
" WHERE ReserveNo = " + resid;
queryMgr.dmlOperations("jndi-library", sql);
System.out.println("\n\tScanner Return: No Reserve record updated");
}
rs.close();
rs = null;
st.close();
st = null;
} catch(SQLException se) { se.printStackTrace();}
}

String todaystr = du.getShortTodayDate();
sql = "UPDATE Reserve SET EmailNotify = ''Y'', DateNotified = ''" + todaystr + "''" +
" WHERE ReserveNo = " + resid;
queryMgr.dmlOperations("jndi-library", sql);
System.out.println("\n\tScanner Return: No Reserve record updated");
}
rs.close();
rs = null;
st.close();
st = null;
} catch(SQLException se) { se.printStackTrace();}
}


}

private void attachKeyListener(final JFrame frame) {

private void attachKeyListener(final JFrame frame) {

KeyListener listener = new KeyAdapter() {
public void keyPressed(KeyEvent e) {
int code = e.getKeyCode();
buff_i++;
buff[buff_i] = (char)code;
switch(code) {
case 10 : String s = new String(buff);
buff_i = -1;
buff[0] = ''\0'';
System.out.println("\n\t<<Input value>> :" + s);
scannerdg.setVisible(false);
scannerdg.m_title.setText("");
scannerdg.txItemNo.setText(s.trim());
scannerdg.findItem(s.trim());
break;

KeyListener listener = new KeyAdapter() {
public void keyPressed(KeyEvent e) {
int code = e.getKeyCode();
buff_i++;
buff[buff_i] = (char)code;
switch(code) {
case 10 : String s = new String(buff);
buff_i = -1;
buff[0] = ''\0'';
System.out.println("\n\t<<Input value>> :" + s);
scannerdg.setVisible(false);
scannerdg.m_title.setText("");
scannerdg.txItemNo.setText(s.trim());
scannerdg.findItem(s.trim());
break;

case 13 : break;

case 13 : break;

case 16 : buff_i--;break;

case 16 : buff_i--;break;

default : break;
}//end switch

default : break;
} // end switch

}
};
sidebutton.addKeyListener(listener);
}

}
};
sidebutton.addKeyListener(listener);
}

/**
* Class to create tool bar
*/

/**
* Class to create tool bar
*/

public class ToolBar extends JPanel{

public class ToolBar extends JPanel{

private JToolBar toolBar = new JToolBar();

private JToolBar toolBar = new JToolBar();

public void setFloat(boolean condition) {
toolBar.setFloatable(condition);
}

public void setFloat(boolean condition) {
toolBar.setFloatable(condition);
}

public ToolBar() {
addButtons(toolBar);
setLayout(new BorderLayout());
setPreferredSize(new Dimension( 20, 30));
setBorder(BorderFactory.createLineBorder(Constants.DEFAULT_TOOLBAR_LINECOLOR ));
add(toolBar, BorderLayout.WEST);
toolBar.setFloatable(true);
}

public ToolBar() {
addButtons(toolBar);
setLayout(new BorderLayout());
setPreferredSize(new Dimension( 20, 30));
setBorder(BorderFactory.createLineBorder(Constants.DEFAULT_TOOLBAR_LINECOLOR ));
add(toolBar, BorderLayout.WEST);
toolBar.setFloatable(true);
}

protected void addButtons(JToolBar toolbar) {

protected void addButtons(JToolBar toolbar) {

JButton button = null;

JButton button = null;

/*button = new JButton(new ImageIcon("images/borrow.gif"));
button.setToolTipText("Borrow item");
button.addActionListener(borrowAction);
toolbar.add(button);

/*button = new JButton(new ImageIcon("images/borrow.gif"));
button.setToolTipText("Borrow item");
button.addActionListener(borrowAction);
toolbar.add(button);

button = new JButton(new ImageIcon("images/return.gif"));
button.setToolTipText("Return item");
button.addActionListener(returnAction);
toolbar.add(button);
toolbar.addSeparator();

button = new JButton(new ImageIcon("images/return.gif"));
button.setToolTipText("Return item");
button.addActionListener(returnAction);
toolbar.add(button);
toolbar.addSeparator();

button = new JButton(new ImageIcon("images/overdue.gif"));
button.setToolTipText("Overdue items");
button.addActionListener(OverdueActionListener);
toolbar.add(button);*/

button = new JButton(new ImageIcon("images/overdue.gif"));
button.setToolTipText("Overdue items");
button.addActionListener(OverdueActionListener);
toolbar.add(button);*/

button = new JButton(new ImageIcon("images/top10.gif"));
button.setToolTipText("Top 10 most popular DVDs");
button.addActionListener(Top10ActionListener);
toolbar.add(button);
toolbar.addSeparator();

button = new JButton(new ImageIcon("images/top10.gif"));
button.setToolTipText("Top 10 most popular DVDs");
button.addActionListener(Top10ActionListener);
toolbar.add(button);
toolbar.addSeparator();

button = new JButton(new ImageIcon("images/itemlist.gif"));
button.setToolTipText("List of all DVDs");
button.addActionListener(listItemActionListener);
toolbar.add(button);

button = new JButton(new ImageIcon("images/itemlist.gif"));
button.setToolTipText("List of all DVDs");
button.addActionListener(listItemActionListener);
toolbar.add(button);

button = new JButton(new ImageIcon("images/finditemlist.gif"));
button.setToolTipText("Find DVD");
button.addActionListener(findItemActionListener);
toolbar.add(button);

button = new JButton(new ImageIcon("images/finditemlist.gif"));
button.setToolTipText("Find DVD");
button.addActionListener(findItemActionListener);
toolbar.add(button);

button = new JButton(new ImageIcon("images/borrowerlist.gif"));
button.setToolTipText("List of all Consumers");
button.addActionListener(listBorrowerActionListener);
toolbar.add(button);

button = new JButton(new ImageIcon("images/borrowerlist.gif"));
button.setToolTipText("List of all Consumers");
button.addActionListener(listBorrowerActionListener);
toolbar.add(button);


button = new JButton(new ImageIcon("images/findborrowerlist.gif"));
button.setToolTipText("Find Consumer");
button.addActionListener(findBorrowerActionListener);
toolbar.add(button);
toolbar.addSeparator();


button = new JButton(new ImageIcon("images/findborrowerlist.gif"));
button.setToolTipText("Find Consumer");
button.addActionListener(findBorrowerActionListener);
toolbar.add(button);
toolbar.addSeparator();

button = new JButton(new ImageIcon("images/logoff.gif"));
button.setToolTipText("Log off");
button.addActionListener(LogoffActionListener);
toolbar.add(button);

button = new JButton(new ImageIcon("images/logoff.gif"));
button.setToolTipText("Log off");
button.addActionListener(LogoffActionListener);
toolbar.add(button);

button = new JButton(new ImageIcon("images/quit.gif"));
button.setToolTipText("Quit application");
button.addActionListener(quitActionListener);
toolbar.add(button);
}
}

button = new JButton(new ImageIcon("images/quit.gif"));
button.setToolTipText("Quit application");
button.addActionListener(quitActionListener);
toolbar.add(button);
}
}

}

when i complie this program its giving these two errors

when i complie this program its giving these two errors

1:package javax.help does not exist
import javax.help.

1:package javax.help does not exist
import javax.help.

2:.\Security\LoginDialog.java:2: class, interface, or enum expected
* ===================================================
^
C:\projects\dvdshop\Menu.java:46: cannot access Security.LoginDialog
bad class file: .\Security\LoginDialog.java
file does not contain class Security.LoginDialog
Please remove or make sure it appears in the correct subdirectory of the classpath.
protected LoginDialog logindg = null;

2:.\Security\LoginDialog.java:2: class, interface, or enum expected
* ===================================================
^
C:\projects\dvdshop\Menu.java:46: cannot access Security.LoginDialog
bad class file: .\Security\LoginDialog.java
file does not contain class Security.LoginDialog
Please remove or make sure it appears in the correct subdirectory of the classpath.
protected LoginDialog logindg = null;

Im using database MS ACCESS...do i need to write anything to connect it by odbc if yes please write the code and paste

Im using database MS ACCESS...do i need to write anything to connect it by odbc if yes please write the code and paste

thanx in advance

thanx in advance

推荐答案

" + fines + ")" );
JOptionPane.showMessageDialog(ReturnReader.this,
"Transaction: Item (" + itemno + ") is returned with FINE. (" + days + " ) day(s) OVERDUE. Pls Check Borrower No :" + borrowerno,
"Scanner Return Operation",
JOptionPane.INFORMATION_MESSAGE);
} else {
" + fines + ")" );
JOptionPane.showMessageDialog(ReturnReader.this,
"Transaction: Item (" + itemno + ") is returned with FINE. (" + days + " ) day(s) OVERDUE. Pls Check Borrower No :" + borrowerno,
"Scanner Return Operation",
JOptionPane.INFORMATION_MESSAGE);
} else {

//No fine
JOptionPane.showMessageDialog(ReturnReader.this,
itemno + " RETURNED Successfully.",
"Return Operation",
JOptionPane.INFORMATION_MESSAGE);

// No fine
JOptionPane.showMessageDialog(ReturnReader.this,
itemno + " RETURNED Successfully.",
"Return Operation",
JOptionPane.INFORMATION_MESSAGE);

}


}
scannerdg.setVisible(false);
result_Set.close();
result_Set = null;
st.close();
st = null;
}
catch (SQLException sqle) { sqle.printStackTrace();}
}


}
scannerdg.setVisible(false);
result_Set.close();
result_Set = null;
st.close();
st = null;
}
catch (SQLException sqle) { sqle.printStackTrace();}
}

/**
* Function to check whether item is in RESERVE table
*/
private int checkReserve(String itemno) {
String sql = "SELECT MIN(r.ReserveNo) as id FROM Reserve r, Item i WHERE " +
"r.ItemNo = ''" + itemno + "''" +
" AND r.ItemNo = i.ItemNo " +
" AND r.EmailNotify = ''N'' AND r.Completed = ''N''";
int found = 0;
try {
Statement st = queryMgr.createStatement();
ResultSet rs = queryMgr.getResultQuery(sql, st);
if (queryMgr.CheckNull(rs))
found = rs.getInt("id");
rs.close();
rs = null;
st.close();
st = null;
} catch(SQLException se) { se.printStackTrace();}

/**
* Function to check whether item is in RESERVE table
*/
private int checkReserve(String itemno) {
String sql = "SELECT MIN(r.ReserveNo) as id FROM Reserve r, Item i WHERE " +
"r.ItemNo = ''" + itemno + "''" +
" AND r.ItemNo = i.ItemNo " +
" AND r.EmailNotify = ''N'' AND r.Completed = ''N''";
int found = 0;
try {
Statement st = queryMgr.createStatement();
ResultSet rs = queryMgr.getResultQuery(sql, st);
if (queryMgr.CheckNull(rs))
found = rs.getInt("id");
rs.close();
rs = null;
st.close();
st = null;
} catch(SQLException se) { se.printStackTrace();}

return found;
}

return found;
}

/**
* Function to update any renewal record
*/
private void updateRenew(String itemno, String userno) {
String sql = "UPDATE Renew Set Status=''COMPLETED'' WHERE ItemNo = ''" + itemno +
"'' AND BorrowerNo = ''" + userno + "''";
System.out.println(sql);
queryMgr.dmlOperations("jndi-library", sql);
LGWRITER.writeLog(LogWriter.MSG_TRANSACTION, username + " updating Renew record of ''" +
itemno + "'' which belongs to ''" + userno + "''" );
}

/**
* Function to update any renewal record
*/
private void updateRenew(String itemno, String userno) {
String sql = "UPDATE Renew Set Status=''COMPLETED'' WHERE ItemNo = ''" + itemno +
"'' AND BorrowerNo = ''" + userno + "''";
System.out.println(sql);
queryMgr.dmlOperations("jndi-library", sql);
LGWRITER.writeLog(LogWriter.MSG_TRANSACTION, username + " updating Renew record of ''" +
itemno + "'' which belongs to ''" + userno + "''" );
}


/**
* Function to Send Email to Borrower who RESERVE the book
*/
private void SendNotificationEmail(int resid) {


/**
* Function to Send Email to Borrower who RESERVE the book
*/
private void SendNotificationEmail(int resid) {

DateUtils du = new DateUtils();
String sql = "SELECT b.Name, b.Email, i.ItemNo, i.Title, r.DateReserved FROM Reserve r, Borrower b, Item i" +
" WHERE r.BorrowerNo = b.BorrowerNo AND r.ItemNo = i.ItemNo AND r.ReserveNo = " + resid;
try {
Statement st = queryMgr.createStatement();
ResultSet rs = queryMgr.getResultQuery(sql, st);
if (queryMgr.CheckNull(rs)) {
String name = rs.getString("Name");
String itemno = rs.getString("ItemNo");
String title = rs.getString("Title");
String email = rs.getString("Email");
String datestr = (String) queryMgr.STD_DATE_FORMAT.format( rs.getDate("DateReserved") );
if (email.compareTo("") != 0) {
try {
MailManager Mailmgr = MailManager.GetInstance();
Conf conf = Mailmgr.getConf();
Mailmgr.setHTML(false);
Vector recp = new Vector();
recp.add(new String(email));
Mailmgr.postMail(recp, conf.getReserveSubject(),
"<div style=''font-family:verdana;font-size:9pt''>" +
"<p style=''margin-left:30.0pt''>Dear " + name + ",<p>" +
"<p style=''margin-left:30.0pt''>" + conf.getReserveMessage1() +
"<br>NO : " + itemno +
"<br>TITLE : " + title +
"</p><p style=''margin-left:30.0pt''>" + conf.getReserveMessage2() +
queryMgr.RESERVEVALIDDAYS +
" DAY(s) from the following that date you have reserved : <p><p style=''margin-left:30.0pt''>" + datestr +
"</p><p style=''margin-left:30.0pt''>" + conf.getFrom() +
"<br>" + conf.getDepartment() + "<p>" +
"</div>",
conf.getEmail() );
LGWRITER.writeLog(LogWriter.MSG_TRANSACTION," Reservation Notice EMail of " + itemno + " sent to " + email);
System.out.println("\n\tScanner Return: Reservation Notice EMail sent to " + email);
recp.removeAllElements();
} catch (javax.mail.MessagingException me) { System.out.println("\n\tReturn: Mail Sent Error");}
}

DateUtils du = new DateUtils();
String sql = "SELECT b.Name, b.Email, i.ItemNo, i.Title, r.DateReserved FROM Reserve r, Borrower b, Item i" +
" WHERE r.BorrowerNo = b.BorrowerNo AND r.ItemNo = i.ItemNo AND r.ReserveNo = " + resid;
try {
Statement st = queryMgr.createStatement();
ResultSet rs = queryMgr.getResultQuery(sql, st);
if (queryMgr.CheckNull(rs)) {
String name = rs.getString("Name");
String itemno = rs.getString("ItemNo");
String title = rs.getString("Title");
String email = rs.getString("Email");
String datestr = (String) queryMgr.STD_DATE_FORMAT.format( rs.getDate("DateReserved") );
if (email.compareTo("") != 0) {
try {
MailManager Mailmgr = MailManager.GetInstance();
Conf conf = Mailmgr.getConf();
Mailmgr.setHTML(false);
Vector recp = new Vector();
recp.add(new String(email));
Mailmgr.postMail(recp, conf.getReserveSubject(),
"<div style=''font-family:verdana;font-size:9pt''>" +
"<p style=''margin-left:30.0pt''>Dear " + name + ",<p>" +
"<p style=''margin-left:30.0pt''>" + conf.getReserveMessage1() +
"<br>NO : " + itemno +
"<br>TITLE : " + title +
"</p><p style=''margin-left:30.0pt''>" + conf.getReserveMessage2() +
queryMgr.RESERVEVALIDDAYS +
" DAY(s) from the following that date you have reserved : <p><p style=''margin-left:30.0pt''>" + datestr +
"</p><p style=''margin-left:30.0pt''>" + conf.getFrom() +
"<br>" + conf.getDepartment() + "<p>" +
"</div>",
conf.getEmail() );
LGWRITER.writeLog(LogWriter.MSG_TRANSACTION," Reservation Notice EMail of " + itemno + " sent to " + email);
System.out.println("\n\tScanner Return: Reservation Notice EMail sent to " + email);
recp.removeAllElements();
} catch (javax.mail.MessagingException me) { System.out.println("\n\tReturn: Mail Sent Error");}
}

String todaystr = du.getShortTodayDate();
sql = "UPDATE Reserve SET EmailNotify = ''Y'', DateNotified = ''" + todaystr + "''" +
" WHERE ReserveNo = " + resid;
queryMgr.dmlOperations("jndi-library", sql);
System.out.println("\n\tScanner Return: No Reserve record updated");
}
rs.close();
rs = null;
st.close();
st = null;
} catch(SQLException se) { se.printStackTrace();}
}

String todaystr = du.getShortTodayDate();
sql = "UPDATE Reserve SET EmailNotify = ''Y'', DateNotified = ''" + todaystr + "''" +
" WHERE ReserveNo = " + resid;
queryMgr.dmlOperations("jndi-library", sql);
System.out.println("\n\tScanner Return: No Reserve record updated");
}
rs.close();
rs = null;
st.close();
st = null;
} catch(SQLException se) { se.printStackTrace();}
}


}

private void attachKeyListener(final JFrame frame) {

private void attachKeyListener(final JFrame frame) {

KeyListener listener = new KeyAdapter() {
public void keyPressed(KeyEvent e) {
int code = e.getKeyCode();
buff_i++;
buff[buff_i] = (char)code;
switch(code) {
case 10 : String s = new String(buff);
buff_i = -1;
buff[0] = ''\0'';
System.out.println("\n\t<<Input value>> :" + s);
scannerdg.setVisible(false);
scannerdg.m_title.setText("");
scannerdg.txItemNo.setText(s.trim());
scannerdg.findItem(s.trim());
break;

KeyListener listener = new KeyAdapter() {
public void keyPressed(KeyEvent e) {
int code = e.getKeyCode();
buff_i++;
buff[buff_i] = (char)code;
switch(code) {
case 10 : String s = new String(buff);
buff_i = -1;
buff[0] = ''\0'';
System.out.println("\n\t<<Input value>> :" + s);
scannerdg.setVisible(false);
scannerdg.m_title.setText("");
scannerdg.txItemNo.setText(s.trim());
scannerdg.findItem(s.trim());
break;

case 13 : break;

case 13 : break;

case 16 : buff_i--;break;

case 16 : buff_i--;break;

default : break;
}//end switch

default : break;
} // end switch

}
};
sidebutton.addKeyListener(listener);
}

}
};
sidebutton.addKeyListener(listener);
}

/**
* Class to create tool bar
*/

/**
* Class to create tool bar
*/

public class ToolBar extends JPanel{

public class ToolBar extends JPanel{

private JToolBar toolBar = new JToolBar();

private JToolBar toolBar = new JToolBar();

public void setFloat(boolean condition) {
toolBar.setFloatable(condition);
}

public void setFloat(boolean condition) {
toolBar.setFloatable(condition);
}

public ToolBar() {
addButtons(toolBar);
setLayout(new BorderLayout());
setPreferredSize(new Dimension( 20, 30));
setBorder(BorderFactory.createLineBorder(Constants.DEFAULT_TOOLBAR_LINECOLOR ));
add(toolBar, BorderLayout.WEST);
toolBar.setFloatable(true);
}

public ToolBar() {
addButtons(toolBar);
setLayout(new BorderLayout());
setPreferredSize(new Dimension( 20, 30));
setBorder(BorderFactory.createLineBorder(Constants.DEFAULT_TOOLBAR_LINECOLOR ));
add(toolBar, BorderLayout.WEST);
toolBar.setFloatable(true);
}

protected void addButtons(JToolBar toolbar) {

protected void addButtons(JToolBar toolbar) {

JButton button = null;

JButton button = null;

/*button = new JButton(new ImageIcon("images/borrow.gif"));
button.setToolTipText("Borrow item");
button.addActionListener(borrowAction);
toolbar.add(button);

/*button = new JButton(new ImageIcon("images/borrow.gif"));
button.setToolTipText("Borrow item");
button.addActionListener(borrowAction);
toolbar.add(button);

button = new JButton(new ImageIcon("images/return.gif"));
button.setToolTipText("Return item");
button.addActionListener(returnAction);
toolbar.add(button);
toolbar.addSeparator();

button = new JButton(new ImageIcon("images/return.gif"));
button.setToolTipText("Return item");
button.addActionListener(returnAction);
toolbar.add(button);
toolbar.addSeparator();

button = new JButton(new ImageIcon("images/overdue.gif"));
button.setToolTipText("Overdue items");
button.addActionListener(OverdueActionListener);
toolbar.add(button);*/

button = new JButton(new ImageIcon("images/overdue.gif"));
button.setToolTipText("Overdue items");
button.addActionListener(OverdueActionListener);
toolbar.add(button);*/

button = new JButton(new ImageIcon("images/top10.gif"));
button.setToolTipText("Top 10 most popular DVDs");
button.addActionListener(Top10ActionListener);
toolbar.add(button);
toolbar.addSeparator();

button = new JButton(new ImageIcon("images/top10.gif"));
button.setToolTipText("Top 10 most popular DVDs");
button.addActionListener(Top10ActionListener);
toolbar.add(button);
toolbar.addSeparator();

button = new JButton(new ImageIcon("images/itemlist.gif"));
button.setToolTipText("List of all DVDs");
button.addActionListener(listItemActionListener);
toolbar.add(button);

button = new JButton(new ImageIcon("images/itemlist.gif"));
button.setToolTipText("List of all DVDs");
button.addActionListener(listItemActionListener);
toolbar.add(button);

button = new JButton(new ImageIcon("images/finditemlist.gif"));
button.setToolTipText("Find DVD");
button.addActionListener(findItemActionListener);
toolbar.add(button);

button = new JButton(new ImageIcon("images/finditemlist.gif"));
button.setToolTipText("Find DVD");
button.addActionListener(findItemActionListener);
toolbar.add(button);

button = new JButton(new ImageIcon("images/borrowerlist.gif"));
button.setToolTipText("List of all Consumers");
button.addActionListener(listBorrowerActionListener);
toolbar.add(button);

button = new JButton(new ImageIcon("images/borrowerlist.gif"));
button.setToolTipText("List of all Consumers");
button.addActionListener(listBorrowerActionListener);
toolbar.add(button);


button = new JButton(new ImageIcon("images/findborrowerlist.gif"));
button.setToolTipText("Find Consumer");
button.addActionListener(findBorrowerActionListener);
toolbar.add(button);
toolbar.addSeparator();


button = new JButton(new ImageIcon("images/findborrowerlist.gif"));
button.setToolTipText("Find Consumer");
button.addActionListener(findBorrowerActionListener);
toolbar.add(button);
toolbar.addSeparator();

button = new JButton(new ImageIcon("images/logoff.gif"));
button.setToolTipText("Log off");
button.addActionListener(LogoffActionListener);
toolbar.add(button);

button = new JButton(new ImageIcon("images/logoff.gif"));
button.setToolTipText("Log off");
button.addActionListener(LogoffActionListener);
toolbar.add(button);

button = new JButton(new ImageIcon("images/quit.gif"));
button.setToolTipText("Quit application");
button.addActionListener(quitActionListener);
toolbar.add(button);
}
}

button = new JButton(new ImageIcon("images/quit.gif"));
button.setToolTipText("Quit application");
button.addActionListener(quitActionListener);
toolbar.add(button);
}
}

}

when i complie this program its giving these two errors

when i complie this program its giving these two errors

1:package javax.help does not exist
import javax.help.

1:package javax.help does not exist
import javax.help.

2:.\Security\LoginDialog.java:2: class, interface, or enum expected
* ===================================================
^
C:\projects\dvdshop\Menu.java:46: cannot access Security.LoginDialog
bad class file: .\Security\LoginDialog.java
file does not contain class Security.LoginDialog
Please remove or make sure it appears in the correct subdirectory of the classpath.
protected LoginDialog logindg = null;

2:.\Security\LoginDialog.java:2: class, interface, or enum expected
* ===================================================
^
C:\projects\dvdshop\Menu.java:46: cannot access Security.LoginDialog
bad class file: .\Security\LoginDialog.java
file does not contain class Security.LoginDialog
Please remove or make sure it appears in the correct subdirectory of the classpath.
protected LoginDialog logindg = null;

Im using database MS ACCESS...do i need to write anything to connect it by odbc if yes please write the code and paste

Im using database MS ACCESS...do i need to write anything to connect it by odbc if yes please write the code and paste

thanx in advance

thanx in advance


It''s depressing how quick this forum got overrun by the same morons ruining the other forums.

It''s depressing how quick this forum got overrun by the same morons ruining the other forums.


Mmm, yeah if this keeps up I''m outta here.
Mmm, yeah if this keeps up I''m outta here.


这篇关于请帮助它不紧急的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆