Oliver_FF
New Member
- Joined
- Oct 15, 2006
- Messages
- 544 (0.08/day)
Processor | Intel q9400 @ stock |
---|---|
Motherboard | Lanparty P45-T2RS |
Cooling | Zalman CNPS-9500 |
Memory | 8GB OCZ PC2-6400 |
Video Card(s) | BFG Nvidia GTX285 OC |
Storage | 1TB, 500GB, 500GB |
Display(s) | 20" Samsung T200HD |
Case | Antec Mini P180 |
Audio Device(s) | Sound Blaster X-Fi Elite Pro |
Power Supply | 700w Hiper |
Software | Ubuntu x64 virtualising Vista |
Netbeans
Netbeans is a FREE java IDE that has loads of cool features (any many totally unnecessary, as with most IDE's these days).
Netbeans is available for download here:
http://download.netbeans.org/netbeans/6.1/final/
You want any bundle as long as it contains Java SE - thats Java StandardEdition
The IDE also does loads of other stuff - if you're interested you can get the giant bundle, or just the Java SE bundle. Whatever floats your boat. 
Sample Project
Ok, so i've been doing some thinking about some simple easy project thats not as boring as hell... I've come up with creating a small app that acts as like a forum. You can create users, post in threads in forums etc etc. There's plenty of scope for people to add to the project and learn new things should they want to.
Desired functionality in v1:
Creating our project
Once you've installed netbeans, open it up and go to File -> New Project.
Pick a new Java Application
I'm going to call this "TPUForumExample" and click Finish.
There's the basis for out project
The First Step
Ok, first up we're going to create a Class called "user" which will represent each person who uses our 'forum'.
Right click on the top of the tree on the left and select New -> Java Class...
In the new window, name our class "User" (with a capital U) and pick our projectname from the Package option. Click Finish.
Data types in Java
Whenever you want to store some data in Java you have to chose what data type you want to use for it. Here are some of the main data types and examples of data you put in them.
The structure of a Class
Fields:
Fields are where you store data that is relevant to the class you are working in. In our User class for example, things like the user's name, their signature, post count etc are all data items that might be Fields.
Declaring a Field:
It is good practise to declare ALL fields as PRIVATE. I'll explain what another time.
Adding Fields to our User class:
Ok, so here's a list of a few things that I think we should store about each User:
1. Their username
2. Their password
3. Their email address
4. Their signature
5. Their post count
Now, we need to decide what data types to use. Numbers 1-4 are variable length series of characters, so we will use Strings. Number 5 will be whole number values, so we will use int.
Methods:
Methods define how the objects in your program interact with eachother and themselves. You use them to pass data between objects or to process data - things like that. For out User class, we'll only be needing some very basic methods to access the data inside the User objects.
Declaring a Method:
Adding some methods to our class:
This method will simply get the username contained inside a User object.
This method takes a String parameter, and uses it to set the username of a User object.
How methods are used and how they fit together will become apparent in the next part, when we create the Post class.
The Constructor:
The constructor is basically a method that is run when you first create an Object out of a class. For now we will not bother with one (Java will default to an empty constructor if none are provided).
Next Time:
Creation of the Post class.
More data types.
Stuff...
Lots more will become apparent as soon as the second class is completed. Hopefully lightbulbs should start clicking soon
Netbeans is a FREE java IDE that has loads of cool features (any many totally unnecessary, as with most IDE's these days).
Netbeans is available for download here:
http://download.netbeans.org/netbeans/6.1/final/
You want any bundle as long as it contains Java SE - thats Java StandardEdition


Sample Project
Ok, so i've been doing some thinking about some simple easy project thats not as boring as hell... I've come up with creating a small app that acts as like a forum. You can create users, post in threads in forums etc etc. There's plenty of scope for people to add to the project and learn new things should they want to.
Desired functionality in v1:
- Be able to create a number of users
- Be able to create a number of threads
- Be able to post in threads
- Be able to view threads
Creating our project
Once you've installed netbeans, open it up and go to File -> New Project.
Pick a new Java Application
I'm going to call this "TPUForumExample" and click Finish.
There's the basis for out project

The First Step
Ok, first up we're going to create a Class called "user" which will represent each person who uses our 'forum'.
Right click on the top of the tree on the left and select New -> Java Class...
In the new window, name our class "User" (with a capital U) and pick our projectname from the Package option. Click Finish.
Data types in Java
Whenever you want to store some data in Java you have to chose what data type you want to use for it. Here are some of the main data types and examples of data you put in them.
Code:
Name | Descrption | Examples
-------------------------------------------------------------------------
String Series of characters "Oliver_FF", "The Ninj4", "Bob", "12345"
int Whole numbers 1, 56, 9990, 374362, 3434333
double Decimal numbers 56.993, 573.222, 0.001, 6666992.2
boolean True/False True, False
char Single character 'a', 'b', 'h', 'w', 'z', '1', '@'
The structure of a Class
Code:
public class [Class Name]
{
[Fields]
[Constructor]
[Methods]
}
Fields are where you store data that is relevant to the class you are working in. In our User class for example, things like the user's name, their signature, post count etc are all data items that might be Fields.
Declaring a Field:
Code:
private [type] [name];
Adding Fields to our User class:
Ok, so here's a list of a few things that I think we should store about each User:
1. Their username
2. Their password
3. Their email address
4. Their signature
5. Their post count
Now, we need to decide what data types to use. Numbers 1-4 are variable length series of characters, so we will use Strings. Number 5 will be whole number values, so we will use int.
Code:
private String userName;
private String password;
private String email;
private String signature;
private int postCount;
Methods:
Methods define how the objects in your program interact with eachother and themselves. You use them to pass data between objects or to process data - things like that. For out User class, we'll only be needing some very basic methods to access the data inside the User objects.
Declaring a Method:
Code:
[public/private] [return-type] [name]([parameters?])
{
return [data];
}
Adding some methods to our class:
Code:
public String getUserName()
{
return userName;
}
Code:
public void setUserName(String newUserName)
{
userName = newUserName;
}
How methods are used and how they fit together will become apparent in the next part, when we create the Post class.
The Constructor:
The constructor is basically a method that is run when you first create an Object out of a class. For now we will not bother with one (Java will default to an empty constructor if none are provided).
Next Time:
Creation of the Post class.
More data types.
Stuff...
Lots more will become apparent as soon as the second class is completed. Hopefully lightbulbs should start clicking soon
