Creating a simple window with
one panel,two buttons,four labels & three text Box to get user input
To see the finished project open LoginScreen.xml in the Examples Directory from Cocktail or run LoginScreen.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 MyFirstCockTailApplication & click Ok
Step 2: Adding Components
to your application
Select view Icon in the
MyFirstCockTailApplication-Constructor
From the Object repository
* Drag & drop the
Jframe.Give the Name for the JFrame as LoginFrame.
* Drag & drop
JLabel & give name as Header.open the property sheet.Set the value
for property text as Enter Your
Name Password here
* Drag & Drop
Jpanel.Give the Name for the JPanel as Panel.
* Select The Panel,
Drag & Drop Grid Layout.Confirm Overwriting the layout.Change the Placement_Border
Layout of Panel
from South
to Center.
* Open the panel1gridlayout
property sheet & set Rows 4, Columns 2.
* Select The Panel,
Drag & Drop a JLabel & give name as name
* Select The Panel,
Drag & Drop a JText & give name as TextName
* Select The Panel,
Drag & Drop a JLabel & give name as Password
* Select The Panel,
Drag & Drop a JPasswordField & give name as TextPassword
* Select The Panel,
Drag & Drop a Jlabel & give name as IPAddress
* Select The Panel,
Drag & Drop a JText & give name as TextIPAddress
* Select The Panel,
Drag & Drop a JButton & name as ok
* Select The Panel,
Drag & Drop a JButton & name as cancel
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 .
|