Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Also, why not just put a boolean intersects(Ball) method on the ball class itself and check for intersection with another ball that is passed as a parameter to the method?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You're checking for intersection outside both of your loops - which means they are essentially doing nothing except adding garbage collection overhead.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Maps are data structures that maintain key to value pair mappings. They are extremely powerful and flexible structures.
http://download.oracle.com/javase/tutorial/collections/interfaces/map.html

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You have specified T is an Integer in your declaration

Tree<Integer> tree = new Tree<Integer>();

so item should be an Integer as well.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Perhaps you can provide the client a small utility program they could run on their end against the new files to convert and upload the data to your server, assuming they are running a Windows OS.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

From the linked site

You can run the program in a batch mode using command line interface. Besides, it includes a DLL which you can use from your own application.

This would imply you may be able to run this as a utility from your own script and then run the result script within My
SQL to generate the data.

Perhaps you should read more closely before replying so rudely to someone who was merely offering a suggestion to solve your problem.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

This?

cellName = concat(cellName, '$The_New_Value')
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Add

try {
    $dbh = new PDO( ... );
} catch (PDOException $e) {
    echo 'Connection failed: ' . $e->getMessage();
}

just to be sure.

Curious why are you making $dbh global and also returning it from the function. That seems redundant and prone to causing some confusing behavior later.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I'm guessing that your db connection is failing. Have you verified it?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Why not ask them then? If they "helped", they should be able to tell you quite easily what it is and why they did it that way.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Actually that poster does not have any sig links. Apparently he just likes to make absolutely useless comments in other people's threads. I didn't see a single post that added any relevant value.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Are you actually using the AWT List component? JList doesn't provide methods to add ActionListener or ItemListener.

JList just uses the ListSelectionListener which behaves a bit differently.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You can set a flag while you are altering the contents of the control, such as initialized=false; and then set it to true when you are finished. Your listener can simply ignore events while you are updating the contents by checking that flag.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You should change the declaration to use Measurable instead of Quiz.

> Given that Quiz implements Measureable there should not be an error
Well, in this case he could explicitly cast the Measurable back to Quiz because he knows that is what he supplied to DataSet, but it wouldn't be a good idea. The entire point of using the interface is to deal with a certain contract of behavior without regard for the class that is implementing it.

It's more appropriate to use the interface type here.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Either populate the list before you add the listener or set a boolean flag initialized and check if (initialized) {... in your listener.

Edit: You may check to see if ListSelectionListener works better for your needs also. I wouldn't think that one would fire any event as the model is filled.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Put the same println outside the loop in paintComponent() and you'll see it's called three times by the time the screen is finished displaying itself.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You never reset yIncrement though, so after the first time paintComponent is called, possibly even before the window is completely done showing itself, it will go below 25 and never again enter that loop. paintComponent() gets called every time the component needs to be redrawn, which can be triggered by many things such as layout change, window resize, dragging another window over it, etc. The method needs to re-render the current state of the component from scratch when called, so keep that in mind when writing the code.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I understood the intent, but as a general strategy for participation I think it would be unwise for him to go looking for threads to ask more questions about points he is unclear on.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I would have to disagree with AD there. That seems to be a guaranteed recipe for derailing other people's threads.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Several things:
As mKorbel mentioned above, you need to pack() your Frame after adding the components to it.
You never start the timer in Frame.
You have an infinite loop in the Watch constructor and the timer that is updating the time never actually changes the "time" string.

I'd say you have a bit more to work on there.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

He should be able to do that directly within her Timer because the Swing Timer executes on the event dispatch thread. I don't think the invokeLater will be needed.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

No, revalidate() is for layout changes such as adding or removing components in a container. You are needing to setText() on your text field again with the updated time value.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Well, the first would simply involve creating a getTime() method on your watch class and making a Swing Timer in your frame to call getTime() and update the text field (of course that is somewhat redundant with the watch to begin with eh? :) )

The second is a standard listener or observer pattern. Once you see it you'll recognize that Java uses it quite extensively for event notification (ie MouseListener, ActionListener, etc). Here are several simple examples.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You need a mechanism for the UI to get an updated time value. You could either poll the watch on an update timer in your frame (a "pull" model) or you could register your frame as a listener or "observer" in the Watch class (a "push" model) and let Watch notify the frame via a callback method like updateTime() on your frame.

ps: You may want to chose another name for your Frame class since there is already a Frame class in the java.awt package.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

And that is what I was referring to.

How to you determine how many "hundreds" are in 123.45 (or other number)?
How many "tens"?
These are basic math operations.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Do you think people here can read your mind or see over your shoulder? Post your code and the stack trace.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Actually I'm referring to basic math to break it down to it's parts. Just think about the steps you mentally go through to write it out your self and then write the statements to gather each piece, like hundreds, tens, etc.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

... and? You now have some input to work with. What have you thought about doing with it?

How can you reduce that number to it's parts? You have to separate it before you can translate each to a string.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Post the code you have to start with. Ask specific questions about what you are having trouble with and what you have tried so far.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Java cares about capitalization.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Yes. The JList will display the string representation of the objects by calling their toString() method. If you customize that, you can display any string that you wish.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I already told you above - override toString() in your SmsMsg class to display the phone number.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

> I only want to display a list of incoming string phonenumber
JList will display the toString() result of objects in the model, so you can override toString() in your SmsMsg class to display the phone number.

As for double-clicking, you can retrieve the currently selected item with list.getSelectedValue() and cast that to SmsMsg to do anything you want with the object (ie print data from it)

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Yeah, zoom is probably the culprit there. I leave my forum listing zoomed out one step and that shifts the community center link down to the second line.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Actually both of the code "solutions" above are bad and I wouldn't recommend either one of them.

Also please note that we do not encourage just completing someone's homework for them here. Offer advice, examples, and code fragments rather than simply fixing and re-posting their code with no explanation.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

The errors are pretty clear. You can't use the variables firstName and lastName in main() if you haven't declared them.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You can only have a single layout per container, but you don't need to change your JPanel layout. I am referring to the JFrame layout.

public void setupLayout(Container pane) {
        setLayout(new BorderLayout());
...
        add(titlePanel, BorderLayout.NORTH);
...
        add(mainScroller, BorderLayout.CENTER);
...
    }
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

It's because you used the default layout in the frame, which is FlowLayout. Try BorderLayout and put the the title panel in NORTH and the mainPanel in CENTER.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

@Unhnd_Exception: I believe they may actually be Northing and Easting UTM values.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Sorry, accidentally down-checked this post - unfortunately, once you do that I don't know of a way to undo it... my bad!

Yeah, unfortunately there is no way to cancel it even on an accidental click. I voted it back up to offset :)

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

'Home' key is your friend.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Unless Class1 and Class2 are nothing more than simple data structures, the convention is to write getters that return those values rather than declaring them public. i.e. class1thing.getValue()

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I think you may be confused about variable scope. The "fees" you declared in main() is not the same variable that you are working with here

public static void displayTotal(double total)
	{
		DecimalFormat twoDigits = new DecimalFormat("$#,000.00");
		
		[B]double fees;[/B]
		double tuition;

		fees += tuition;
		
		System.out.println("The total is: "+ tuition +".");
	}

In displayTotal, you have delared a new and completely separate varialbe "fees" that is only visible within that method declaration.

Edit: Glad you got it figured.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You are supplying the total to the displayTotal(double total) method, so why are you making a separate calculation (with empty variables) for the total that you are printing out

System.out.println("The total is: "+ tuition +".");
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

The compiler just wants to make sure that your variables have been assigned a value before you use them in an expression. If you assign them a default value when you declare them, the compiler will be happy

double fees = 0;

as you noted.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You could take a look at Law of Cosines as well, if the vector method isn't working out for you. It's just another way to skin the same cat.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

It may depend on how you represented your input vectors. For that upper point on figure b that you refered to, you would need to calculate the vectors from that point of origin such that they were pointing out and down from that position using (x2-x1,y2-y1).

Here's a small spreadsheet of the results I got with that formula. I calc'd the angle between each vector pair on an irregular triangle I just made up. The total of all calculated inner angles was 180 and each one seemed to be right by visual estimation (the lower row is degrees, I forgot a label)

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

The method is Math.acos() Remember that the angle is in radians. You can use Math.toDegrees(double) to convert to degrees if you need to.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I would agree with the above suggestions to get the ImageIO.read() out of the paint() method and override paintComponent() instead of paint() unless this is an AWT Applet.

I'd also like to mention that you don't necessarily need to create another rotated instance of AffineTransform here

AffineTransform transform = (AffineTransform) (affTransform.clone());
            g2d.transform(transform.getRotateInstance(-this.getHeadingValue() / 57.29, centerX, centerY));

You should be able to simply call

g2d.rotate(-this.getHeadingValue() / 57.29, centerX, centerY)

and draw the image. Since you're restoring the original transform anyway, you can operate directly with the current transform of the graphics context.