Search Results

Showing results 1 to 40 of 380
Search took 0.05 seconds.
Search: Posts Made By: javaAddict ; Forum: Java and child forums
Forum: Java 2 Days Ago
Replies: 2
Views: 181
Posted By javaAddict
You need to have an upper limit for the channels. Declare it as a constant in the TVRemote class.

When you try to increase the channel above that limit then have channel become 1. When you try to...
Forum: Java 10 Days Ago
Replies: 9
Views: 386
Posted By javaAddict
The error is pretty obvious and has nothing to do with sql:



You are calling a method that throws an exception, and you don't catch it.
I mean why did you surround the...
Forum: Java 12 Days Ago
Replies: 15
Views: 684
Posted By javaAddict
As masijade said post what you have done so far and we will see what we can do for you.
Forum: Java 22 Days Ago
Replies: 4
Views: 338
Posted By javaAddict
for (int i = 0; i < adj2.length; i++) {
for (int j = 0; j < adj2.length; j++) {
path += adj[i][j]*adj[j][i];
}
}


The above always returns 0. If you run the code by hand you will see...
Forum: Java 24 Days Ago
Replies: 16
Views: 711
Posted By javaAddict
I agree. I prefer to write my own gui.

Surely I also use a Gui Builder but just to quickly declare and place the elements.

But most of the times I do them on my own.
It is hard to use a gui...
Forum: Java 24 Days Ago
Replies: 2
Views: 511
Posted By javaAddict
You haven't described what is your problem and what have you done so far. Don't expect us to read the entire code and see what works and what doesn't.
Also you are mixing everything up.

Forget...
Forum: Java 26 Days Ago
Replies: 2
Views: 413
Posted By javaAddict
Use a for loop, to loop through the ArrayList and print its elements instead of the System.out.println(row1)
Forum: Java 28 Days Ago
Replies: 8
Views: 459
Posted By javaAddict
I ran this:

Music [] array = new Music[3]; // array is an array and it is not null

// Its elements are so you need to initalize them
array[0] = new RockSong();
...
Forum: Java 29 Days Ago
Replies: 8
Views: 459
Posted By javaAddict
After taking a closer look at the code you don't need the casting. Since you read from the file a Music object, it doesn't matter what type of music it is:


while (true) {
Music music =...
Forum: Java 29 Days Ago
Replies: 8
Views: 459
Posted By javaAddict
Even though from your code you have figured out on your own how to use array of objects here is a small example:

Music [] array = new Music[3]; // array is an array and it is not null

// Its...
Forum: Java 30 Days Ago
Replies: 5
Views: 387
Posted By javaAddict
I don't really get the above, but I have a few corrections to add.

First, don't use the toString method of the exception. Use the getMessage to print the error.

String output2 = "Incorrect...
Forum: Java 31 Days Ago
Replies: 5
Views: 418
Posted By javaAddict
The split returns an array. And you try to cast it to ArrayList.
From the String get the String [] array using the split method.
Then loop through the array and add its elements to an ArrayList
Forum: Java 31 Days Ago
Replies: 5
Solved: Advice needed!
Views: 399
Posted By javaAddict
I think you should keep your code they way it was and return the index where the target element was found. Without increasing it by 1. In your methods you should always return indexes the way they...
Forum: Java 33 Days Ago
Replies: 4
Solved: Error in Java
Views: 320
Posted By javaAddict
You can make the method static. Like the main.
Forum: Java 33 Days Ago
Replies: 4
Solved: Error in Java
Views: 320
Posted By javaAddict
As the error says, You cannot call a non-static method inside a static method.
Forum: Java Nov 19th, 2009
Replies: 3
Views: 293
Posted By javaAddict
Check the API.

p.addActionListener(new gameinit());

The JFrame class doesn't have such method: addActionListener.
Then search the API some more to find which elements accept an ActionListener...
Forum: Java Nov 19th, 2009
Replies: 3
Views: 293
Posted By javaAddict
In order for this method to execute:

public void actionPerformed(ActionEvent e)
{
Izzy.hittable();
Izzy.movement();

if(rar == 'T')
{
System.out.print("Sky High(Grand...
Forum: Java Nov 19th, 2009
Replies: 5
Solved: Advice needed!
Views: 399
Posted By javaAddict
Well since you found the number you know one of the occurrences of the number.
Assume this:
You are looking for '3'

And you find the position of the "Red" 3. So all the others 3s will be either...
Forum: Java Nov 17th, 2009
Replies: 2
Views: 381
Posted By javaAddict
You can check the API to see if there is a way to get the data from the table.
Forum: Java Nov 17th, 2009
Replies: 7
Views: 349
Posted By javaAddict
This thread has already been solved and you added no additional information.
Also using eclipse will not solve the problem but it will make it bigger because the user will not have learned a thing...
Forum: Java Nov 16th, 2009
Replies: 7
Views: 517
Posted By javaAddict
Because you only have ONE tempPerson object. You have the same instance of it:



tempPerson.setPerson(tempName, tempAddress, tempBirthDate);

System.out.println(tempPerson.getLastName()); //...
Forum: Java Nov 16th, 2009
Replies: 4
Views: 299
Posted By javaAddict
I don't know. Have you checked the API for Treemap?
Forum: Java Nov 16th, 2009
Replies: 7
Views: 349
Posted By javaAddict
Try run it without the .class extension:
> java Hi

Then post the error that you will get :)
Forum: Java Nov 16th, 2009
Replies: 16
Solved: Append to array
Views: 1,046
Posted By javaAddict
You need to use java.util.Date, not java.sql.Date.
Forum: Java Nov 16th, 2009
Replies: 7
Views: 517
Posted By javaAddict
Yes, but you didn't say what the error is. The code seems fine. What is your problem?

Also you should post a few lines of the file you are reading.
Also check the API for the class: Scanner:...
Forum: Java Nov 15th, 2009
Replies: 14
Views: 574
Posted By javaAddict
I would suggest, before asking such questions, first to check the java API:
java API (http://java.sun.com/j2se/1.5.0/docs/api/overview-summary.html)
javax.swing...
Forum: Java Nov 15th, 2009
Replies: 14
Views: 574
Posted By javaAddict
You don't need the newPatron object. In the if statements you will only have one instance. You will not have an instance of the super class. Only of child classes. The way you have it in the if...
Forum: Java Nov 14th, 2009
Replies: 16
Solved: Append to array
Views: 1,046
Posted By javaAddict
Isn't this suppose to throw an ArrayIndexOutOfBounds Exception?:

names[names.length] = ...

names's length is 1
java.lang.ArrayIndexOutOfBoundsException: 1
Forum: Java Nov 14th, 2009
Replies: 14
Views: 574
Posted By javaAddict
Inside the actionPerformed you can try this:

private void actionPerformed(ActionEvent event) {
// assuming that you have a list globally of type Patron (the super class)

if (radioButton1...
Forum: Java Nov 13th, 2009
Replies: 4
Solved: 2D array
Views: 310
Posted By javaAddict
The phone[][] is null. That is why you are getting the exception.

And no this:

String phone[][] = { {"A", "B","C"},
{"D", "E", "F"},
{"G","H", "I"},
{"J", "K", "L"},
...
Forum: Java Nov 13th, 2009
Replies: 14
Views: 574
Posted By javaAddict
I didn't quite realize your problem but here are some suggestions.

You can have one class with all the info and you can have one field indicating what type it is. You can have if-statements that...
Forum: Java Nov 13th, 2009
Replies: 4
Solved: 2D array
Views: 310
Posted By javaAddict
We need to see more code
Forum: Java Nov 13th, 2009
Replies: 14
Views: 574
Posted By javaAddict
I am not familiar with the classes of the javax.swing you are using but my experience tells me this:

Firstly, I assume that the method you use to add the book to the list takes as argument an...
Forum: Java Nov 12th, 2009
Replies: 14
Views: 574
Posted By javaAddict
Because this:
123456789123
is not an int, it's a long.

It is a classic mistake when you try to use a big number. If you check the API you will see how big an int can be.

What value does this...
Forum: Java Nov 12th, 2009
Replies: 14
Views: 574
Posted By javaAddict
These lines are incorrect:

GetBookDetails();
newBook = new Book (IDNum, Title,Author,Publishr,CatNumPublicationYr,returnDate,BookStat,ISBN);


with the GetBookDetails you get all the date from...
Forum: Java Nov 12th, 2009
Replies: 4
Views: 259
Posted By javaAddict
If you run this code you will see that '==' doesn't work:

public static void main(String [] args) {
String s1 = new String("aa");
String s2 = new String("aa");

...
Forum: Java Nov 3rd, 2009
Replies: 2
Views: 184
Posted By javaAddict
At the validation I believe that the seconds should until 59. For the hours you 23, 59. Why not the same for seconds.

For the extract when you multiply and then do a mod, you will get 0.

123 *...
Forum: Java Oct 31st, 2009
Replies: 21
Views: 731
Posted By javaAddict
Actually I understood that the objective was to monitor how many times a word appeared.
I would suggest sth like this:

String word;
Vector linesAppeared;

And the size of the vector would be...
Forum: Java Oct 31st, 2009
Replies: 21
Views: 731
Posted By javaAddict
Vector vIf = new Vector();

....
// inside the while loop
if (line.equals("if")) {
Freq[1] = Freq[1] + 1;
vIf.add(lineCount);
}
Forum: Java Oct 31st, 2009
Replies: 19
Views: 594
Posted By javaAddict
You know very well that this is not the way to declare variables:

int firstnumber = 1,2,3,4,5,6,7,8,9,10,11,12,13;
int secondnumber = 1,2,3,4;

If you can't fix this, don't go any further.
...
Showing results 1 to 40 of 380

 


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

©2003 - 2009 DaniWeb® LLC