DOH! That would make sense!
Actually: I fixed the problem by casting it before i set the variable so:
double headsPercentage = 100 * ((double)totalNumberOfHeads / totalNumberOfTosses);
double...
Type: Posts; User: CameronFaust
DOH! That would make sense!
Actually: I fixed the problem by casting it before i set the variable so:
double headsPercentage = 100 * ((double)totalNumberOfHeads / totalNumberOfTosses);
double...
I cannot for the life of me figure out why headsPercentage and tailsPercentage always = 0! I've debugged step by step and totalNumberOfHead, totalNumberOfTails, and totalNumberOfTosses are never 0....
Alright I'll repost in a more suitable board. Thanks for all of the help.
Where I have specified with the points in the boxes[] array that I generated.
Would it be easier to do all of this in a separate class or in the main class?
I moved everything to the main class and still nothing.
import java.awt.*;
import javax.swing.*;
/*
* To change this template, choose Tools | Templates
* and open the template in the...
Alright I'll put it all in the main class. Ill let you know how it goes.
And thanks for all the help so far.
Yes this does make a second Form show but this isnt what I'm trying to do, nor do the labels show on the new form.
I want to make the labels appear on the first and only form.
The second JPanel is there you cannot see it because there is no border turned on.
I got rid of the second Panel and am trying to add the JLabels that are created in my second class to the main...
I'm using the JLabels with no image or text to create a 2x38 pixel black line.
horizontalLines[X].setBackground(new java.awt.Color(0, 0, 0));
...
I want it to create the labels which are used to make up the boxes. Like my white board image in my first post.
Sorry, what I meant to say was when I click the button nothing happens.
I did debug step by step:
for (int X = 1; X < 272; X++) {
//Define horizontal line X
...
So I fixed the nullPointerException, it had to do with some of the arrays.
Everything runs fine now. I can activate the method and everything goes through. Ive debugged it step by step but nothing...
Ok so no more stack overflow due to me calling the createBoxes method via a button click. But now I have a null pointer exception.
/*
* To change this template, choose Tools | Templates
*...
I know what it is doing now I just need to find out why. It keeps looping those two lines.
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/*
* jFramePlayArea.java
*
* Created on Aug 7, 2011, 5:07:11 PM
*/
Ran into something else. One moment.
Now how would I add horizontalLine[X] to jFramePlayArea?
Wow! I carelessly overlooked those lines when I changed these two lines:
horizontalLines = new JLabel[272];
verticalLines = new JLabel[272];
I originally had them all...
init:
deps-clean:
Created dir: H:\Java\JustBoxes\build
Updating property file: H:\Java\JustBoxes\build\built-clean.properties
Deleting directory H:\Java\JustBoxes\build
clean:
init:
deps-jar:...
Same deal with the following line.
679
Hello I'm Cameron and I am brand new to this forum and fairly new to Java.
I got bored and decided to make a little game for both entertainment and learning purposes. I find just diving in and...