Forum: Java Oct 9th, 2009 |
| Replies: 9 Views: 351 Glad you got it working. Consider this. To test whether a million is prime, how high do I need to test? Currently you test up to half of one million, but you really only need to test up to the... |
Forum: Java Oct 8th, 2009 |
| Replies: 2 Views: 248 Sounds like there is a lot of math involved. If you refer to a theorem, you should link it:
http://en.wikipedia.org/wiki/Separating_axis_theorem
Is this a math problem or a problem with the... |
Forum: Java Sep 24th, 2009 |
| Replies: 1 Views: 433 You have two separate problems. Approach them separately and independently:
Get good input from user.
Draw rectangle based on that input.
Part 1 - You must ask the user for input. You... |
Forum: Java Sep 16th, 2009 |
| Replies: 3 Views: 368 It's been a while for me, but I imagine NumberFormat might be helpful, as well as printf from the Console class.
http://java.sun.com/docs/books/tutorial/i18n/format/numberintro.html... |
Forum: Java Sep 15th, 2009 |
| Replies: 3 Views: 279 You have no System.out.println statements in either the functions themselves or the calling statements. You create the String you want to display to the screen, but never display the String. Since... |
Forum: Java Sep 8th, 2009 |
| Replies: 2 Views: 616 This is a perfect candidate for a 4 x 4 GridLayout.
http://java.sun.com/docs/books/tutorial/uiswing/layout/grid.html
http://java.sun.com/javase/6/docs/api/java/awt/GridLayout.html |
Forum: Java Sep 5th, 2009 |
| Replies: 2 Views: 402 private static int ageCalc(int mm, int dd, int yyyy){
// code
birthDate.set(yyyy, mm, dd);
I'd have to see the function call, but if you are doing this:
ageCalc (9, 3, 1991) |
Forum: Java Aug 31st, 2009 |
| Replies: 4 Views: 454 I can't imagine that these two lines in red are doing anything good:
void display(String string) {
phrase = string;
pan.display(phrase);
add(pan);
repaint();
} |
Forum: Java Aug 15th, 2009 |
| Replies: 4 Views: 221 Comment 1 - Have a README. You have batch file to run the program, but no README to tell you to run the batch file and to say what is inside the batch file. People have (hopefully by now) been... |
Forum: Java Jul 31st, 2009 |
| Replies: 10 Views: 397 It's no longer just a sorting issue, it's a storage/access issue which must be solved before the sorting issue is touched. Put this program aside and start a much smaller program. The one you have... |
Forum: Java Jul 30th, 2009 |
| Replies: 3 Views: 187 Yes, definitely read the stickies regarding code tags and the rest of the rules. I explained code tags on two of your previous threads. Here, for the final time, is how to use them.
// Paste... |
Forum: Java Jul 27th, 2009 |
| Replies: 9 Views: 744 http://java.sun.com/docs/codeconv/html/CodeConventions.doc8.html
StringConcatenate1 is not a good name for the object. stringConcatenate1 would be better. See the link on conventions. Whether... |
Forum: Java Jul 15th, 2009 |
| Replies: 2 Views: 226 You aren't getting help because you aren't showing effort yet. It's the policy on this forum (and just about all forums) that posters must show something in their post to show that they have... |
Forum: Java Jun 20th, 2009 |
| Replies: 2 Views: 579 Typo in line 24?
public void painComponent(Graphics g) |
Forum: Java Jun 11th, 2009 |
| Replies: 7 Views: 2,445 I've never written an application installer, so I have no clue what that involves. How about, instead of a game, write a physics tutorial that shows balls colliding when you have certain balls of... |
Forum: Java Jun 8th, 2009 |
| Replies: 7 Views: 1,036 I don't see any mistake either. This compiled and ran perfectly for me. |
Forum: Java Jun 7th, 2009 |
| Replies: 11 Views: 909 You need an instance of WinLsnrExp to use the a variable. You don't have one when you are trying to use a in main. a is not a static variable. main is a static function. Google "java static... |
Forum: Java Jun 5th, 2009 |
| Replies: 2 Views: 565 Use the ! operator.
boolean a = true;
System.out.println (Boolean.toString(a)); // true
a = !a;
System.out.println (Boolean.toString(a)); // false |
Forum: Java May 29th, 2009 |
| Replies: 3 Views: 440 You said you had already selected the method and that it was Dijkstra's Method. Also, how can you not consider all the nodes? If you have 1000 nodes and you only look at 999 of them, how do you... |
Forum: Java May 25th, 2009 |
| Replies: 3 Views: 218 JButton j[] = new JButton[s.length];
for(int i=0;i<s.length;i++)
j[i].setText(s[i]);
Line 1 creates the ARRAY of JButtons. It does not create any new JButton objects,... |
Forum: Java May 25th, 2009 |
| Replies: 12 Views: 470 Best guess, and it's only a guess, is that in the DungeonMaze.setTraps function, you are "rerolling" because you have some collision (i.e. a trap is picked randomly to be at the same spot as another... |
Forum: Java May 21st, 2009 |
| Replies: 30 Views: 1,811 ???????
You had it fine before. It is randomly assigning things and it's not all false or all true. If you fix printBoard, you should be OK. You may or may not have problems going from one... |
Forum: Java May 6th, 2009 |
| Replies: 12 Views: 523 Break it up into two pieces (horizontal distance and vertical distance). To calculate vertical distance, there are three possibilities:
1. Rectangle 1 and rectangle 2 overlap vertically (i.e. top... |
Forum: Java Apr 27th, 2009 |
| Replies: 2 Views: 227 I could have missed it, but I don't see anything like this in your path above (path, not classpath):
In Windows XP, go into Control Panel -> System -> Advanced -> Environment Variables ->... |
Forum: Java Apr 24th, 2009 |
| Replies: 27 Views: 1,206 For the first problem, if the MySurvey class (I don't know what MySurveyPanel class is) is the way I suggested, as below:
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;... |
Forum: Java Apr 22nd, 2009 |
| Replies: 27 Views: 1,206 First, let's look at your MySurvey class:
public class MySurvey extends JFrame
{
private JPanel CenterPanel = new JPanel();
private JPanel QuestionPanel = new JPanel();
private JPanel... |
Forum: Java Apr 20th, 2009 |
| Replies: 2 Views: 617 public void paintComponent( Graphics g)
{
super.paintComponent (g);
for ( int count = 0; count < rectangle.length; count++)
{
//This is the area where i need help
... |
Forum: Java Apr 20th, 2009 |
| Replies: 2 Views: 315 Are you talking about the code itself or the clue that a poster is going to be a nightmare to help? In either case, aside from what you mention, a lack of commenting is a good clue. I'm glad you... |
Forum: Java Apr 18th, 2009 |
| Replies: 5 Views: 1,338 Finding the roots of a cubic equation isn't trivial. See this wikipedia link and scroll down for a discussion and links to finding roots.
http://en.wikipedia.org/wiki/Cubic_equation
I... |
Forum: Java Mar 19th, 2009 |
| Replies: 2 Views: 508 Thank you for using code tags! Please point out the line that is giving you the error (you can highlight it in red or just tell us what line to look for). |
Forum: Java Mar 18th, 2009 |
| Replies: 8 Views: 491 Well, you have way too may balls going way too fast to do any real checking, so I changed your Input class to ignore the file and set up two balls:
public class Input {
public static void... |
Forum: Java Mar 11th, 2009 |
| Replies: 8 Views: 855 I like verruckt24's idea. You have an image and certain parts of that image represent different "sections" (i.e. $10 bet section, $50 bet section, etc.). You need to have a mapping from the (x,y)... |
Forum: Java Feb 8th, 2009 |
| Replies: 9 Views: 893 I don't know what line 66 is, but it looks like it may be different from what h3xc0de's line 66 was? You may want to repost your updated code and highlight the line that gave you the error.
I... |
Forum: Java Jan 10th, 2009 |
| Replies: 3 Views: 522 The second parameter is the ending index of the substring (exclusive), not the number of characters in the substring.
If you want single character substrings, you can do this:
number1 =... |
Forum: Java Dec 9th, 2008 |
| Replies: 5 Views: 925 I want a new car. With any luck, Santa Claus will help us both out. If you want help BEFORE Christmas, though, you are going to have to be more specific and show some effort. |
Forum: Java Dec 9th, 2008 |
| Replies: 10 Views: 1,195 I try not to be a brick wall, but sometimes I fail :) I am most brick-wallish when I try to make Java behave like C++ and pass by reference. At least this time I'm not because the advice makes sense... |
Forum: Java Nov 12th, 2008 |
| Replies: 8 Views: 428 Mark your other thread solved please.
ArrayList<ArrayList<String>> matrix = new ArrayList<ArrayList<String>>();
matrix.get(i).add(line); |
Forum: Java Nov 8th, 2008 |
| Replies: 10 Views: 884 Try Java SE. Download JDK 6 Update 10 with NetBeans 6.1
http://java.sun.com/javase/downloads/index.jsp
The IDE is just personal preference. It's all free. You need to have a JDK installed. ... |
Forum: Java Sep 29th, 2008 |
| Replies: 4 Views: 593 t = new MyForm ();
Oh, I see, that line is inside your MyForm () constructor, so it's an infinite recursive call to your constructor. Every new object makes a new object so there is no... |
Forum: Java Sep 23rd, 2008 |
| Replies: 5 Views: 617 Create five variables, all integers. Have a variable called year that stores 1998. Have four more variables: thousands, hundreds, tens, ones. If year = 1998, use the / and % operators to put the... |