|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
两个到底是哪一个给出了MySQL这个名字至今依然是个迷,包括开发者在内也不知道。window
/*/////////////////////////////////////////////////////////////////////////**Thisisabasicjavadatawindowexample.*Iwantexplaineyouhowtouseadatawindowcontrolforjavadevelopment.*(itssobasic...)**Autor:*DavidArcia09-09-2002(david.arcia@softhome.net)*//////////////////////////////////////////////////////////////////////////*/importjavax.swing.JOptionPane;importjavax.swing.JFrame;importpowersoft.datawindow.JDataWindowControl;importpowersoft.datawindow.Blob;importpowersoft.powerj.db.java_sql.Transaction;publicclassJDataWindowextendsJFrame{//ThedatawindowprivateJDataWindowControldwcActual;//Thepowerbuilderlibrarypath(wheredataobjectsarestored)privatefinalStringLIBRERIA=newString("C:PB7java.pbl");//TransactionobjetcfordatabaseconnectionprivateTransactiontrans;//ContructorpublicJDataWindow(){//NewdatawindowcontroldwcActual=getDataWindow("dw_products",true,true,true);//Notnull?if(dwcActual==null)return;}//endsmethod/*********************************************************************************CONNECTIONUSINGPOWERSOFTTRANSACTIONOBJECT(asSQLCAinPowerBuilder)********************************************************************************///Thismethodconnectwithdatabase(byexample,aoracledatabase)publicbooleansetConnect(){trans=newTransaction();trans.registerDriver("oracle.jdbc.driver.OracleDriver");trans.setDataSource("jdbc:oracle:thin:@192.168.22.10:1521:FALCON");trans.setUserID("rjimenez");trans.setPassword("defalcon");//Error?if(!trans.connect()){System.err.println("Connectionfailed.");returnfalse;}returntrue;}//endsmethod/*********************************************************************************JAVADATAWINDOWSCREATION********************************************************************************///CreateadatawindowpublicJDataWindowControlgetDataWindow(Stringdataobject){JDataWindowControldwc=newJDataWindowControl();//Assignadatawindowlibrarydwc.setSourceFileName(LIBRERIA);//Assignadatawindowobjecttothedwcontroldwc.setDataWindowObjectName(dataobject);//Someproperties...dwc.setVScroll(true);dwc.insertRow(0);//Assignthetransactionobjecttodwdwc.setTransaction(trans);//returnobjectcreatedreturndwc;}//endsmethod//Optional...MethodforrowselectionpublicvoidselectRow(introw){if(row>0){dwcActual.selectRow(0,false);dwcActual.selectRow(row,true);dwcActual.scrollToRow(row);dwcActual.setRow(row);}}//endsmethod//Optional...fortomakeadatawindoweditableornotpublicvoidsetEditable(JDataWindowControldwc,booleaneditar){//AccepttextdwcActual.acceptText();//getcolumnnumberintcols=Integer.parseInt(dwc.describe("Datawindow.column.count"));//////////////////////////////////////////////////////////////////////////Stringindicador=(editar)?"1":"0";//////////////////////////////////////////////////////////////////////////editable=indicador=="1";//Changetheeditableporpertyfor(intcont=1;cont<=cols;cont++){dwc.modify("#"+cont+".TabSequence="+indicador);}}//endsmethod//Optional...Insertnewrowtodatawindowsend.publicvoidgetNewRow(){introw=dwcActual.insertRow(0);selectRow(row);}//finaldemetodo//Optional...DeleteadatawindowrowpublicvoiddeleteRow(){intboton=JOptionPane.showConfirmDialog(null,"Deleteactualrow?","Deleting",JOptionPane.YES_NO_OPTION);if(boton==0)dwcActual.deleteRow(dwcActual.getRow());}//Findemetodo/*********************************************************************************THISARETHEDATAWINDOWSEVENTMANAGERS**Theeventsthatsupportdatawindowareclasificatedindifferentsinterfaces*accordingitfunction.*********************************************************************************Interfaces:MouseListener,FocusListener,DatabaseListener,EditChangedListener,ItemListener,PrintListener,RowChangeListener,etc...Datawindowevents:publicvoidleftButtonDoubleClick(MouseEventevent){}publicvoidleftButtonClick(MouseEventevent){}publicvoidleftButtonDown(MouseEventevent){}publicvoidleftButtonUp(MouseEventevent){}publicvoidmiddleButtonClick(MouseEventevent){}publicvoidmiddleButtonDoubleClick(MouseEventevent){}publicvoidmouseMove(MouseEventevent){}publicvoidrightButtonClick(MouseEventevent){}publicvoidrightButtonDoubleClick(MouseEventevent){}publicvoidrightButtonDown(MouseEventevent){}publicvoidrightButtonUp(MouseEventevent){}publicvoidgetFocus(FocusEventevent){}publicvoidloseFocus(FocusEventevent){}publicvoidDBError(DatabaseEventevent){}publicvoidSQLPreview(DatabaseEventevent){}publicvoideditChanged(EditChangedEventevent){}publicvoiditemChanged(ItemEventevent){}publicvoiditemChangeAccepted(ItemEventevent){}publicvoiditemError(ItemEventevent){}publicvoiditemFocusChanged(ItemEventevent){}publicvoidprintEnding(PrintEventevent){}publicvoidprintMarginChanging(PrintEventevent){}publicvoidprintPageStarting(PrintEventevent){}publicvoidprintStarting(PrintEventevent){}publicvoidretrieveEnd(RetrieveEventevent){}publicvoidretrieveRow(RetrieveEventevent){}publicvoidretrieveStart(RetrieveEventevent){}publicvoidrowChanged(RowChangeEventevent){}publicvoidrowChanging(RowChangeEventevent){}etc...********************************************************************************/}//endsclasse
MySQL是一个开放源码的小型关联式数据库管理系统,开发者为瑞典MySQLAB公司。目前MySQL被广泛地应用在Internet上的中小型网站中。 |
|