⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form13.java

📁 JAVA语言实现的图书馆图书管理系统设计与源码
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
//Form13.java

import com.ms.wfc.app.*;
import com.ms.wfc.core.*;
import com.ms.wfc.ui.*;
import com.ms.wfc.data.*;
import com.ms.wfc.data.ui.*;

public class Form13 extends Form
{

    public void btnAdd_Click(Object sender, Event evt)
    {
        try
        {
            dataSource1.getRecordset().cancelUpdate();
            dataSource1.getRecordset().addNew();
            m_bAddNew = true;
            btnDelete.setText ("&返回" );
            btnAdd.setEnabled( false );
            btnRefresh.setEnabled( false );
        }
        catch (Exception e)
        {
            handleADOException(e);
        }
    }

    public void btnDelete_Click(Object sender, Event evt)
    {
        try
        {
            if( m_bAddNew )
            {
                dataSource1.getRecordset().cancelUpdate();
                m_bAddNew = false;
                btnDelete.setText ("&删除" );
                btnRefresh.setEnabled( true );
                btnAdd.setEnabled( true );
            }
            else
            {
                dataSource1.getRecordset().delete(AdoEnums.Affect.CURRENT);
                if( !dataSource1.getRecordset().getEOF() )
                {
                    dataSource1.getRecordset().moveNext();
                    if( dataSource1.getRecordset().getEOF() )
                        dataSource1.getRecordset().movePrevious();
                }
            }
        }
        catch (Exception e)
        {
            handleADOException(e);
            dataSource1.getRecordset().cancelBatch();
        }
    }

    public void btnRefresh_Click(Object sender, Event evt)
    {
        try
        {
            btnRefresh.setEnabled( false );
            dataSource1.getRecordset().cancelBatch();
            Object bm =  dataSource1.getRecordset().getBookmark();
            dataSource1.requery();
            if( bm != null ) 
                dataSource1.getRecordset().setBookmark( bm );
            
        }
        catch (Exception e)
        {
            handleADOException(e);
        }
        btnRefresh.setEnabled( true );
    }

    public void btnUpdate_Click(Object sender, Event evt)
    {
        try
        {
            this.setCursor( Cursor.WAIT );
            dataBinder1.commitChanges();
            dataSource1.getRecordset().update();

            if( m_bAddNew )
            {
                dataSource1.requery();
                
                dataSource1.getRecordset().moveLast();
            }
        }
        catch (Exception e)
        {
            handleADOException(e);
            if( m_bAddNew )
            {
                this.setCursor( Cursor.DEFAULT );
                return;
            }
            else
                dataSource1.getRecordset().cancelUpdate();
        }

        this.setCursor( Cursor.DEFAULT );
        m_bAddNew = false;
        btnDelete.setText ("&删除" );
        btnRefresh.setEnabled( true );
        btnAdd.setEnabled( true );
    }

    public void btnClose_Click(Object sender, Event evt)
    {
        this.dispose();
    }

    boolean    m_bAddNew;
    public void dispose()
    {
        super.dispose();
        components.dispose();
    }
	
    public Form13()
    {
        // Required for Visual J++ Form Designer support
        initForm();
        
        this.show();
        this.update();

        //TODO: Add any constructor code after initForm call
    }    

    public void formClose(Event e)
    {
        Application.exit();
    }    

    
    void handleADOException(Exception e)
    {
        e.printStackTrace();
        MessageBox.show( e.toString(), "Form13" );
    }

	/**
	 * NOTE: The following code is required by the Visual J++ form
	 * designer.  It can be modified using the form editor.  Do not
	 * modify it using the code editor.
	 */
	Container components = new Container();
	DataSource dataSource1 = new DataSource(components);
	DataBinder dataBinder1 = new DataBinder(components);
	Label label正题名 = new Label();
	Edit edit正题名 = new Edit();
	Label label索书号 = new Label();
	Edit edit索书号 = new Edit();
	Label label原版刊号 = new Label();
	Edit edit原版刊号 = new Edit();
	Label label本馆采购号 = new Label();
	Edit edit本馆采购号 = new Edit();
	Label label现刊排架号 = new Label();
	Edit edit现刊排架号 = new Edit();
	Label label邮局发行号 = new Label();
	Edit edit邮局发行号 = new Edit();
	Label label库存数量 = new Label();
	Edit edit库存数量 = new Edit();
	Label label库存总量 = new Label();
	Edit edit库存总量 = new Edit();
	Label label主题词 = new Label();
	Edit edit主题词 = new Edit();
	Label label书目数据 = new Label();
	Edit edit书目数据 = new Edit();
	Label label发行商名 = new Label();
	Edit edit发行商名 = new Edit();
	Button btnAdd = new Button();
	Button btnDelete = new Button();
	Button btnRefresh = new Button();
	Button btnUpdate = new Button();
	Button btnClose = new Button();
	Panel panel1 = new Panel();
	DataNavigator dataNavigator = new DataNavigator();

	private void initForm()
	{
		this.setBackColor(Color.AQUA);
		this.setForeColor(new Color(0, 0, 128));
		this.setLocation(new Point(7, 7));
		this.setText("中文图书数据库管理");
		this.setAutoScaleBaseSize(new Point(6, 12));
		this.setAutoScroll(true);
		this.setClientSize(new Point(420, 420));
		this.setStartPosition(FormStartPosition.CENTER_SCREEN);

		dataSource1.setConnectionString("PROVIDER=Microsoft.Jet.OLEDB.3.51;Data Source=C:\\My Documents\\db3.mdb");
		dataSource1.setCommandText("select 正题名, 索书号, 原版刊号, 本馆采购号, 现刊排架号, 邮局发行号, 库存数量, 库存总量, 主题词, 书目数据, 发行商名 from 表1 ORDER by 索书号");
		dataSource1.setSort(null);
		dataSource1.setStayInSync(true);
		dataSource1.setUserId(null);
		dataSource1.setPassword(null);

		label正题名.setBackColor(Color.CONTROL);
		label正题名.setLocation(new Point(10, 20));
		label正题名.setSize(new Point(100, 20));
		label正题名.setTabIndex(0);
		label正题名.setTabStop(false);
		label正题名.setText("正题名");

		edit正题名.setAnchor(ControlAnchor.TOPLEFTRIGHT);
		edit正题名.setLocation(new Point(120, 20));
		edit正题名.setSize(new Point(280, 20));
		edit正题名.setTabIndex(1);
		edit正题名.setText("正题名");
		edit正题名.setMaxLength(50);
		edit正题名.setMultiline(true);

		label索书号.setBackColor(Color.CONTROL);
		label索书号.setLocation(new Point(10, 50));
		label索书号.setSize(new Point(100, 20));
		label索书号.setTabIndex(2);
		label索书号.setTabStop(false);
		label索书号.setText("索书号");

		edit索书号.setAnchor(ControlAnchor.TOPLEFTRIGHT);
		edit索书号.setLocation(new Point(120, 50));
		edit索书号.setSize(new Point(280, 20));
		edit索书号.setTabIndex(3);
		edit索书号.setText("索书号");
		edit索书号.setMultiline(true);

		label原版刊号.setBackColor(Color.CONTROL);
		label原版刊号.setLocation(new Point(10, 80));
		label原版刊号.setSize(new Point(100, 20));
		label原版刊号.setTabIndex(4);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -