3,927 Posted Topics

Member Avatar for jackskell26

Yes, EatDot() needs to be called before repaint() in your KeyAdapter to evaluate if a dot is eaten. Also, your collision function in EatDot() needs to check the absolute value of the coordinate differences[code]if ((Math.abs(xcoords - dot[i].x) <= 5) && ((Math.abs(ycoords - dot[i].y) <=5)) && !dot[i].isEaten()) {[/code] and lastly you …

Member Avatar for jackskell26
0
127
Member Avatar for snitch321

Erm, that method does not do anything at all and this declaration doesn't really make any sense[code]private slowMoveVertical balloon;[/code] Your slowMoveVertical() needs to move all of the drawn objects up by a certain distance.

Member Avatar for Ezzaral
0
128
Member Avatar for naps

[QUOTE=naps;485855]I am a final year student and thinking of a project topic to do. Any suggetion?[/QUOTE] Track fish... some kind of fish... maybe gather and analyze some kind of stats on something they do... That's really all that comes to mind.

Member Avatar for masijade
0
82
Member Avatar for tactfulsaint

Date is actually deprecated and should be replaced with Calendar[code] java.util.Calendar now = java.util.Calendar.getInstance(); String currentTime= java.text.SimpleDateFormat.getInstance().format(now.getTime());[/code]

Member Avatar for tactfulsaint
0
157
Member Avatar for mickinator

[QUOTE=masijade;477486]I didn't know about this (I must be blind or something ;-) ). But, sad, just sad.[/QUOTE] You didn't see it because it happened in a thread in the Geeks Lounge and whatever disagreements or rep slinging that happen there have no business in the technical forms.

Member Avatar for mickinator
0
284
Member Avatar for ivabigun

Because that is what you have for an increment statement [icode]i+=key.length[/icode] in your loop.

Member Avatar for ivabigun
0
102
Member Avatar for Jezarel

Take a look through this regarding using a Calendar: [url]http://mindprod.com/jgloss/calendar.html[/url]

Member Avatar for adpeate
0
142
Member Avatar for slayer10

And btnA2 is not displaying "pic"? Or are you expecting btnA1 to no longer show that pic as well?

Member Avatar for Ezzaral
0
137
Member Avatar for Jezarel

Parsing them into valid dates as masijade mentioned is really best, but if you have simple date strings like "12/01/2006", you could use the String split() function to put them in year-month-day form "20031201" for integer sorting[code]String date = "12/10/2006"; String[] datePieces = date.split("/"); String rebuiltDate = datePieces[2]+datePieces[0]+datePieces[1]; System.out.println(rebuiltDate);[/code] If …

Member Avatar for Ezzaral
0
74
Member Avatar for newbieGirl

Since your method already has the number of rolls, you're all set to calc the percentage. You do have to watch out for the integer division though or you'll get 0 for every one of them[code](dCount[index]/(float)numRolls)*100f[/code]

Member Avatar for newbieGirl
0
122
Member Avatar for newbieGirl

That's why the compiler gives you those handy messages when there are problems :) What do they say?

Member Avatar for Black Box
0
95
Member Avatar for Acidburn

Your IDE is most likely treating it's project root directory as the root context when it executes. If you are clicking on a jar in the dist folder, that is most likely the root context. Try dropping a copy of your images directory into the dist folder. If it runs …

Member Avatar for Black Box
0
109
Member Avatar for lookof2day

What are you using for logging currently? You might take a look at [url]http://java.sun.com/javase/6/docs/api/java/util/logging/package-summary.html[/url] or Log4J.

Member Avatar for ~s.o.s~
0
158
Member Avatar for slayer10

[code]JToggleButton[][] buttons = new JToggleButton[5][5];[/code] That just declares the type and dimensions. You still have to set each element equal to a new instance of JToggleButton.

Member Avatar for slayer10
0
289
Member Avatar for dabronx1671

And that is a method you are trying to declare or is it a variable you are declaring? Either way it looks to be an invalid statement. Is that the entire line of code?

Member Avatar for Ezzaral
0
73
Member Avatar for Jicky
Member Avatar for kdelorme2005

You will need to start this on your own. If you run into difficulties, post the code you are having problems with, the exact error messages, and specific questions about the problem.

Member Avatar for masijade
0
68
Member Avatar for thanaras

You may be able to get the 0-255 grayscale value like this[code]int grayVal = ((int) sample2[0]) & 0xff;[/code] (I haven't worked with it myself, but some reading suggests that might work for you.)

Member Avatar for Ezzaral
0
125
Member Avatar for rickster11

You are correct - you're overwriting the file on each invocation of detailLine. To fix that, you could make the output file a class-level variable or pass a reference to it as a parameter. Either way, do not open or close the file in that method - just write the …

Member Avatar for Ezzaral
0
142
Member Avatar for claudiu_is

It depends on how you need to access the data, but I would imagine the simple file would suffice. You don't mention what the data is, but basically you have the equivalent of a single table. With file-based storage you will need to write the methods yourself if you want …

Member Avatar for Ezzaral
0
154
Member Avatar for Dio1080

Yes, moving your console app over to a Swing component isn't just a matter of stuffing the output into a message box. Message boxes don't work like the console at all. You will need to work with frames/panels and either arrays of components or custom 2D painting with mouse listeners. …

Member Avatar for Ezzaral
0
131
Member Avatar for hemanth.balaji

Well, for one thing, don't set all of those constraint properties in the constructor. How are you going to read and make sense of that parameter string as you try to make adjustments? Set the constraint properties individually. You can use a single GridBagContstraint object and vary the properties only …

Member Avatar for Ezzaral
0
139
Member Avatar for Aprilia

[quote=Aprilia;465253]Hi all, i'm new so not sure if this is the right place or not. [/quote] No, it's not. Look somewhere else to learn how to program cheats and exploits. I won't say good luck - I hope you fail miserably.

Member Avatar for MattEvans
0
189
Member Avatar for cga2

This site has source for several games in Java. Perhaps something there will help get you started. [url]http://www.codebeach.com/index.asp?tabID=1&categoryID=4&subcategoryID=11[/url]

Member Avatar for Black Box
0
139
Member Avatar for paradox814

The question still makes no sense. You can't generically pass a primitive as a parameter, so you would need separate signature for each anyway, which alleviates the ambiguity.

Member Avatar for jwenting
0
175
Member Avatar for speterson

Perhaps your SalaryGenerator should take the current salary as a parameter and add a random amount to it, a randomRaise() perhaps.

Member Avatar for Ezzaral
0
356
Member Avatar for Dio1080

Just keep two int counters. Why do anything more complicated? There will never be more than two players in the game. If there were more than two, you could keep their scores in an array, a HashMap, or most any collection.

Member Avatar for Ezzaral
0
82
Member Avatar for degamer106

It sounds like you mostly understand how compareTo(Object o) works. Your job is to compare the specific properties of the objects in your if() statements such that you return the proper int value. If you need to compare on some property value, say object.cost() for example, you write the if() …

Member Avatar for degamer106
0
86
Member Avatar for piers

You are merely scanning all the words and incrementing the position, but you don't do anything when you get to the position where the insertion is to take place. The for loop is just printing the last word found by the scanner "number of words" times. You are also returning …

Member Avatar for iamthwee
0
99
Member Avatar for sneekula

"A Christmas Story" [url]http://en.wikipedia.org/wiki/A_Christmas_Story_%281983_film%29[/url] "Bad Santa" was pretty good as well.

Member Avatar for vegaseat
0
166
Member Avatar for shipar

[QUOTE=shipar;481569]:-( is this a forum only for experts? [/QUOTE] No, not at all. You asked an incredibly general question and jwenting gave you a general answer. If you need specific answers you need to ask more specific questions.

Member Avatar for shipar
0
111
Member Avatar for The Dude

Other: "Heavy Metal" [url]http://en.wikipedia.org/wiki/Heavy_Metal_%28film%29[/url] The listed choices were pretty lame :P

Member Avatar for MidiMagic
0
91
Member Avatar for Java-Newbie

Scanner has a hasNextInt() method that will tell you if the input can be read as an int (also has method to test for float if needed). If that returns false you can just consume the input and re-try.

Member Avatar for jwenting
0
154
Member Avatar for newbieGirl

Don't forget about your friend the mod operator as well:[code=java] for (int i=0; i < 5; i++) { for (int k=0; k < 5; k++) { System.out.print((i+k)%5 + 1); } System.out.println(""); }[/code] :)

Member Avatar for Black Box
0
661
Member Avatar for degamer106

A counter of the incorrect entries would be easier. What if you decided to allow for three incorrect entries instead of two? Another try block with identical code would be needed. In most all cases, duplicate code blocks should suggest to you that something could be arranged more efficiently.

Member Avatar for degamer106
0
198
Member Avatar for newbieGirl

Just an unrelated side suggestion: Always go ahead and use braces with your for() and if() blocks, even if they execute a single statement. Yes, it is unnecessary, but you will save yourself a lot of debugging headaches when one day you add another statement to block and can't figure …

Member Avatar for Ezzaral
0
86
Member Avatar for akhiero

You will first need to work up something on it for yourself. If you run into problems, then post that code and specific questions about it.

Member Avatar for Ezzaral
0
203
Member Avatar for use4d

> Are you aware that, before the telephone, "hello" was a Norse war cry and sort of a mild swear word? Can't seem to find any mention of this elsewhere. Are you making things up again? :)

Member Avatar for jasimp
0
436
Member Avatar for ariswin

[QUOTE=ithelp;474202]I agree with you. Why the scientists are not trying to solve the basic problem of food , like getting it from air , then we would not require money at all.[/QUOTE] I'm not sure you are getting enough air yourself....

Member Avatar for Jicky
-2
292
Member Avatar for Sturm

>Apparently American blacks are now feeling insulted by the word "black", irrespective of when it's used. Actually, it seems to me that "Black" is becoming accepted usage again after years of "African American" being the only term acceptable to the PC wonks. :icon_rolleyes:

Member Avatar for rectifier
0
488
Member Avatar for mrsmoke

You might want to go through the Space Invaders 2D game tutorial on this site: [url]http://www.cokeandcode.com/[/url]

Member Avatar for schoolsoluction
0
119
Member Avatar for rickster11

[QUOTE=Black Box;480345]By giving your arrays to that method, you give them a local copy of the arrays. This means that what ever you do inside that method, happens to the copy. In orde to get the result back into your initial arrays, you need to let your methods return the …

Member Avatar for rickster11
0
755
Member Avatar for Cornflower

"Cannot find symbol" means you are using a class, method, or variable that hasn't been defined. In this case, you are calling "hprintln()", which doesn't exist in that file.

Member Avatar for Cornflower
0
119
Member Avatar for gjancarik

A 2D array doesn't have a method called empty(), which is what you are trying to call here[icode]a.empty(row,column)[/icode]. You don't show your empty() method, but if it already operates on an instance level array variable, just call[icode]emtpy(row,column)[/icode]. If you need that method to work against different arrays when called, you …

Member Avatar for Ezzaral
0
70
Member Avatar for thanaras

Try these: # [url]http://www.rob.cs.tu-bs.de/content/04-teaching/06-interactive/Hough.html[/url] - Java Applet + Source for learning the Hough transformation in slope-intercept form # [url]http://www.rob.cs.tu-bs.de/content/04-teaching/06-interactive/HNF.html[/url] - Java Applet + Source for learning the Hough-Transformation in normal form

Member Avatar for Ezzaral
0
77
Member Avatar for nuch1311

Please use code tags around your code to preserve formatting, and.... what is the question?

Member Avatar for eranga262154
0
86
Member Avatar for outdatedtech

[QUOTE=outdatedtech;474076]That's what I see this time of year. [/QUOTE]So what. Christ has been co-opted for pushing things onto people since inception. Nothing new to see here really. [QUOTE=outdatedtech;474076]That and the Walton kids getting richer.[/QUOTE]And it makes you angry that they are making a lot of money? Well, so are a …

Member Avatar for MidiMagic
0
171
Member Avatar for Corum

Think of using the stack as a place to put something to be processed later by your algorithm as opposed to recursion being used to process it right now. From your starting position, examine whatever you need to check. If it meets the criteria, push it onto the stack instead …

Member Avatar for Ezzaral
0
86
Member Avatar for moppi

[quote=moppi;455018]I AM MOPPI PC TECHNICIAN AND HERE TO SHARE SOME OF THE PROBLEMS I FACE IN THIS AS FAR AS LAPTOPS ARE CONCERN.i HAVE A COMPAQ ARMADA M700 LAPTOP WITH ME WHICH ONLY THE BATTERY, POWER KEEP ON BLINKING BUT NOT SWITCHING ALSO, THE NUMLOCK INDICATORS AND ARE ON AS …

Member Avatar for ashikkalam123
0
135
Member Avatar for The Dude
Member Avatar for sneekula
0
115

The End.