This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Five Lines of Code and have Christian Clausen on-line!
See this thread for details.
Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!

Paul Chamsay

Ranch Hand
+ Follow
since Feb 06, 2009
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Paul Chamsay

I guess for now I would have to say desktop applications.
10 years ago
I have finished studying HFJ and I'm wondering what book I should tackle next. I basically want to expand my knowledge in java and have a "working knowledge" in it and maybe contribute to open-source as well soon. I have basic knowledge in C++, VB.net, and HTML/CSS if that matters..
10 years ago
Hi,

I'm just wondering what's the difference of doing this:



as opposed to this



Are there any performance implications? Which "style" is more recommended? Thanks!
11 years ago
Ah, you're a genius Ulf, thanks a lot!

I never thought of actually creating two move objects .. I kept on thinking how to identify which thread is going to call the run() method
11 years ago
Hi Ulf, I really tried to think of some differentiating logic but I just can't figure out how the run method will know which for loop to run .. If I'm not mistaken, you were trying to tell me to do something like this where there are two threads but only one job (run method).



Any clues? I really appreciate your help.
11 years ago
Does it make sense if I do a setName() on those two threads then do something like:




Is that what you meant?
11 years ago
I have additional codes inside the for loop of Move2

Something like:



Where I switch images. Do you think I should still combine though?
11 years ago
Hi, I worked on it again tonight and this is what I have:



I'm curious about the music thread though.. Is it okay if it's like that or should a separate thread be created for it? I'm thinking that I have too many classes for a small task like this ..

Also, I would like to know if the code has good OO design? Thanks!
11 years ago
Thanks Ulf! Works great!



11 years ago
Thanks! So I got started on this.. This is what I have so far:



I can't get it to work using that way.. Any ideas why? It doesn't move at all.. Also, I'm not sure how to have 2 threads going on the same time. I'm planning to create 1 more class..

Also, is it possible to have a paint method that does something different from another paint method?
11 years ago
Hi,

First of all, I'm sorry if this is the wrong forum to post my problem. I wasn't sure if it would fit better in the threads forum or here or the beginner's ..

I have this task of animating 2 strings and one image in an Applet.

Basically what the 2 strings would do is move from left to the right of the screen and the image will move from right to left, all at the same time.

My question is, do I use 3 threads in my applet so those 2 strings and the image will move accordingly all at the same time?

Thanks!
11 years ago
Nathe, there's a better solution than going through each item in the list.

Michael explained it in his previous post:

it can be done that way, with listeners, but you would need to add a listener to each list,
in case a quantity was clicked (or make the quantity lists not selectable).

alternative, in setting their selection models the same is only 2 lines of code.



Assignment instructions if I'm not mistaken is to have the dvdlist and blueray list not selectable.

Since you're using a listener for the movieslist, listbox01.getSelectedIndex() will return the exact index of the movie selected.

See if you can improve that code to 2-3 lines without any loops.
11 years ago
Hello everyone,

Just wondering what the difference is between ImageIcon and Image?

Is ImageIcon used only for JApplets?

Thanks
11 years ago
ran into another problem ..

What I did was I passed an object of FruitStock inside FruitStockTester to FruitQuery's constructor when I initialized it.

If I'm not mistaken, since I'm passing by reference, changes in the object made inside FruitQuery class will be 'seen' by FruitStockTester.

Problem is since I passed the object to the constructor, is there anyway for other methods inside FruitQuery class to change the object?

What I did was I did something like this:



changes aren't seen by FruitStockTester .. Any help with this ?

EDIT: I understand that obj can be passed around but my program is an frame and changes to obj are supposed to be made through events ..
11 years ago