The Bluej Tutorial: For Bluej Version 2.0.X
The Bluej Tutorial: For Bluej Version 2.0.X
Version 2.0.1
for BlueJ Version 2.0.x
Michael Kölling
Mærsk Institute
University of Southern Denmark
Table of contents
Copyright © M. Kölling
Contents
1 Foreword 4
2 Installation 6
Copyright © M. Kölling 2
Table of contents
7 Debugging 27
9 Creating applets 33
10 Other Operations 35
Copyright © M. Kölling 3
Other operations
Summary: To create objects from library classes, use Tools – Use Library Class.
BlueJ also offers a function to create objects from classes that are not part of your
project, but defined in a library. You can, for example, create objects of class String
or ArrayList. This can be very useful for quick experimentation with these library
objects.
You can create a library object by selecting Tools – Use Library Class… from the menu. A
dialog will pop up that prompts you to enter a fully qualifies class name, such as
java.lang.String. (Note that you must type the fully qualified name, that is the name
including the package names that contain the class.)
The text entry field has an associated popup menu showing recently used classes.
Once a class name has been entered, pressing Enter will display all constructors and
static methods of that class in a list in the dialog. Any of these constructors or static
methods can now be invoked by selecting them from this list.
The invocation proceeds as any other constructor or method call.
Copyright © M. Kölling 37
11 Just the summaries
Getting started
1. To open a project, select Open from the Project menu.
2. To create an object, select a constructor from the class popup menu.
3. To execute a method, select it from the object popup menu.
4. To edit the source of a class, double-click its class icon.
5. To compile a class, click the Compile button in the editor. To compile a project, click the
Compile button in the project window.
6. To get help for a compiler error message, click the question mark next to the error
message.
Debugging
21. To set a breakpoint, click in the breakpoint area to the left of the text in the editor.
22. To single-step through your code, use the Step and Step Into buttons in the debugger.
23. Inspecting variables is easy – they are automatically displayed in the debugger.
24. Halt and Terminate can be used to halt an execution temporarily or permanently.
Copyright © M. Kölling 38
Just the summaries
Creating applets
26. To run an applet, select Run Applet from the applet’s popup menu.
27. To create an applet, click the New Class button and select Applet as the class type.
Other operations
28. Non-BlueJ packages can be opened with the Project: Open Non BlueJ… command.
29. Classes can be copied into a project from outside by using the Add Class from File...
command.
30. Static methods can be called from the class's popup menu.
31. To generate documentation for a project, select Project Documentation from the Tools
menu.
32. The Java standard class API can be viewed by selecting Help - Java Standard Libraries.
33. To create objects from library classes, use Tools – Use Library Class.
Copyright © M. Kölling 39