JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

OK, I wasn't expecting anyone to draw perfect Bezier curves by hand, but my point was serious. Coordinates are just a count of units across/down, and squared paper gives you those for free. Freehand drawing gives you two things - a rough set of coordinates to use as a starting point, and an understanding of where coorinates need to be the same, or increase in a predictable pattern, or whatever.
This is just a specific case of a more general point - it's too easy to leap into program writing before you really understand the problem and its solution, and a quick paper simulation can sometimes be the fastest way to understand both.
Anyway, end of sermon.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Draw by hand on sheet of squared paper and take coords from that?

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

There's a complete re-work of the File model in the planning for Java 7 - you may find that interesting.
What I meant by "real" file system was simply that the File class relates to actual directory/file structures in an actual mounted file system on the same machine. Or more specifically, to paths within said structure. There's no guarantee that a File object's path will relate to an actual readable or writeable file, but you can assume that the path will be a valid path in a currently mounted file system.
I think this means that the current File class is exactly what you refer to as "specific class to represent a File or Directory structure" - that is all that File is, despite its misleading name. Once again, the discussions around the proposed new file IO classes really help to clarify all this.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

The reference variable ob is a ref to type A, which means it can refer to any object of type A or of any sub-type of A.
However, because it is declared as A it can only be used to access members that are defined in A, and there is no disp method in A, so its a compile error.
If you override show in B then you can call ob.show, and the implementation of show from B will be used if ob is actually a reference to a type B, but that's only because show is defined in A.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

You can use the File class wherever the "real" files are, but as soon as you have a File object for a directory that provides the list of files you can use your existing sockets to write/read the object via the socket stream. Once you have a copy of it at the far end you should be able to use its methods to peruse the file list. (But I haven't actually tried this myself!)

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

ps: If you have code that looks like this:

catch(Exception ee) {}

then what you are saying is: "if my code goes wrong I do not want to know why or where it happened. Please just stop executing and give me no help at all".
Try replacing all those with

catch(Exception ee) {
  ee.printStackTrace();
}

so you know what's happening.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Everything except variable declarations still have to be inside a method. Indent your code so you can see where methods and classes end. Your errors start immediately after the end of the init method because the following code isn't in a method.
This would have been obvious to you with proper indentation and code tags.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

I don't know if there is a special reason to use a 2d array here, but, if not, you would probably be a lot better off with a simpler approach.
For example - create a simple ArrayList of Points - you can add to it, retrieve from it, loop thru it etc very easily and with less housekeeping than an array. Some examples:

ArrayList<Point> points = new ArrayList<Point>();

public void mouseClicked(MouseEvent e) {
    points.add(e.getPoint());
}

for (Point p : points) {
  System.out.println(p);
}
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Satisfied or not, he's right. Everything except variable declarations have to be inside a method. Post your latest code, with code=java tags.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

It will look for your file in the default location - probably C:\Users\vivek,...

Sorry, this is probably wrong. Momentary confusion on my part between user.dir and user.home. Default location is the current directory at the time/place when the java/javaw command was executed. The following points still stand.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

adatapost: can you please clarify your comment "... or location of both, picture and .class file must be a same (path or directory)."?

By default the classes in the java.io package always resolve relative pathnames against the current user directory. This directory is named by the system property user.dir, and is typically the directory in which the Java virtual machine was invoked.
This is not the same as the classpath.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

It will look for your file in the default location - probably C:\Users\vivek, it's not smart enough to guess that you want the Pictures sub-dir. The only way to be sure is to specify the full absolute path when referring to a file

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

readFileApplet.class seems to be missing at runtime

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Looks like you open the output file inside the loop, so you open it again for each file you read. When you re-open it it will overwrite whatever was there before, so I expect you will only see the very last file printed to writeFile, and all the earlier ones will be lost.
If so, open the output file before going into the loop.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

What do you mean by doing a callback btw?

You start a file playing in a separate thread, but you probably want to know when it's finished. QT gives you a callback when its finished, but the syntax and the way you set that up are un-intuitive (to say the least).

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

The above code is JMF and actually works for playing an mp3. However, the quality is pretty bad, and it seems to occasionally mess up (either wrong rate or something like that).
.

That's what I found.
If the QT SDK samples don't give you enough, I can let you have a small sample class for simply playing an mp3 and doing a callback when it's finished - never intended for use outside its original context, but may be helpful.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Sorry adatapost, but I have the jmf mp3 plugin installed and working on my Windows system.
http://java.sun.com/javase/technologies/desktop/media/jmf/mp3/download.html
Jmf should be capable of doing all the stuff specified in the OP's first post, but I have found it to be erratic and unreliable. I have had really good solid results from Quicktime using the QTJava SDK from Apple under Windows.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Do you have MSN messenger or Steam Friends where I can chat with you?

Sorry, no, I don't do chat.
Also consider that people come here to learn and to contribute. By taking a topic offline we deny then that chance.
Finally, I would encourage you to start a new thread for each separate topic and give it a good descriptive name so people can find it and refer to it later. Be proud to be part of the making of a repository of problems & solutions.
regards
James
ps: glad you got the FPS thing working OK.

~s.o.s~ commented: Wise words indeed. +29
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

The forum rules are: "We only give homework help to those who show effort", so I can't just give you the code. But here's a quick pseudocode outline of the logic to get you started.

int maxFPS = 30
long nextRepaintDue = 0 // earliest time for next repaint in mSec
While  (true) {
   if (nextRepaintDue > now()) {
      // too soon to repaint, wait...
      sleep(nextRepaintDue - now())
   }
   nextRepaintDue = now() + 1000/maxFPS
   repaint()
}
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Yes, true, but it is the easiest!
You can get the time, as nearly as the machine's clock will tell via:
(new Date()).getTime(); which returns the time in milliseconds.
You can use this either to see how many mS have expired between two paints, or to count how many paints you get in a second.
I prefer the first option: just before doing each sleep use the timer to see how long it was since the previous paint, then set the sleep to enough mS to give the desired time between frames, or skip it if the time between frames is already above the desired minimum

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Easiest limiter is to set your Thread.sleep(...) to 1000/fpsMax

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Yes, easy, just open them both and read them both inside the same loop.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Check out the File class. You can use that to get a list of all the files in a directory. You can then scan the file names to see if they match your criteria. Each time you find a file with a matching name you can open a BufferedReader for that file and read in its contents into the textbox.
Once you've got all the data from all the files in your textbox you can open a PrintWriter to the readFile.txt file and print all the data to it (this will replace the previous contents).

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

How are the tw files to be combined? One after the other, alternating lines from each file, append each line from one file to the end of each line from the other, or what?

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

The file name MUST match the public class name, but the project name can be anything you want. I only use Eclipse, so I can't help with Netbeans. Sorry.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Not as far as I know.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Probability of it being an Eclipse bug is negligible. Problem is in project setup - wrong file names, wrong options etc. Start again from scratch and do it step by step according to the book. It will work if you get it right.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Works just fine for me. Run menu, run as..., java applet.
Eclipse 3.4.2, Java 1.6.14

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Sorry, no ideas at all about latest problem without actual code (and I'm off to bed now and then away, so nothing for a day or two anyway)

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

... do you think that it could be the arrayList?

Maybe - that's a part of the code I don't have. But what you say sounds credible for why the old bean info is still there.

I still think that if values[0] is OK and values[1] isn't then values has exactly 1 element. If it's returned from a split then the String being split has only 1 value. If said String comes from a readLine then... etc etc

KirkPatrick commented: Thank you for the help on this problem. Mostly thank you for your time as its a valuable resource +1
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

However each line contains the right amount of commas.

If your understanding of how your code were correct then it would work, wouldn't it? Somewhere there is a mismatch between what you think ought to happen and what really does. You need to question all your assumptions and test them one by one.
If every beanInfo contains 3 strings the the values[] array will always have 3 elements, and element [1] will never be out of bounds at that line. Add debugging prints (or use your IDE's debugger) to see what's in beanInfo when the Ex is thrown, then delve deeper to see why.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

It looks like it's reading a line that contains no commas - so the values[] array is only 1 element. Try printing the beanInfo String just before the line where the Ex is thrown

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Can't see the bolding. But a guess: are you trying to read as many lines from the file as there are in the bean?

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Here's the kind of loop you need. (I've left the detailed syntax for you to work out for yourself)

int total = 0;
for (int i = i; i < (number of rows in the table); i++ ) {
   total = total + value in cell(i, columnNumber);
}
display total in textBox;
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

JTable's getValueAt(int row, int column) method returns the value in any cell, so you can loop thru any col you like getting the values and adding them up.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

What's the problem in creating a new file? You've already got the code:

new FileOutputStream(fileName);

You can do that in your loop if fileName changes on each iteration.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

That's OK, but I think rcollins deserves thanks too!

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

In your loop keep a counter, then make a file name something like this:

String fileName = "familyname" + counter + ".parts.txt2;

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Write you own little loop thru the map printing 1 element = 1 line at a time.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

TreeMaps are held sorted by key, so if you want to see the values sorted in some other order you need to get the values as a simple collection teams.values() and then use Collections.sort to sort it using a custom comparator that compares raceTeams by their names.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

What exceptions? Where exactly?

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

It depends on why you are displaying the level - if it's to ensure the signal is loud enough, you can just pick a subset of the samples (say 10 / sec) and average them. If you're trying to avoid clipping you need to check every sample and keep the max. value (once again in maybe 10 values / second).
Check out this WikiP article http://en.wikipedia.org/wiki/VU_meter which gives links to useful data on how to scale the output and what time constants to use for different needs.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Show me the declaration of your Stack - how you declare it affects how you use it.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Easiest way to iterate thru all the objects in a Stack is like this:

for (Object o : myStack) {
  System.out.println(o);  // or whatever
}

An interface is set of public methods that a class must implement. For example, the Queue interface specifies methods called element, offer, peek, poll, remove. If a class is declared as implements Queue then it must implement all these methods exactly as defined in the Queue interface. The compiler then knows that you can call peek, poll etc on members of that class. There are a number of classes on the API that implement the Queue interface, such as LinkedList or PriorityQueue - all of these have all the Queue methods, and thus be used to hold a queue.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

(My previous post was concurrent with javaAddict's. I was referring to the OP's code, not javaAddict's)

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Despite what what you think, your code is NOT implementing dorien's algorithm. Check your second loop again.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

I've seen a web site that suggested dividing the image into a number of blocks (eg 4 x 6) and averaging the pixels in each block (thus giving, in tis case 24 numbers) that characterise the picture. More and smaller bocks = more selective.
Maybe you can find that via Gogle?

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

If the max value required is 2^31 this will fit in an int. 2^31+1 won't.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Because a Stack can contain any kind of Objects, of unlimited complexity, there's no sensible way to provide a generic "print" method that would work usefully for everything that could be in the stack. Hence all the previous advice saying that you have to loop thru all the elements in the Stack printing each element in some way that makes sense for the type of each element.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

If you post with code=java tags we may be able to see which line is line 180 where the problem happens (or maybe you can just tell us which line it is). Anyway, on the line you have either an uninitialised variable or a variable that has been set to null, probably by a previous method call that failed.