Ravi Kumaar

Greenhorn
+ Follow
since Mar 06, 2006
Merit badge: grant badges
For More
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 Ravi Kumaar

You can use the same function in all the threads.

Regarding synchronization : As long as you dont use any resource that is shared among the threads, you dont need to synchronize.

Why do you need the fourth thread. You can update the text area using SwingUtilities.invokeLater within the first 3 threads.
17 years ago
I am having a requirement where the elements of a list have to me maintanined in a sorted order. Each time a new element is added, it should be inserted in the appropriate sorted location. Just wondering why Java doesnt provide SortedList class in the collection framework.

I am currently using TreeMap as an alternative with my elements as keys and null as value.
17 years ago
I have read that hashCode() function of the object class returns the memory address of that object and it is recommended to implement our own hashCode in our classes for better hashing. Since every object has a unique address, the default implementation seem to provide a good hashing scheme. I am wondering why the default implementation is not the best.
18 years ago
Hi, I am building a swing GUI. I am trying to find the best approach to meet the following requirements.

The GUI has a function dropdown at the top. There are about 15 functions. When a function is selected. A panel will be shown for dataentry which has about 20 fields. For each of the 15 functions, most of these 20 fields are needed for data entry. Some of them are not needed. So based on the function selected, I have to either hide the unwanted fields or disable them.

There are 2 options :

1. Create 15 separate panels, one for each function. This will keep the code clean (without any if then else.. etc). But will duplicate a lot of code.

2. Have only one panel that caters to all 15 functions. But involves a lot of if then else. Also, I have to consider the tab-order so that focus jumps the disabled fields, etc..

Is there any clean solution for this kind of requirement. Any design pattern etc I can look at.

Regards
Ravi
18 years ago