Title: Chapter 13 Using an Integrated Development Environment
1Chapter 13Using an Integrated Development
Environment
13
2Understanding RAD
13
- Rapid Application Development is used extensively
in object-oriented development - You perform some analysis, then some design, then
some programming, then the cycle repeats itself
3Understanding RAD
4Understanding RAD
13
- New software development tools now meet the
demand for RAD - Goal of RAD is to radically reduce the time it
takes to develop and implement a system - RAD makes extensive use of prototyping
- A prototype is a model or mock-up of how
something will look or act - One of the main purposes of prototypes is to
allow users and programmers to define system
requirements quickly and accurately
5Understanding RAD
13
- The strategy is to develop the core features
first, and get the look and feel of them before
implementing other aspects of the system - Reducing what you try to implement is a strategy
for reducing development time - User involvement in the process helps to identify
problems early in the development process - IDEs that support RAD have been widely adopted by
the industry
6Understanding RAD
13
7Exploring the Role and Benefits of an IDE
- An Integrated Development Environment (IDE) is a
set of tools that helps to - Code
- Test
- Document
- Include many tools that support the development
process - Text editors
- Simplify code organization
- Make it easy to compile and execute applications
- Provide debugging facilities
- Assist with documentation
8Exploring the Role and Benefits of an IDE
- Forte is an IDE provided by Sun
- Features
- Tools that let you organize and work with groups
of related programs - Source editor that includes code completion and
syntactical formatting - Visual GUI editor
- Tools to compile and run programs
- Debugging facilities
- Documentation generator
9Benefits of Program Management Tools
13
- A project is a mechanism for grouping related
programs together so they are easier to manage
and work on - Advantages of projects
- Can restrict your view to work only with those
files in the current project - Designate the main project class so that running
and debugging is easier - Can customize settings to control the look and
feel of the workspaces - A package is a folder that contains your program
10Benefits of The Source Editor
13
- Color coding
- Keywords appear in blue
- Comments appear in gray
- String literals appear in magenta
- Automatic indentation
- Code completion
- Type the first few characters and Forte will show
you possible matches - Short cut keys
- Cut/Copy/Paste
- Search
11Benefits of The GUI Editor
- Select icons to represent various GUI components
- Buttons
- Radio buttons
- Text fields
- Lists
- Use layout managers and nested panels
- Automatically generates appropriate code
- Attach listeners
12Benefits of Compilation and Execution Tools
13
- You can compile and execute with a single click
- Syntax errors are displayed in the Output window
- Run time errors displayed in a separate window
13Benefits of the Debugging Tool
13
- Helps to isolate logic errors
- Set watch variables and see their values change
as the program executes - Set and remove breakpoints to follow your code as
it executes
14Benefits of the Documentation Generator
13
- Create documentation for information contained
within your source code - Documentation generated in HTML
- Include information other programmers need to use
public methods - Helps support code reusability
15Forte System Requirements
16Forte Basics A Quick Tour
- Double-click the Forte for Java CE icon
- Clear the Show Welcome Screen on Startup checkbox
then close the window - The Forte main window appears
- If other windows open (such as Explorer or
Properties window) close or minimize
17Forte Basics A Quick Tour
13
- To access getting started materials
- Click Help, then Contents
- Maximize the help window
- Click the Contents tab in the left pane
- Click on the Getting Started folder
- Click the links to browse materials
- Close the Help window
18Forte Basics A Quick Tour
13
- To run the online tutorial
- Access the Help materials
- Click the Core IDE materials in the left pane
- Click the Creating the ColorSwitch application
link - Click the links as needed to complete the
tutorial - Close or minimize the Help window when finished
19Understanding the Main Window
- Toolbars are provided for commonly used commands
- Use screen tips to learn the button functions
- The component palette contains tabs that allow
you to create GUI applications using Swing and AWT
20Understanding the Workspaces
13
- There are five workspaces in Forte
- Editing
- GUI Editing
- Browsing
- Running
- Debugging
21Exploring the Editing Workspace
- Used to create or modify
- Java
- HTML
- Plain text
- Source editor supports
- Copy/Cut/Paste
- Color-coding
- Indentation
- Code completion
- Customize by clicking on the Tools, Options menu
items - When using auto-complete use CtrlL and CtrlK to
scroll forward and backward through matches
22Exploring the GUI Editing Workspace
13
- Use the component palette to visually add
components to the Form Editor window - Use the Component Inspector to adjust the
properties of a component and establish event
listeners and event handling methods
23Exploring the GUI Editing Workspace
13
24Exploring the Browsing Workspace
13
25Exploring the Running Workspace
- Opens when you run your program
- Runtime errors are displayed in a separate window
- Opens to display compile errors
- Once your program compiles it is executed
26Exploring the Running Workspace
13
27Exploring the Debugging Workspace
28Exploring Other Windows and Status Bar
13
29Creating a Simple GUI Program
30Creating a Simple GUI Program
13
- Start Forte
- If Explorer window is not visible, click View,
Explorer menu items - Verify the default project is loaded
- To create a new Program, click File, New menu
items
31Creating a Simple GUI Program
- Indicate this will be a Swing application, then
click Next - Specify the name of your program and the package
which it will belong to in the Target Location
Pane - Click Yes to add your program to the Forte
default project
32Creating a Simple GUI Program
33Creating a Simple GUI Program
34Designing the Form
- Click the Layouts tab, and then Click the
GridLayout button
35Designing the Form
13
- Click anywhere in the Form Editor window
- Change the Gridsize to one column and two rows
click the GridLayout node to display its
properties - Click the default value of 0 for number of
columns, then enter a 1, and press enter - Click the Rows value, and then type 2
36Adding a Label
13
- Click the Swing tab, and then click the JLabel
button
37Adding a Label
13
- Click anywhere in the Form Editor window
38Adding a Label
- To change the font of the label, scroll through
the properties
39Adding a Label
- Click Arial for the font, Bold for the font
style, click 14 for the font size, and then click
OK - To change the color of the label, scroll through
the Properties and locate the Foreground property
click to open a drop down list - To center the label, click the horizontalAlignment
property and select CENTER - Change the text of the label by selecting the
text property
40Adding a Button
13
- Select the JButton tab on the Swing tab component
- Click anywhere in the Form Editor
- In the Properties pane click the Font property
and change the font to Comic Sans Ms, bold, 24
point, then click OK - Scroll down to the text property and enter Push
Me!!
41Making the Buttons Work
13
- Click the JButton1 node in the Component
Inspector - Click the Events tab, and then select the
actionPerformed property - Forte switches to the Source Editor window where
the code to add the listener and the event
handling stub have been added - Add code at the comment //Add your code handling
here - To save the file select the File, Save menu items
42Compiling and Executing
- Click the Build then Compile menu items
- To run click the Build then Execute menu items
- Click the Push Me!! button
- When finished close the application
43Using Forte to Build the Marina Application
13
- Create a new project
- Click the Project menu bar, then Project Manager,
then New - Delete the current project name and enter
Bradshaw Marina
44Create a New File
- Create a new file
- Click File, New menu items
- This is a Swing application, so click the expand
button and then click JFrame - In the name text box enter CustomerGUI
- If Forte asks if you want to include the program
in the current workspace click Yes
45Designing the Form
13
- Change the layout and add the logo
- Click on the Layouts tab
- Click anywhere in the Form Editor window
- Use the Component Inspector to change the grid
size to 1 column and 3 rows - Add the Bradshaw Marina logo to the upper cell
using the JLabel component - Change the name of the JLabel to logoLabel
- Use the component inspector to change the font,
foreground, horizontal alignment, and text
properties
46Create the Inner Panel
- Click the CustomerGUI node to select the entire
frame - Click the JPanel button on the Swing pane
- Click in the Form editor
- Rename the panel to centerPanel
47Change the Panel Layout
- Click the expand button to the left of the
centerPanel node. Right click the FlowLayout
node, and then select GridLayout - Change the number of rows and columns to 2 and 3
respectively
48Add Labels and TextFields
- Select the centerPanel in the Component Inspector
- Add the name label by selecting the JLabel button
- Use the Component Inspector and change the text
to Name and horizontalAlignment property to
RIGHT - Select the centerPanel again by clicking the
centerPanel node - Add the Name textfield
- Change the name of the textfield to
customerNameText - Repeat to add labels and textfields for address
and phone
49Create Lower Panel and Buttons
13
- Select the CustomerGUI node in the component
inspector - Click the JPanel button
- Rename the panel to lowerPanel
- Add a button to the lower panel by selecting the
JButton icon - Rename the button addButton
- Use the Component inspector to change the text
property to Add - Repeat these steps for the Clear and Close buttons
50Set the Form Title
13
- Select the CustomerGUI node
- Select the title property in the Component
Inspector and change to Add a Customer - Click File, Save to save your work!
51Making the Buttons Work
13
- Click the addButton in the Component Inspector
- Click the Events tab, then click on the
actionPerformed property - Add the appropriate code
- Repeat for the Clear and Close buttons
52Add the Customer Class and Execute
13
- Copy the Customer.java file from your CD to the
director where your CustomerGUI.java file is
saved - Open the Customer.java file
- Accept adding the file to your package
- Click Tools, and then Add to Project
- Click the CustomerGUI tab to return to that
program and then compile
53Using the Debugger
13
- A set of tools that monitor your program while it
is running - Set break points
- Observer values of variables during run time
54Getting Started with the Debugger
- Close any programs currently loaded
- Open the CalculateElectricBill.java program
- Compile and Execute the program
55Setting Breakpoints and Watch Variables
13
- Locate line 127 in the Source Editor
- Select this line of code and then click Debug on
the menu bar, then click Add Breakpoint - To set a watch, select the startReading variable
in the source editor, then right click, and then
select Add Watch - Click OK to establish the watch
- Repeat steps 3-4 for the endReading, kwhUsed, and
amtDue variables
56Monitor Watch Variables and Breakpoints
- Start the debugger by select the Debug and Start
menu items - Enter 200 for starting reading and 500 for ending
reading - When the breakpoint is reached the debugger
pauses the execution of your program - Click the Watches tab and you will see current
variable values - To resume execution press CtrlF5
57Monitor Watch Variables and Breakpoints
58Finding and Correcting Program Errors
- Force a run time error enter A for the starting
reading and B for the ending reading - Add the try catch block
59Stepping Through a Program
13
- Use F8 to step over
- Use F7 to step into
- Use CtrlF7 to step out
- Use CtrlF5 to resume execution
60Generating Javadoc Documentation
13
- To generate documentation use the Tools, and
Generate Javadoc menu items