Google
 
Site navigation: [ Home | Theory | Java | Moodle courses | Resource wiki | About ]

Getting Started with BlueJ

Before we start the application

BlueJ uses templates for its code files, these give a quick outline structure to the Classes you can create. We use a couple of classes that are not part of the original BlueJ distribution. To use these examples you can simply cut and paste the example code from the web pages or you can install the classes as follows:

Copy the files for the new classes appletsimple (save as appletsimple.tmpl) and ibio (save as ibio.tmpl) to the <bluej>lib\english\templates\newclass directory.

The IBIO template implements a basic structure which uses the IBIO methods defined as part of JETS in theSubject Guide.

BlueJ is simple to use.

However, there are plenty of other IDE's you can use with the program.

If you prefer absolute simplicity we show how to program with a simple text editor and the ant application elsewhere (soon!).

For further details about creating and installing customized templates, please see the BlueJ Reference Manual, available from the BlueJ Website.


 

Writing a simple GUI Applet

The how to buttons link to screen shots if you just want to confirm the screen you see is the right one (they open in a pop up window). The instructions are easy enough to follow, hopefully. If you are not using BlueJ, skip these and go on to the screenshot, below.

.
Start Bluej and start a new project.
Add a new Class to your project; select the Simple Event Applet button, call the Class PressMe (or a name of your own choosing - by convention Class names start with a capital letter).

You should now be able to see the code by double-clicking the new Applet name in the BlueJ Project Window. You can compile and run this Applet; if all is well you see something like the screen below:

Your window may look a little different depending upon such things as operating system and screen resolution.

Writing a simple IBIO Console Class

We include this for those who wish to try out the IBIO Classes. It is perfectly possible to learn programming using these Classes but we happen to think GUI's are a bit more fun.

Start Bluej and start a new project.
Add a new Class to your project; select the IBIO Class button, call the Class TheAnswer (or a name of your own choosing - by convention Class names start with a capital letter).
You should now be able to see the code by double-clicking the new Class name in the BlueJ Project Window. You can compile and run this Class (select the main() option); if all is well you see something like the screen below:

The answer to Life, The Universe and Everything, of course...

see The Hitch Hikers Guide to the Galaxy - A Trilogy in Five Parts by Douglas Adams.

Related: [ Java Home | previous:what's programming? | next:PressMe.Java ]

Click this link for the console class using IBIO.



There's more on JETS and console-style programming in the book:

 
The site is partly financed by advertising revenue, partly by online teaching activities and partly by donations. If you or your organisation feel these resouces have been useful to you, please consider a donation, $9.95 is suggested. Please report any issues with the site, such as broken links, via the feedback page, thanks.

Questions or problems related to this web site should be addressed to Richard Jones who asserts his right to be identified as the author and owner of these materials - unless otherwise indicated. Please feel free to use the material presented here and to create links to it for non-commercial purposes; an acknowledgement of the source is required by the Creative Commons licence. Use of materials from this site is conditional upon your having read the additional terms of use on the about page and the Creative Commons Licence. View privacy policy.

Creative Commons License


This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License. © 2001 - 2009 Richard Jones, PO BOX 246, Cambridge, New Zealand;
This page was last modified: May 31, 2009