home *** CD-ROM | disk | FTP | other *** search
Java Source | 1997-07-12 | 2.9 KB | 79 lines |
- package borland.samples.tutorial.dataset.basicresolve;
-
- import java.awt.*;
- import java.awt.event.*;
- import borland.jbcl.control.*;
- import borland.jbcl.layout.*;
- import borland.jbcl.dataset.*;
-
- public class BasicResolveFrame extends DecoratedFrame {
- BorderLayout borderLayout1 = new BorderLayout();
- BevelPanel bevelPanel1 = new BevelPanel();
- StatusBar statusBar = new StatusBar();
- GridControl gridControl1 = new GridControl();
- NavigatorControl navigatorControl1 = new NavigatorControl();
- ButtonControl buttonControl1 = new ButtonControl();
- Database database1 = new Database();
- QueryDataSet queryDataSet1 = new QueryDataSet();
- BorderLayout borderLayout2 = new BorderLayout();
- BevelPanel bevelPanel2 = new BevelPanel();
- FlowLayout flowLayout1 = new FlowLayout();
-
- //Construct the frame
- public BasicResolveFrame() {
- try {
- jbInit();
- }
- catch (Exception e) {
- borland.jbcl.util.Diagnostic.printStackTrace(e);
- }
- }
-
- //Component initialization
- public void jbInit() throws Exception{
- this.setLayout(borderLayout1);
- this.setSize(new Dimension(551, 398));
- this.setTitle("Basic Resolving");
- bevelPanel1.setLayout(borderLayout2);
- statusBar.setDataSet(queryDataSet1);
- gridControl1.setDataSet(queryDataSet1);
- navigatorControl1.setDataSet(queryDataSet1);
- buttonControl1.setLabel("Save Changes");
- buttonControl1.addActionListener(new BasicResolveFrame_buttonControl1_actionAdapter(this));
- database1.setConnection(new borland.jbcl.dataset.ConnectionDescriptor("jdbc:odbc:DataSet Tutorial", "SYSDBA", "masterkey", false, "sun.jdbc.odbc.JdbcOdbcDriver"));
- queryDataSet1.setQuery(new borland.jbcl.dataset.QueryDescriptor(database1, "select * from employee", null, true, false));
- bevelPanel2.setLayout(flowLayout1);
- this.add(statusBar, BorderLayout.SOUTH);
- this.add(bevelPanel1, BorderLayout.CENTER);
- bevelPanel1.add(gridControl1, BorderLayout.CENTER);
- bevelPanel1.add(navigatorControl1, BorderLayout.NORTH);
- bevelPanel1.add(bevelPanel2, BorderLayout.SOUTH);
- bevelPanel2.add(buttonControl1, null);
- }
-
-
- void buttonControl1_actionPerformed(ActionEvent e) {
- try {
- database1.saveChanges(queryDataSet1); //, UpdateMode.CHANGED_COLUMNS);
- System.out.println("Save changes succeeded");
- }
- catch (Exception ex) {
- // displays the exception on the StatusBar if the application includes one,
- // or displays an error dialog if there isn't
- DataSetException.handleException(ex); }
- }
- }
-
- class BasicResolveFrame_buttonControl1_actionAdapter implements java.awt.event.ActionListener {
- BasicResolveFrame adaptee;
-
- BasicResolveFrame_buttonControl1_actionAdapter(BasicResolveFrame adaptee) {
- this.adaptee = adaptee;
- }
-
- public void actionPerformed(ActionEvent e) {
- adaptee.buttonControl1_actionPerformed(e);
- }
- }
-
-