280 likes | 450 Vues
Creating an Application: The AppBuilder for Java IDE. Objectives. After completing this lesson, you should be able to do the following: Create new projects and applications in AppBuilder for Java Build and execute Java applications Modify Java application source code. Overview.
E N D
Objectives • After completing this lesson, you should be able to do the following: • Create new projects and applications in AppBuilder for Java • Build and execute Java applications • Modify Java application source code
Overview • This lesson introduces the AppBuilder for Java Integrated Development Environment (IDE) • Building, debugging, and deploying Java applications, applets, and JavaBeans • Wizards to help build source code • User interface designer • Database connectivity components
1 2 3 4 The AppBuilder Environment
Creating a New Project • Select File—>New Project from the Menu
Specifying Project Details: Step 1 • Specify project details:
Specifying Project Details: Step 2 • Specify optional project details:
Specifying Project Details: Final Step • Choose one of the following options:
Creating a New Java Application • Select File—>New from the Menu bar • Double-clickApplicationicon
Specifying Application Details • Specify details in Application Wizard: • Thenclick OK
Specifying Frame Details • Specify details in Frame Wizard: • Then click OK
The Skeleton Java Application • Contains application and frame classes, plus HTML file
Building and Executing the Application • Select Project—>Make Project to compile .java files into .class files • Select Run—>Run to launch application • Creates an application object • Creates a frame object • The frame object deals with the user interface
The Application Class • The top-level class in the application • Contains the main() method • Select theapplication class • View code inContent Pane
Finding Methods and Attributes • Use the Structure Pane to find methods and attributes in a class • Select item in Structure Pane
The Frame Class • Defines the appearance and behavior of the user interface 1 2
1 2 3 Adding Palette Components to the Frame
Specifying Component Properties • Select View—>Inspector to view or edit the properties of a component 1 2
Using the Help System • Provides help on all development aspects • Select Help—>Help Topics 1 2
Finding Help Topics • Master Index tab gives access to all topics 1
Debugging Programs with AppBuilder for Java • AppBuilder for Java provides a sophisticated debugger • The debugger provides the following capabilities: • Step over, or trace into, a method • Set conditional breakpoints • Examine and modify “watch” variables
1 Using the Debugger • Click the Debug icon to debug an app
Stepping Through a Program • You can step through a program using the buttons on the Debugger toolbar • Execute the program • Step over a method call • Trace into a method call • Pause execution • Stop the debugger
Setting Breakpoints • To set a breakpoint: • Select a line of code in the Source pane • Click with the right mouse button • Select Toggle Breakpoint from the pop-up menu • To run to the next breakpoint, select the Run button on the Debug toolbar
Watching Variables • You can examine and modify local variables in the Data pane • To watch other variables: • Select a variable in the Source pane • Click with the right mouse button • Select Add Watch at Cursor from the pop-up menu • View the variable in the “Watch” pane
Summary • AppBuilder for Java can be used to build, debug, and deploy Java applications, applets, and JavaBeans • A new application in AppBuilder has three files: • Application class, contains main() • Frame class, defines UI • HTML file
Practice 1-1 Overview • Opening the final solution project, to gain familiarity with the goal of the practice sessions • Creating a new project in AppBuilder for Java • Adding a simple application • Building and running the application