I think i do,
but what i posted before does what you have asked I believe.
1 2 3 4
5 6 7 8
9 10 11 #
13 14 15 12
Enter a number: 12
The user enter the number 12. so the if statement should...
Type: Posts; User: thatguy
I think i do,
but what i posted before does what you have asked I believe.
1 2 3 4
5 6 7 8
9 10 11 #
13 14 15 12
Enter a number: 12
The user enter the number 12. so the if statement should...
public void move(int tileNumber) {
if (!isValid(tileNumber)) {
return;
}
for (int r = 0; r < boardSize; r++) {
for (int c = 0; c < boardSize;...
Here an example
you enter in 12 and the move method will switch the 12 with the empty space like so.
1 2 3 4
5 6 7 8
9 10 11 #
13 14 15 12
but if you enter 12 again it i will not...
I am building a class called TilePuzzle and it is a text base game and it looks like this.
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 #
The way I programmed the move method it looks...
Thanks again for all your help.
I really appreciate all your help, thank you.
but now when I choose a color it doesn't change the color of the circle.
class AddColor implements ActionListener {
...
I agree and that is what I did at first I put the repaint() right after the color change like this
class AddColor implements ActionListener {
@Override
...
Thank you for the help. but now i'm confused on why this works. I called repaint which calls the paintComponent method but repaint is in the paintComponent method? so how does that work?
...
I can't seem to get the circle to change color after the user picks a new color from the JColorChooser. any ideas?
package bouncer;
import java.awt.BorderLayout;
import java.awt.Color;...
OMG i'm so sorry i must of made a mistake when i was testing it. everything works fine thanks for all your help.
API parseInt: "Parses the string argument as a signed decimal integer"
I thought Integer.parseInt(candyNum[i]) would change the string to a int?
Thanks for the idea. But now i cant figure out why the numbers are still strings. any ideas
Scanner userInput = new Scanner(System.in);
ArrayList<Integer> candy = new...
I'm trying to fill an arraylist with number but I don't want the user to have to press enter after each number. I would like it if they could put all the numbers on one line separated by white space...
I'm not sure if this would even be the right forum to put this in but here it goes. I have this homework my teacher assign us a couple of days ago. I don't need help coding it but i do need help...
Thank you guys for responding but I sat down with a my pen and a sheet of paper and did the loop step by step and figured it out and yes I need to add comments. Its something I need to work on.
...
Homework question: Write a program that prompts the user to enter the diameter of the diamond and the character to use for drawing the diamond and then draws the diamond.
At the moment I just...
Solve, complete code.
package homework.pkg3part.pkg4;
import java.util.Calendar;
import java.util.GregorianCalendar;
/*
Now I'm confused about something else.
This is the right answer.
GregorianCalendar birthday = new GregorianCalendar(2012, 5, 7);
int birthdayWeekday = birthday.get(Calendar.DAY_OF_WEEK);
or ...
I think i figured it out
cal.set(year, month, dayOfMonth);
System.out.println("Date: " + cal.getTime().toString());
cal.add(Calendar.DAY_OF_MONTH, 100);
...
O.K so i tried three different things
cal.add(Calendar.DAY_OF_MONTH, 100); // nothing
cal.add(dayOfMonth, 100); // nothing
System.out.println("Add 100 days: " +...
I think I been asking the wrong question. I knew how to get the information obviously since I did it in my first post. Sorry about that. but is there a way to convert that into a "date type" where I...
Thank you. I been looking up and down GregorianCalendar and the calendar API. But i don't see anything that will get the information from my constructor.
I'm using my constructor to declare my...
Ya i looked at that also but still no luck. I don't understand if I used cal.add(dayOfMonth, 2); but i can't assign it to a variable and I can't print it out so what can i do with it. Sorry I am...
I have having trouble with a program my teacher gave me and I was wondering if someone can point me in the right direction. I have to write a program that prints the following information: The date...