Lesson 2 : Using radio button group

 

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


Step1 :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 RadioButtonGroupExample & click Ok

Step 2:Adding Components to your application RadioButtonGroupExample

 * Select view Icon in the RadioButtonGroupExample-Constructor

    From the Object repository

 * drag & drop Jframe , Name JFrame as RadioButtonGroup.
 * drag & drop JPanel , Name JPanel as MasterContainerPanel.Change the layout to BoxLayout
 * select MasterContainerPanel.drag & drop JPanel , Name JPanel as RadioButtonGroupPanel1.Change the layout to  GridLayout.
    In the Property sheet of the RadioButtonGroupPanel1 set Rows=4 & columns=1
 * select RadioButtonGroupPanel1 . drag & drop JLabel , Name JLabel as FontName
 * drag & drop ButtonGroup , Name as FontButtonGroup
 * select FontButtonGroup drag & drop Three JRadioButton & name it viz TimesNewRoman,Arial & Tahoma
 * drag & drop JPanel , Name JPanel as RadioButtonGroupPanel2.Change the layout to GridLayout.In the Property
    sheet of the RadioButtonGroupPanel2 set Rows=4 & columns=1
 * select FontButtonGroup drag & drop Three JRadioButton & name it viz Plain,Italic,Bold
 * select RadioButtonGroup Frame,Drag & Drop a JPanel & Name TextPanel
 * Select TextPanel & drag & drop a Jtextarea.Name it as Trial Text

Step 3: 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 .