Search Results

Showing results 1 to 40 of 83
Search took 0.02 seconds.
Search: Posts Made By: darkagn ; Forum: Java and child forums
Forum: Java 29 Days Ago
Replies: 3
Views: 592
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 29 Days Ago
Replies: 7
Views: 321
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 Oct 10th, 2009
Replies: 2
Views: 371
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 Jun 10th, 2009
Replies: 2
Views: 174
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: 478
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,682
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 11th, 2009
Replies: 9
Views: 856
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: 9
Views: 856
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: 9
Views: 856
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 Mar 25th, 2009
Replies: 14
Solved: making a class
Views: 523
Posted By darkagn
Ok, I can see you are trying, I will show you what I would do for your add methods, then you can write the minus methods.

public static Money add(Money m1, Money m2)
{
int dollars1 =...
Forum: Java Mar 25th, 2009
Replies: 14
Solved: making a class
Views: 523
Posted By darkagn
That looks ok, except that the add2 and minus2 methods should not return anything (ie void instead of int). Yes, you need to put something in your add and minus methods, but you need to figure out...
Forum: Java Mar 24th, 2009
Replies: 14
Solved: making a class
Views: 523
Posted By darkagn
No, it is your constructor with two parameters. You call it by saying new.

EDIT: Your constructor methods look ok, by the way. You just need to change your add and minus methods.
Forum: Java Mar 24th, 2009
Replies: 14
Solved: making a class
Views: 523
Posted By darkagn
Please use code tags when posting your code.

You have missed the point of my last post. You don't pass in two ints to your static add method, you pass in two objects of type Money, each of whom...
Forum: Java Mar 24th, 2009
Replies: 14
Solved: making a class
Views: 523
Posted By darkagn
Hint: Your method signature for the add method should look like this:

public static Money add(Money m3, Money m4)

The method should add the dollars and cents of each Money object and return...
Forum: Java Mar 23rd, 2009
Replies: 7
Views: 347
Posted By darkagn
Ah, ok, you need to move your calcarea method inside the class.

EDIT: No wait, it is inside the class. This exception is usually raised when you miss closing a bracket or brace or miss a...
Forum: Java Mar 23rd, 2009
Replies: 7
Views: 347
Posted By darkagn
Which line is line 36 of your file?
Forum: Java Mar 23rd, 2009
Replies: 7
Views: 347
Posted By darkagn
area = (radius * 3.14)^2;

Two things: first, the area of a circle is PI * r^2 not (r * PI)^2. Secondly, the java compiler doesn't recognise the ^. You need to use the Math.pow method to raise...
Forum: Java Mar 20th, 2009
Replies: 3
Views: 912
Posted By darkagn
Is your chat window in Java? If so is your GUI written in swing or awt? Perhaps some code to describe how you construct your window would help...
Forum: Java Mar 10th, 2009
Replies: 2
Views: 494
Posted By darkagn
I think those methods belong in the Box class itself. For example,


private class Box {
private double length = 0.0;
private double width = 0.0;
private double height = 0.0;...
Forum: Java Jan 22nd, 2009
Replies: 6
Views: 390
Posted By darkagn
This sounds like sorting an array rather than a queue. As you said, queues work on the FIFO format, so you can't sort a queue since you will lose track of which one should be removed next. Are you...
Forum: Java Dec 6th, 2008
Replies: 7
Views: 1,446
Posted By darkagn
I think StringBuffer might be the other String__ class you were referring to. Both the StringBuilder and StringBuffer class are better at concatenation than the base String class. StringBuilder will...
Forum: Java Dec 6th, 2008
Replies: 5
Solved: java ping
Views: 1,712
Posted By darkagn
As an aside, if you want to limit people to only use one instance of your class in an application, you can do something like this:


public class myClass {

private static myClass instance =...
Forum: Java Dec 6th, 2008
Replies: 5
Solved: java ping
Views: 1,712
Posted By darkagn
You need to use the static getRuntime() method in order to instantiate the Runtime object.
Forum: Java Dec 6th, 2008
Replies: 5
Solved: java ping
Views: 1,712
Posted By darkagn
Take a look at the Runtime class. You can use its exec method to run a ping and the resulting Process has methods to allow you to obtain the I/O/E streams. This allows you to interpret the results of...
Forum: Java Nov 13th, 2008
Replies: 4
Views: 427
Posted By darkagn
Should zipCode belong to the Individual class or the IndividualArray class? I think it is a value relating to the Individual, not the list of Individuals.
Forum: Java Nov 13th, 2008
Replies: 4
Views: 427
Posted By darkagn
The problem here is that you can't see the fName parameter from the toString() method. This is because fName belongs to the Individual class, not the IndividualArray class. I think that you should...
Forum: Java Oct 26th, 2008
Replies: 9
Views: 1,859
Posted By darkagn
Take a look at the Java API (http://java.sun.com/javase/6/docs/api/) in the Applet class. You will also need to embed the applet in an HTML page, but it has been so long since I have done that I am...
Forum: Java Oct 26th, 2008
Replies: 9
Views: 1,859
Posted By darkagn
Yes, because the code you are trying to run is not an applet, it is just a script that prints to standard output. That's what all those lines that read System.out.println mean.
Forum: Java Oct 26th, 2008
Replies: 9
Views: 1,859
Posted By darkagn
The error in Step 2 is caused by the fact that the %JAVA_HOME%\bin directory has not been added to your PATH variable. See afzal_01's post about this. Step 3 failed only because Step 2 did also.
Forum: Java Oct 26th, 2008
Replies: 4
Views: 556
Posted By darkagn
Put all of your components that you want to group into a JPanel and set a border around it. Something like TitledBorder should suffice, although if you want to get really fancy try a CompoundBorder....
Forum: Java Oct 25th, 2008
Replies: 2
Views: 714
Posted By darkagn
Are you allowed to change the constructor signature in the second GUI? If so, probably the easiest way to achieve what you are after is to pass a reference for the original GUI in the second GUI's...
Forum: Java Oct 25th, 2008
Replies: 9
Views: 1,859
Posted By darkagn
First of all, you need to call your file "filename.java" not filename.class. When you compile the java source file a class file will be created that you can run in a Command prompt or Unix Console...
Forum: Java Oct 24th, 2008
Replies: 3
Solved: F-keys in java
Views: 444
Posted By darkagn
The KeyEvent class has constants for each of the F-keys. You can use a KeyAdapter to listen for a key press, although this is an abstract class so of course you will need to write your own extension....
Forum: Java Oct 22nd, 2008
Replies: 2
Views: 581
Posted By darkagn
When you say it's not working, are you getting an error message? Does the string "Came in" print? If the answer is no to both questions then there are no Room objects in your LinkedList. Try a call...
Forum: Java Oct 21st, 2008
Replies: 7
Views: 1,325
Posted By darkagn
Hi Shubhang and welcome to DaniWeb :)

I am sorry, but I don't understand what you are asking. Can you please post some code to show us what you mean?
Forum: Java Sep 18th, 2008
Replies: 17
Views: 1,783
Posted By darkagn
postfix = postfix + " " + (Integer.parseInt
(symbol));

This line is attempting to change the entire string to a number, not just the number part of the string. The string "4+4" is not a number,...
Forum: Java Sep 13th, 2008
Replies: 4
Solved: Two Questions
Views: 532
Posted By darkagn
Q1:

The System.exit() method terminates the Java Virtual Machine, not just a single frame.

Q2:

Not sure what you mean by this Question.
Forum: Java Sep 5th, 2008
Replies: 7
Views: 1,485
Posted By darkagn
The only time that the getByName method hasn't worked for me was when I was trying to access a computer on a different domain / network to me. I had to use the fully qualified computer name for it to...
Forum: Java Sep 4th, 2008
Replies: 7
Views: 1,485
Posted By darkagn
Hmm, the InetAddress.getByName(String) method should work. Are you using the full computer name? That is, including the network?
Forum: Java Jun 27th, 2008
Replies: 19
Views: 17,202
Posted By darkagn
Try replacing your computer name with your IP Address. You will need to create an InetAddress object using your IP and pass that object into the constructor for Socket.
Showing results 1 to 40 of 83

 


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

©2003 - 2009 DaniWeb® LLC