JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

I'm sorry - I must have been having total brain failure!
You had that right before, what I wrote was rubbish. Sorry.
(But % IS the modulo operator)

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

You don't need the + operators at the start of each expression.
The modulo opertaor is %.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

ps: I see you still have the stop() method. It's a really bad idea - you'll get unexplainable thread problems unless you remove it. Also still saying ==true - a personal pet hate of mine.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

That's good. Time to mark this as "solved".

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
while(threadcontinue) {
   String input = in.readLine().toLowerCase();
   if(input.equals("ping")) {
      ...
   } 
   else if (input.equals("pong")) { 
      threadcontinue = false;
      etc
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

You stop() before you deal with the pong. Using stop() is a bad idea. It's deprecated. Set your threadcontinue var to false to exit the run cleanly.
Anyway - if the first readline isn't ping then you do a second readline to check for pong. That's one readline to many, and the cause of your problem.
Finally
while(threadcontinue==true) {
is redundant, just use
while(threadcontinue) {

Olliepop commented: Thank you very much +0
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Yo. Loop thru the x/y coords iin a nested loop and record the first and last x and the first and last y where there is a difference. Those 4 numbers will define the smallest rectangle that contains the pixels that are different

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

I'd use the PixelGrabber class to convert the images to simple int arrays, then compare those arrays. Each int is 1 pixel , and there's no need to decode the individual rgb values.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Somebody somewhere is going to have to loop thru the pixels to find differences. Are you sure it's too time consuming? If you haven't tried it, I would not jump to conclusions about performance. You'll simply be comparing two arrays of ints in a tiny loop - that's about as fast as anything can be.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

i want to add source files that i made in another computer to my project.
i want them to be at the same folder as the project.
how do i add them to the project?
(to copy them into the folder wont help in this case..)

thx!!

Right-click the package where you want to add the files and select "import"

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

I would use JPanels to organise your window. I'd put the board into one panel, and have another panel next to it where I can place other controls using whatever layout suits me. See:
http://java.sun.com/docs/books/tutorial/uiswing/components/panel.html

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Yes.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Glad to help. Suggest you mark this thread "solved".

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

No, that defines the method but it doesn't call it. You need to change the constructor to call init(), or put it in main like this

Application_MainRunInv gui = new Application_MainRunInv();
gui.init();
gui.pack();
gui.setVisible(true);

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

I can't see where you call your init() method.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

A literal is a fixed value declared in the source code such as:
123
true
'A'
"A String"
{1,2,3}

see:
http://www.javaying.com/2006/12/whats-java-literal.html

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Sorry ramjeev, musthafa is right. "this" is the method's object.

See Java Lanmguage ref:

8.4.3.6 synchronized Methods
A synchronized method acquires a monitor (§17.1) before it executes. For a class (static) method, the monitor associated with the Class object for the method's class is used. For an instance method, the monitor associated with this (the object for which the method was invoked) is used.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

setIconImage(myIconImage) on your main JFrame.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

I have to disagree with javaAddict (yes, dangerous, I know). The Timer class is there so you don't have to build your own bomb-proof threading code. Moreover, if this is part of a Swing application, you should use the swing Timer, not the util one, because that integrates properly with the swing event handling.
Either way, just create an int counter, increment it every time you beep, and stop the timer when the counter eaches 10.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Can I tell the mouse via Java to go to coordinates x1,y1 (which might be where the Excel application lies) copy, then go to coordinates x2,y2 (say where the 3rd party database window is), then paste?

See the Java Robot class. http://java.sun.com/j2se/1.4.2/docs/api/java/awt/Robot.html It's intended for automated testing, but it will do what you just described

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

I.M.H.O.
1. Very tiny programs can go in the main(...) method, but it's far better practice to split programs up into classes and methods and just use main to get them started.
2. Declaring an array like that is absolutely fine. Just check that the following code gets the array size dynamically and does not hard-code the length (in case the declaration changes)
3. You have to declare an array with explicit size eg [12] if you are going to put the data into itr later.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

@JamesCherrill
I think this class became a deprecated class...
[EL-Prince]

On the contrary, it was new in 1.5 Very much current.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

java doesn't have any methods to know the coordinates outside the component

Have you looked at java.awt.MouseInfo ?

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Use java.awt.MouseInfo That gives you
MouseInfo.getPointerInfo().getLocation().x and
MouseInfo.getPointerInfo().getLocation().y

You can use a swing Timer ( http://java.sun.com/docs/books/tutorial/uiswing/misc/timer.html )to run a method at regular intervals.In that method use MouseInfo to get the coords, then put them in a String that you use to set the text of the JLabel.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

I want to pass all the values from a HashMap to ArrayList

HashMap has a values() method that returns a Collection of all the values.
ArrayList has a constructor that takes a Collection of values to populate the list. So all you need is a single line of code.

anilopo commented: thx! +2
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

There's too much missing code to tell - but it looks like you may be reading the two objects in two separate threads each of which opens the inputstream? If so, try reading both objects together, just like they were written. I can confirm that ArrayLists of Objects transfer via writeObject/readObject just fine (provided the contents are serialisable).
Why are you using writeUnshared rather than a normal writeObject?

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Are you sure you have seven double values in the input file?

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Yup, that looks good. I would change the name of the method to something like myWordIsNotNull.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Your logic looks OK (except you need == to test for equality, not just =), but pretty lengthy and redundant - how about:

public boolean myWordIsNull(String word) {
   return word == null;
}
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

boolean isNull = stringArg == null;

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Take a look at the InetAddress class. You can use it to parse your text into an internal-form inet address
InetAddress.getByName("10.4.23.16")
then extract it as a byte array
byte[] bytes = InetAddress.getByName("10.4.23.16").getAddress();
It will then be easy to write the comparator using those four numeric bytes (four nested tests OR bit-shift them into a single int and compare that).

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Maybe it's this:
The arg should be a [][] array - which is what the variable args contains.
The invoke method requires an array that contains all the parameters for the method being invoked. The init method has 1 parameter, so the invoke method should pass an array of 1 element, which, in turn, should be your [][] array args. Ie, you need to enclose your [][] args parameter in a new 1 element array.

devnar commented: Thanks, dude. +2
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

I'll do it for you. $50/hour, OK?

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Why are you using getName? The internal name isn't usually a user-meaningful thing.
Try using getText().

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Put a quick print statement at the start of your dealHand method so you can see if it's the listener call that's failing or the dealHand method itself. I haven't checked all the brackets and semicolons, but the way you are defining the listener is the normal way to do it.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

pps:
Rather than absolute paths that may not work from one machine to another, you can also get the paths to useful folders in a system-independent way with calls like
System.getProperty("user.home")

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Make the file name the complete path, startiung with c: or whatever.

ps: Don't forget that \ is the escape character in Java Strings - so to put a \ in the file path you need to code \\

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Where are the declarations of dob and telnumber (the instance variables, not the parameters)?

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

It's annoying, but you can't use a primitive type (int/char/boolean etc) with generics.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

quuba's suggestion is OK, it will work, but it ties the external representation of the button text to the internal functions of the code, which is not ideal as a programming technique. (What happens when you do the Japanese version?)
If you want to do this the "professional" way, all JComponents support a "Client Property" collection where you can store anything you want as a property if the component:

seats[i].putClientProperty("index", new Integer(i));
...
public void actionPerformed(ActionEvent ae){
JButton theButton = (JButton) ae.getSource();
int index = (Integer) theButton.getClientProperty("index");

What's so good about this is that you can have any number of properties, and they can be strings, URLs, Files, anything that you want to associate with the button.

javaAddict commented: It's good to learn new things +4
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Maybe the use of <E> in the iterator class is taken as a new declaration of a type, and masks the <E> that is declared for the outer class? If so, maybe you could declare the iterator class as
public class CircularListIterator<F extends E> ...

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

You use your comparator when you try to sort the array, for example

Arrays.sort(myArrayOfBankCustomers, new NameComparator());

However, you haven't implemented the Comparator interface properly. You need your method to match the name, scope, and return type EXACTLY to those defined in the Comparator, ie

public int compare(BankCustomer customerOne, BankCustomer customerTwo);


You'll probably get a warning about "raw types", but you can probably ignore that just for the moment.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Move the declaration of au outside the action performed method, because now it exists only within that method.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Are you sure?

1. i put both classes into a directory called Assignment
2. i changed the package declarations (in both files) to be "package Assignment;"
3. i changed the classpath to the absolute pathname where the source files are

1. If the second compile always fails you cannot have a second .class file to put into the directory.
2. Thay already had that. What did you change?
3. This is wrong - the classpath must point to the folder that contains the "Assignment" folder that contains the class files. It's irrelevant where you out the source files.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

It's the .class files that need to be in the Assignments dir; the source .java files' locations are irrelevant to this.
The classpath must point to the folder that contains the Assignments folder, NOT to the folder where the files are.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

How about uisng skip(<length of file> - 32) then reading 32 bytes?
ps for reading binary data you should consider FileInputStream rather than FileReader, which is optimised for characters in some defuakt character encoding.

fareast87 commented: simple but great! +1
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

package Assignment;

Your compiled class file should be in a directory called Assignment, and the directory that contains the Assignment directory should be in the classpath.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Because you have imported the packages, you can just call any of the public methods in those packages. Try it!

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

yeah, the version in line 2 fails because setHeaderValue returns null. Wouldn't it be useful if it returned "this"?
As for your second Q, no, i've no immediate ideas. Mind you, I have no idea what columns you are adding or why ...

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Have you tried setHeaderValue("..."); on your new TableColumn?