datawindowjava

<script type="text/javascript"><!-- google_ad_client = "pub-2947489232296736"; /* 728x15, 创建于 08-4-23MSDN */ google_ad_slot = "3624277373"; google_ad_width = 728; google_ad_height = 15; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
<script type="text/javascript"><!-- google_ad_client = "pub-2947489232296736"; /* 160x600, 创建于 08-4-23MSDN */ google_ad_slot = "4367022601"; google_ad_width = 160; google_ad_height = 600; //--> </script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>

/*/////////////////////////////////////////////////////////////////////////**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:/PB7/java.pbl");//TransactionobjetcfordatabaseconnectionprivateTransactiontrans;//ContructorpublicJDataWindow(){//NewdatawindowcontroldwcActual=getDataWindow("dw_products",true,true,true);//Notnull?if(dwcActual==null)return;}//endsmethod/*********************************************************************************CONNECTIONUSINGPOWERSOFTTRANSACTIONOBJECT(asSQLCAin)********************************************************************************///Thismethodconnectwithdatabase(byexample,aoracledatabase)publicbooleansetConnect(){trans=newTransaction();trans.registerDriver("oracle.jdbc.driver.Driver");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/*********************************************************************************JAVADATAWINDOW'SCREATION********************************************************************************///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/*********************************************************************************THISARETHEDATAWINDOW'SEVENTMANAGERS**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...******************************************************************************** <script type="text/javascript"><!-- google_ad_client = "pub-2947489232296736"; /* 728x15, 创建于 08-4-23MSDN */ google_ad_slot = "3624277373"; google_ad_width = 728; google_ad_height = 15; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
<script type="text/javascript"><!-- google_ad_client = "pub-2947489232296736"; /* 160x600, 创建于 08-4-23MSDN */ google_ad_slot = "4367022601"; google_ad_width = 160; google_ad_height = 600; //--> </script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
阅读更多
文章标签: null jdbc oracle c
个人分类: 数据库
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭