CREATING DB WINDOWS EASLY

by David de Almeida Bezerra Júnior


On that section, we will see how easy is create windows to access MySQL database on TetrisIDE.


Creating a New Project

Press the button New, in the Toolbar. Create a project named DBWindows.


Preparing the Main Window



Change the property Title, width and height (Object Inspector) to DBWindows, 400 and 300. Double click on porperty Icon and select an icon image your wish for your Main Window.

Add 2 Buttons and change the Text to Customer and Product. For each button, select an icon image on property Icon.


Preparing Database



Add tables customer and product on MySQL Database Manager. Let the id columns and Add:
customer: name varchar(50), address varchar(50), phone varchar(14);
product: description varchar(50), price decimal(9, 2);



Select the table customer and click with the right button on column list. Select Create window from entire table. Select Two in one in the next window. Enter the name JDialogCustomer and press Create. Do the same for table product.



Look at the new windows created automaticly. Change the property Window and Modal to Dialog and true for windows JDialogProduct and JDialogCustomer.


Opening Windows



Go back to the JFrameMain and click on button titled Customer. Perform double click on OnClick event and add function openWindow with the parameter:
JDialogCustomer

Add and press OK.

Click on button titled Product. Perform double click on OnClick event and add function openWindow with the parameter:
JDialogProduct

Add and press OK.



Save and Run.




CopyRight © 2017 Analisa Software.All Rights Reserved.