home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-06-10 | 5.5 KB | 168 lines |
- // SimpleForm.java
-
- import wfc.app.*;
- import wfc.core.*;
- import wfc.ui.*;
-
- public class SimpleForm extends Form
- {
- private void SimpleForm_click(Object sender, Event e)
- {
-
- }
-
- private void dataSource1_BeginTransComplete(Object sender, wfc.data.ConnectionEvent e)
- {
-
- }
-
- public SimpleForm()
- {
- // Required for Visual J++ Form Designer support
- initForm();
-
- // TODO: Add any constructor code after initForm call
- }
-
- /**
- * The main entry point for the application.
- *
- * @param args Array of parameters passed to the application
- * via the command line.
- */
- public static void main(String args[])
- {
- Application.run(new SimpleForm());
- }
-
-
- /**
- * 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();
- Label label1 = new Label();
- Edit edit1 = new Edit();
- Label label2 = new Label();
- Edit edit2 = new Edit();
- GroupBox groupBox1 = new GroupBox();
- Label label3 = new Label();
- Label label4 = new Label();
- Label label5 = new Label();
- Label label6 = new Label();
- PictureBox pictureBox2 = new PictureBox();
- public wfc.data.ui.DataBinder dataBinder1 = new wfc.data.ui.DataBinder(components);
- wfc.data.ui.DataNavigator dataNavigator1 = new wfc.data.ui.DataNavigator();
- wfc.data.ui.DataSource dataSource2 = new wfc.data.ui.DataSource(components);
- PictureBox pictureBox1 = new PictureBox();
-
- private void initForm()
- {
- ResourceManager resources = new ResourceManager(this, "SimpleForm");
- this.setBackColor(Color.CONTROL);
- this.setLocation(new Point(0, 0));
- this.setSize(new Point(488, 341));
- this.setTabIndex(-1);
- this.setTabStop(true);
- this.setText("WFC Data Binding");
- this.setAutoScaleBaseSize(13);
- this.setClientSize(new Point(480, 314));
- this.setStartPosition(FormStartPosition.CENTER_SCREEN);
- this.addOnClick(new EventHandler(this.SimpleForm_click));
- label1.setLocation(new Point(30, 170));
- label1.setSize(new Point(76, 16));
- label1.setText("Nombre:");
- label1.setTabIndex(0);
- edit1.setBackColor(Color.WINDOW);
- edit1.setCursor(Cursor.IBEAM);
- edit1.setLocation(new Point(120, 164));
- edit1.setSize(new Point(172, 20));
- edit1.setTabIndex(1);
- edit1.setTabStop(true);
- edit1.setText("Johnson");
- edit1.setMaxLength(20);
- label2.setLocation(new Point(30, 200));
- label2.setSize(new Point(76, 16));
- label2.setText("Apellido:");
- label2.setTabIndex(3);
- edit2.setBackColor(Color.WINDOW);
- edit2.setCursor(Cursor.IBEAM);
- edit2.setLocation(new Point(120, 200));
- edit2.setSize(new Point(184, 20));
- edit2.setTabIndex(2);
- edit2.setTabStop(true);
- edit2.setText("White");
- edit2.setMaxLength(40);
- groupBox1.setLocation(new Point(12, 12));
- groupBox1.setSize(new Point(448, 120));
- groupBox1.setTabIndex(4);
- groupBox1.setTabStop(false);
- groupBox1.setText("Pasos para la creaci≤n de una aplicaci≤n con Data Binding mφnima");
- label3.setLocation(new Point(8, 20));
- label3.setSize(new Point(424, 16));
- label3.setText(" 1) Colocar en el formulario un DataSorce y un DataBinder");
- label3.setTabIndex(3);
- label4.setLocation(new Point(10, 40));
- label4.setSize(new Point(420, 30));
- label4.setText("2) Colocar controles WFC : un Edit y un DataNavigator.");
- label4.setTabIndex(2);
- label5.setLocation(new Point(8, 60));
- label5.setSize(new Point(424, 16));
- label5.setText("3) Modificar las propiedades del DataSource");
- label5.setTabIndex(1);
- label6.setLocation(new Point(8, 80));
- label6.setSize(new Point(424, 16));
- label6.setText("4) modificar las propiedades del DataBinder");
- label6.setTabIndex(0);
- pictureBox2.setLocation(new Point(330, 210));
- pictureBox2.setSize(new Point(120, 30));
- pictureBox2.setImage((Bitmap)resources.getObject("pictureBox2_image"));
- dataSource2.setConnectionString("Provider=MSDASQL.1;Data Source=Pubs");
- dataSource2.setCommandText("select * from authors");
- dataSource2.setCursorType(wfc.data.AdoEnums.CursorType.KEYSET);
- dataSource2.setLockType(wfc.data.AdoEnums.LockType.OPTIMISTIC);
- dataSource2.setSort(null);
- dataSource2.setUserId(null);
- dataSource2.setPassword(null);
- /* @designTimeOnly dataSource2.setLocation(new Point(150, 270)); */
- dataBinder1.setDataSource(dataSource2);
- dataBinder1.setDataMember("");
- dataBinder1.setBindings(new wfc.data.ui.DataBinding[] {
- new wfc.data.ui.DataBinding(edit1, "Text", "au_fname"),
- new wfc.data.ui.DataBinding(edit2, "Text", "au_lname")});
- /* @designTimeOnly dataBinder1.setLocation(new Point(300, 270)); */
- dataNavigator1.setLocation(new Point(20, 230));
- dataNavigator1.setSize(new Point(280, 30));
- dataNavigator1.setTabIndex(6);
- dataNavigator1.setTabStop(false);
- dataNavigator1.setText("Navegaci≤n");
- dataNavigator1.setDataSource(dataSource2);
- pictureBox1.setLocation(new Point(320, 140));
- pictureBox1.setSize(new Point(140, 60));
- pictureBox1.setImage((Bitmap)resources.getObject("pictureBox1_image"));
- this.setNewControls(new Control[] {
- pictureBox2,
- pictureBox1,
- dataNavigator1,
- groupBox1,
- edit2,
- label2,
- edit1,
- label1});
- groupBox1.setNewControls(new Control[] {
- label6,
- label5,
- label4,
- label3});
- dataSource2.begin();
- }
- // NOTE: End of form designer support code
-
- public static class ClassInfo extends Form.ClassInfo
- {
- // TODO: Add your property and event infos here
- }
- }
-