Search Results

Showing results 1 to 40 of 349
Search took 0.02 seconds.
Search: Posts Made By: darkagn ; Forum: Java and child forums
Forum: Java 9 Days Ago
Replies: 3
Views: 191
Posted By darkagn
Well I thought I'd given you a pretty good outline of what you need to do. If you are after code example of how to implement a JButton's click behaviour, try this tutorial...
Forum: Java 10 Days Ago
Replies: 3
Views: 191
Posted By darkagn
The main method in a java application has the following signature:

public static void main(String[] args)

If you are a beginner I would suggest starting with something a bit simpler than a...
Forum: Java 19 Days Ago
Replies: 3
Views: 535
Posted By darkagn
Yep that works too, my example was to show you the method behind the madness :P
Forum: Java 19 Days Ago
Replies: 3
Views: 535
Posted By darkagn
Instead of:

you want to call join like so:

// build a char array containing the three characters you tried
char[] chars = new char[3];
chars[0] = 'a';
chars[1] = 'b';
chars[2] = 'c';
//...
Forum: Java 20 Days Ago
Replies: 7
Views: 290
Posted By darkagn
You type java Hi, there is no need to specify the ".class" to run your program. Also, you will need a main method in that class to run the program.
Forum: Java 23 Days Ago
Replies: 2
Views: 211
Posted By darkagn
In order to run a method that takes an array of integers and returns their sum, your method will need the following signature:

public static int sumArray(int[] anArray)

Then, instead of having...
Forum: Java 28 Days Ago
Replies: 4
Views: 241
Posted By darkagn
Yes, that looks good to me. So let's look at what you need to do for your countOneLetter method. The method signature will look like this:

public int countOneLetter(File inputFile, char...
Forum: Java 28 Days Ago
Replies: 2
Views: 167
Posted By darkagn
I believe it is possible to set a flag to generate javadoc for private/protected fields and methods. I think its -private or something like that. Google might be able to help you some more on that.
Forum: Java 29 Days Ago
Replies: 15
Views: 621
Posted By darkagn
Hi alreem,

We can only help you if you show that you have made some sort of an attempt. Do you have an algorithm or some code that you have tried? We may be able to point you in the right...
Forum: Java 29 Days Ago
Replies: 2
Views: 225
Posted By darkagn
I think if you remove the line

traverseInOrder.successor.predecessor = newNode

your algorithm will be correct. Remember, node.successor.predecessor should always equal node unless node is the...
Forum: Java 29 Days Ago
Replies: 4
Views: 265
Posted By darkagn
Hi Ballen92 and welcome to DaniWeb :)

What's the error message you get? If I had to guess on the information you've given us, I would say that the method addKeyListener is not defined for your...
Forum: Java 29 Days Ago
Replies: 4
Views: 241
Posted By darkagn
Sorry hedwards09, we can only give homework help to those that make an attempt first. Can you post what you have so far with the specific problems you are having? If you haven't started coding yet,...
Forum: Java Oct 25th, 2009
Replies: 1
Views: 708
Posted By darkagn
The line:

Criminal criminal = new Criminal(leftInput.name());

is trying to access the private variable leftInput which doesn't belong to your class. You only have access to the parameter e in...
Forum: Java Oct 24th, 2009
Replies: 2
Views: 207
Posted By darkagn
Hi bhoop and welcome to DaniWeb :)

There are tools out there that allow you to create an exe from a java application. However this defeats one of the main advantages of java, portability. You...
Forum: Java Oct 22nd, 2009
Replies: 1
Views: 182
Posted By darkagn
Your error message is telling you what has gone wrong with this line:

if (hours == 16 && minutes == 23)

Here you are trying to compare your variable hours which is a NumberDisplay object with...
Forum: Java Oct 22nd, 2009
Replies: 1
Views: 135
Posted By darkagn
Hi intet,

We only give help to those who show some effort. What have you tried so far?
Forum: Java Oct 20th, 2009
Replies: 6
Views: 458
Posted By darkagn
Hi easyb and welcome to DaniWeb :)

You don't need to use Math.pow at all. Math.pow is used to find the power of a number. I wish that banks would pay interest exponentially but unfortunately... ;)...
Forum: Java Oct 10th, 2009
Replies: 2
Views: 362
Posted By darkagn
String number = Float.toString(number);

I think what you are trying to do is convert the number n to a string yes?

What I would do is this:

String number = new Float(n).toString();


Here...
Forum: Java Oct 10th, 2009
Replies: 3
Views: 191
Posted By darkagn
Your line:

while (i<=k)

is placed before k is properly initialised. I think you need a line inserted to receive the input that you are prompting for. That is similar to your line that reads:
...
Forum: Java Oct 10th, 2009
Replies: 2
Views: 351
Posted By darkagn
Hi ankiwalia and welcome to Daniweb :)

Your SQL syntax is incorrect. Instead of this:

String query="select username and password from Registeredusers";

Try this:

String query="select...
Forum: Java Oct 6th, 2009
Replies: 5
Views: 310
Posted By darkagn
Somewhere in your code you are passing a null value when you can't. If I had to guess I would say your problem occurs somewhere near these lines of code:

URL url =...
Forum: Java Sep 14th, 2009
Replies: 2
Views: 303
Posted By darkagn
Can you post the code for your Record class? I suspect the answer might be that you need to override the Equals method, so if you haven't done that I would start there...
Forum: Java Sep 10th, 2009
Replies: 3
Views: 1,036
Posted By darkagn
In addition to what Ez has said, I would change your forever loop (that is your for(;;) ) to while(cash > 0), that way when the player runs out of cash the game is over.
Forum: Java Aug 4th, 2009
Replies: 2
Views: 578
Posted By darkagn
The GridBagLayout is possibly what you will need. However, it is possibly the most advanced of Java's standard layouts. It gives you full control over margins (Insets) which gives great control over...
Forum: Java Jun 10th, 2009
Replies: 2
Views: 172
Posted By darkagn
I believe that Object one is your observer and objects two three and four would notify it when their data changes.

So Object one is your listener, the other objects are models in the explanation...
Forum: Java May 15th, 2009
Replies: 8
Solved: Need help
Views: 471
Posted By darkagn
readData is not a public variable, so you can't access it by myInput.readData. Try this for your Input class:

class Input{
private String readData;
Input() throws Exception {
readData =...
Forum: Java Apr 22nd, 2009
Replies: 8
Views: 2,510
Posted By darkagn
The easiest way to do this is to extend JPanel and override the paintComponent method. When you override the paintComponent method, you should do the following:

public void paintComponent(...
Forum: Java Apr 21st, 2009
Replies: 1
Views: 190
Posted By darkagn
Hi mveleli and welcome to DaniWeb :)

That's exactly what we're here for. Please post any questions you have and include some of your coding attempts and we will try to help to the best of our...
Forum: Java Apr 21st, 2009
Replies: 3
Views: 259
Posted By darkagn
Sorry what was your question? It seems to have been chopped because of the lack of spaces in it...
Forum: Java Apr 20th, 2009
Replies: 1
Views: 294
Posted By darkagn
>> You can google on Math.ceil() and Math.floor(). Math.ceil(double x) rounds x up to the next largest integer-equivalent number. So Math.ceil(1.5) returns 2.0. Math.floor(double x) rounds x down to...
Forum: Java Apr 11th, 2009
Replies: 9
Views: 836
Posted By darkagn
Yes I have already mentioned that k2k can run their program as an applet. Do you know of any way that a java application (ie not an applet) can be run from an HTML link?
Forum: Java Apr 10th, 2009
Replies: 23
Views: 1,049
Posted By darkagn
Ah yes, good point. And I'm not trying to argue either, just trying to increase my understanding. Most of my recent programming has been in PHP, so just trying to keep my Java knowledge up to date....
Forum: Java Apr 10th, 2009
Replies: 9
Views: 836
Posted By darkagn
For that to work, your program must extend Applet. Also note that in Applets there is no main method, the Applet's init, start and stop methods are called instead.

There are also java servlet...
Forum: Java Apr 10th, 2009
Replies: 23
Views: 1,049
Posted By darkagn
Ok I haven't tested this, but here is what I was thinking:

public Number stackSum( Stack<Number> numbers ) {
String className = numbers.peek().getClass().getName();
if( className.equals(...
Forum: Java Apr 10th, 2009
Replies: 23
Views: 1,049
Posted By darkagn
If that is the case then I think my logic should work. If the method signature was like this:

public Number stackSum(Stack<Number> numbers)

Then I think it should be possible to have one method...
Forum: Java Apr 10th, 2009
Replies: 9
Views: 836
Posted By darkagn
You could have a hyperlink in an HTML page that links to another HTML page that contains a Java Applet. Not sure if that's what you are after though...
Forum: Java Apr 10th, 2009
Replies: 23
Views: 1,049
Posted By darkagn
So in Java you can't declare that you will return an object of type Number, but actually return an Integer or Double (since they are subclasses)? Is that correct?
Forum: Java Apr 10th, 2009
Replies: 23
Views: 1,049
Posted By darkagn
I think that if you use Number class instead of T, you can call methods such as doubleValue() and intValue(), then use the + operator and finally return either an Integer or Double. Number is an...
Forum: Java Apr 8th, 2009
Replies: 23
Views: 1,049
Posted By darkagn
Both the Integer and Double objects extend Number. So you could do the following:

public static Number sum (Stack<Number> stack) {


Note that this method will require you to check if the...
Forum: Java Apr 7th, 2009
Replies: 2
Views: 462
Posted By darkagn
Hi testing321 and welcome to DaniWeb :)

Hint 1: You can make use of certain String functions to work out the characters in the String, such as charAt(). Here...
Showing results 1 to 40 of 349

 


About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC