OOP – Learn Object Oriented Thinking and Programming

Last update:
2014-03-09 – 14:18

Object Oriented Programming for the Complete Beginners

Welcome at the page of the textbook which arose
under the working title
Object Oriented Programming for the Complete Beginners
(that is why you can find this subtitle in the heading).
At this page and at pages referred from there,
the accompanying programs and further materials are placed.

First of all I would like to apologize that – as everybody – I make mistakes;
and despite the book as well as the accompanying programs was checked
by around 10 persons besides me after completing,
you can find a mistake. Therefore, you should have a look at this page from time to time,
because you may find updated version of the accompanying programs.

The accompanying project generator will be always marked
by its version and the date when it was created.
You should look at the second number after the initial one
(now it is 01 –
the last four digits represent the number of the version in my
version manager, which means it increases in a leap because
the versions of books and other products are included among
the versions of the accompanying programs).

The accompanying programs are packed in the file
LOOTP_v1.03.4984_2014-10-07
(JAR = JAva Archives), which can be open and run at majority of computers.
It will enable you to enter which of the accessible projects
you want to generate. This file has roughly 600 KB,
however, all the generated projects can take almost 20 MB at the disc.

For using the project generator, you should have installed Java firstly.
If it would be correctly installed,
the double click at the JAR-file should be sufficient for opening it,
similarly as in case of other executable files.

In case you have certain program
which would declare JAR-files associated with them
(some programs for compression do it),
maybe you will not be able to run programs in JAR by simple double click.
In case your PC would refuse to open and run programs in JAR-files
by simple double click,
you can try to run them from the command line by entering
the following command:

java -jar<path-to-the-Jar-file>

In some operating systems, e.g. in Windows,
you don't have to enter the whole path to the file, but it is sufficient
only to drag the file in the file manager (e.g. Explorer
or Total Commander) and draw it into the command line window.
Then the system enters the path itself at the end of the current command line.

Using the generator is simple. The program opens the dialog
(see the following figure),
and you should enter the destination folder into the input field Destination folder.
This is the place where the generated projects should be saved
(the folder has to exist). In case you cannot copy its address and you do not want to write it,
you can press the button Browse... and
find or create the requested folder through the dialog.

Below the input field there is a list of project names which can be generated.
Select the project by clicking on it.
In case you want to choose more projects, you can use the CTRL and/or SHIFT key
which operates here in the standard way.
In case you want to choose all projects,
you can press the button Generate all atop of the window.

After entering the destination folder and the list of generated projects,
press the OK button and the required projects will be created
in the entered destination folder in a moment.

There were many people participating in producing this book,
but despite that you can find a mistake or unclear parts
in the book.
You may find unclear items not only during reading the book,
but also during working with the programs.

This section is intended for answers to your most frequent questions
including those which do not deal directly with the explained topics
but are aimed to certain connected items:
JDK downloading, accompanying programs,
BlueJ installation files, certain characteristics of BlueJ, etc.

In case it seems to you that some of the downloaded programs contain an error,
please, look at this page (the page you are reading just now),
whether you really have the latest version of the library. Maybe, someone before you found this error
and it is already changed.

In case you would have a question which is not yet answered,
send me an e-mail
with a subject starting LOOTP_Question:
I will answer you and publish here the response for all others as well.

Typical problems

Many of you had various problems because you tried to open BlueJ and programs
delivered with the textbook at older versions of Java.
Before you are sending a question, please check if you really open BlueJ
with Java 7 or later.

Another popular mistake is that the readers tried to install the program
(Java or BlueJ) into a folder with various unauthorized characters
(exclamation mark, space, …) in its path. Java already coped with the space,
but certain further characters (e.g. just the exclamation mark)
continue to make clashes, because Java uses them internally for different purpose.

Question:I have a problem immediately on page 19 as when I want to create
a new rectangle‘s instance after pressing the right mouse-button
I cannot see the described dialog with a list of constructors,
but a menu saying: Open in editor, Compile, Delete.
How can I get to the described constructor menu?

The reason is that you forgot to compile the classes at first.
In case you want to communicate with the class,
the class may not have the lower part of its rectangle in the class diagram hatched.

Question:I would like to change the diagram background color to white. How should I
do it?

You can find the command for setting the color of various parts
of the application window at the end of the BlueJ.defs file,
which is in the lib subfolder
of the folder, where BlueJ is installed.