Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!

We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Member Since 12 Jul 2009
Offline Last Active Mar 01 2014 02:11 AM

Topics I've Started

Changing color background

03 February 2013 - 10:39 PM

There is a way to do this? The white background is very irritating to the eyes when I am in a fairly dark environment (which is all the cases of myself acessing it). There is a way to use the old blue background?

Problem with arrayList

23 November 2009 - 03:40 PM

I Have this program: It creates a federation that controls a series of tournaments, which are disputed and the points should go to the players according to their position in the tournament. I use an arraylist in which the players are positioned there based in the round of the tournament in which they lose. The loser of the first quarterfinal is putted in position 0, the one that loses in the second quarterfinal in position 1, and so on until the champion in the eight position. Here is part of code of this program: (this is most of the main class)
import java.util.ArrayList;

public class Federation {
	private int tournamentNumber;
	private ArrayList <Tournament> tournamentManager = new ArrayList<Tournament>();
	public static void main(String[] args) {
		Federation federation = new Federation();	
    public void controlActivities() {
    	this.addTournament (this.createTournament("rolandGarros",200,140,90,50));
    	this.addTournament (this.createTournament("umag",30,20,15,10));
    	this.updatePontuation(this.tournamentManager.get(0).getListPositions(), 0);
    	this.updatePontuation(this.tournamentManager.get(1).getListPositions(), 1);
    private void updatePontuation(ArrayList <Player> positionList, int tournamentNumber) {
    	int points;
    	System.out.println (positionList.get(0).getPoints());
    	System.out.println (positionList.get(1).getPoints());
    	System.out.println (positionList.get(2).getPoints());
    	System.out.println (positionList.get(3).getPoints());
    	System.out.println (positionList.get(4).getPoints());
    	System.out.println (positionList.get(5).getPoints());
    	System.out.println (positionList.get(6).getPoints());
    	System.out.println (positionList.get(7).getPoints());
    	System.out.println (tournamentManager.get(0).getSemiFinalistPoints());
    	System.out.println (tournamentManager.get(1).getSemiFinalistPoints());
		points = positionList.get(0).getPoints() + this.tournamentManager.get(tournamentNumber).getQuarterFinalistPoints();
		System.out.println (positionList.get(0).getName());
		System.out.println (positionList.get(0).getPoints());
		points = positionList.get(1).getPoints() + this.tournamentManager.get(tournamentNumber).getQuarterFinalistPoints();
		System.out.println (positionList.get(1).getName());
		System.out.println (positionList.get(1).getPoints());
		points = positionList.get(2).getPoints() + this.tournamentManager.get(tournamentNumber).getQuarterFinalistPoints();
		System.out.println (positionList.get(2).getName());
		System.out.println (positionList.get(2).getPoints());
		points = positionList.get(3).getPoints() + this.tournamentManager.get(tournamentNumber).getQuarterFinalistPoints();
		System.out.println (positionList.get(3).getName());
		System.out.println (positionList.get(3).getPoints());
		points = positionList.get(4).getPoints() + this.tournamentManager.get(tournamentNumber).getSemiFinalistPoints();
		System.out.println (positionList.get(4).getName());
		System.out.println (positionList.get(4).getPoints());
		points = positionList.get(5).getPoints() + this.tournamentManager.get(tournamentNumber).getSemiFinalistPoints();
		System.out.println (positionList.get(5).getName());
		System.out.println (positionList.get(5).getPoints());
		points = positionList.get(6).getPoints() + this.tournamentManager.get(tournamentNumber).getViceChampionPoints();
		System.out.println (positionList.get(6).getName());
		System.out.println (positionList.get(6).getPoints());
		points = positionList.get(7).getPoints() + this.tournamentManager.get(tournamentNumber).getChampionPoints();
		System.out.println (positionList.get(7).getName());
		System.out.println (positionList.get(7).getPoints());

    public void addTournament(Tournament tournament) {
    	tournamentManager.add (tournament);

When I execute the first tournament, everything goes just fine, the players are putted in there as they should be and the points are distributed correctly. But when I put the code to execute the second event,
this.updatePontuation(this.tournamentManager.get(1).getListPositions(), 1); 

it simply does not sum the points that a player got from the new tournament to its old ones. This is a call to the method that updates the points of a certain player in its constructor:

And this is the method:
public void updatePoints(int points) {
		this.points = points;

In fact, the points of the old one are erased. Here is the source code from another class that deals with the positioning of a player based on whether he wins the match or nott:
                   private ArrayList <Player> positionList = new ArrayList<Player>(); 
                   Match match7 = new Match(match5.getWinner(), match6.getWinner());
		   match7.decideMatch ();
		   match7.showWinner  ();
		   this.updatePositionList (0, match7);
		   this.updatePositionList (1, match7);
	public void updatePositionList (int decide, Match match) {
		if (decide == 0)
		if (decide == 1)

I don't know why this is happening. Anyone have and idea? Thanks for the help

Problem with array list in Java

12 July 2009 - 08:32 AM

I am trying to add a bunch of objects to an arrayList and them to print the values of one of the fields of these objects through a System.out.println. Inside System.out, the arrayList uses get to obtain its object number 0, and them send the object to use a getter method of its class to obtain the value of one of its fields, the value that should be printed But then I receive: Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 at java.util.ArrayList.RangeCheck(Unknown Source) at java.util.ArrayList.get(Unknown Source) What can be? Although not related to this, there is a problem in adding lots of objects with the same name to an arrayList? I guess not, since every time I invoke the method responsible for adding the objects to the arrayList, its gonna add them to sequential positions, but I wanna be sure

How I can post code?

12 July 2009 - 07:58 AM

Normally I use
to enter code in another foruns, but here it doesnt work and I dont have any visible option to manipulate text when I post a message. What can I do?