home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
inprise
/
JSAMPLES.Z
/
BasicResolveFrame.java
< prev
next >
Wrap
Text File
|
1998-05-08
|
4KB
|
104 lines
/*
* Copyright (c) 1997-1998 Borland International, Inc. All Rights Reserved.
*
* This SOURCE CODE FILE, which has been provided by Borland as part
* of a Borland product for use ONLY by licensed users of the product,
* includes CONFIDENTIAL and PROPRIETARY information of Borland.
*
* USE OF THIS SOFTWARE IS GOVERNED BY THE TERMS AND CONDITIONS
* OF THE LICENSE STATEMENT AND LIMITED WARRANTY FURNISHED WITH
* THE PRODUCT.
*
* IN PARTICULAR, YOU WILL INDEMNIFY AND HOLD BORLAND, ITS RELATED
* COMPANIES AND ITS SUPPLIERS, HARMLESS FROM AND AGAINST ANY CLAIMS
* OR LIABILITIES ARISING OUT OF THE USE, REPRODUCTION, OR DISTRIBUTION
* OF YOUR PROGRAMS, INCLUDING ANY CLAIMS OR LIABILITIES ARISING OUT OF
* OR RESULTING FROM THE USE, MODIFICATION, OR DISTRIBUTION OF PROGRAMS
* OR FILES CREATED FROM, BASED ON, AND/OR DERIVED FROM THIS SOURCE
* CODE FILE.
*/
package borland.samples.tutorial.dataset.basicresolve;
import java.awt.*;
import java.awt.event.*;
import borland.jbcl.control.*;
import borland.jbcl.layout.*;
import borland.sql.dataset.*;
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
private 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.sql.dataset.ConnectionDescriptor("jdbc:odbc:DataSet Tutorial", "SYSDBA", "masterkey", false, "sun.jdbc.odbc.JdbcOdbcDriver"));
queryDataSet1.setQuery(new borland.sql.dataset.QueryDescriptor(database1, "select * from employee", null, true, Load.ALL));
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);
}
// Override getPreferredSize() to set initial window size
public Dimension getPreferredSize()
{
return new Dimension(551, 398);
}
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);
}
}