Lesson 3 : Combobox with XML Data


To see the finished project open Ex15.xml in the Examples Directory from Cocktail or run Ex15.class

Step 1 : Create a new cocktail project by following the steps

 * In the file menu click new
 * Set The working directory.(The XML , Java Source Code & Class files will be saved in  this directory )
 * Give the CockTail Object name MyFirstCockTailApplication & click Ok
 
Step 2 : Adding Components to your application

Select view Icon in the Ex15_Constructor

 From the Object repository

 * Drag & drop the Jframe.Give the Name for the JFrame as MyFrame.
 * Drag & Drop Jpanel.Give the Name for the JPanel as P1
 * Select Panel, Drag & Drop Border Layout.Confirm Overwriting the layout.
 * Select Panel, Drag & Drop a MenuBar name as MB
 * Select MB, Drag & Drop a JMenu & name as File
 * Select File, Drag & Drop a JMenuItem & name as Exit
 * Select Panel, Drag & Drop a JToolBar & name as TB
 * Select TB , Change the Placement Property from South to Center
 * Select TB , Drag & Drop a JButton & name as B1.Change the Text Property to Exit
 * Select MyFrame , Drag & Drop a JPanekl & name as P2
 * Select P2,Drag & Drop GridLayout.Confirm Overwriting the layout.In the Property sheet of the P2GridLayout set
    Rows=1 & columns=1
 * Select P2 , Drag & Drop JComboBox & name as CB1.

Step 3 : Adding Values To Combo Box

 * Go to Model Factory by Selecting View menu
 * Create a new XML structure
 * Enter Column Name as Colors,Column Type as String ,Null as yes
 * Save structure by giving name as colors
 * Close the window
 * Open data manipulation & select file colors.dml
 * Enter your values in the form
 * Save the values & in Choose any Data Structure Dialog Box Select Vector
 * Close Model factory
 * Go To Tree View.Select Ex15_Constructor - Model
 * Drag & Drop a Vector from the Object Repository & name as V1.Open property sheet & set Model Component as
    color.dml & method as Direct Initialization

Step 4 : Generate Source Code , Compile & Run

 * In the menu bar select build and click generate source code or click the icon in the  tool bar.
 * After generating source code click compile to compile the code generated by cocktail
 * Now click run to view your first CockTail application. Yes WYSIWYG .