Help coderanch get a
new server
by contributing to the fundraiser

Altaf Ahmad

Greenhorn
+ Follow
since Apr 24, 2002
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 Altaf Ahmad

I believe you'll be able to access registry values that were written by Java programs relatively easily. I read that to access the entire registry, you'll need to interface with an external C/C++ program which will have to read and provide it to you.
I believe this is because the windows registry is an operating system specific feature, and Java on its own won't let you do much that ties down code to specific operating systems.
22 years ago
Yeah, make a panel and use GridLayout (for your buttons, etc.) on it. That will get your objects in a row/column format. Then, add that panel to the East region of another container (panel? contentpane?) that has a BorderLayout. That'll make your control bar stick to the right.
Altaf
22 years ago
TableModel has a method which will take care of making cells editable or not.

JTable has a method which will let you set the selection mode:

Altaf
22 years ago
Hi Pavel,
I am having the same kind of issues these days. I have been able to locate some info. Swing controls will not refresh themselves if you make the change outside of a standard event control mechanism. If you modify it in a module that is not responding to some user event, then that code should be run in a separate thread.
Check out the swing connection for more info.
http://java.sun.com/products/jfc/tsc/articles/threads/threads1.html
22 years ago
Yes, you're right. It's run when it's elegible.
My book says that there's no guarantee that it'll be run anyway:

There are no guarantees that the objects no longer in use will be garbage collected and their finalizers executed at all. Garbage collection mihgt not even be run if the program execution does not warrant int. Thus , any memory allocated during program execution might remain allocated after program termination, unless reclaimed by the operating system or by other means.

- A Programmer's Guide to Java Certification.
So, I guess yeah, the finalize() method doesn't really tell you if the garbage collection has taken place.
22 years ago
The finalize() method will be called when garbage collection is taking place. You could put a System.out statement in your finalize() method and see when it gets called.
Altaf
22 years ago
TableColumn has a setMinWidth() method which governs the minimum width of columns. If you specify a value for the width which is less than the minimum width, then the minimum width is only as low as it'll go.
22 years ago
Nate,
It's working great now! I don't really know what caused it to change behavior though. Initially, I put sections of your code in my app and it started working after some tweaking. But when I removed it, it still worked. I took out the Runnable section, made the ListSelectionListener back into an anonymous class, but it just works now for some reason!
I'm still trying to locate what it exactly is that's making it work now!
But thanks a lot for your help! :-)
22 years ago
Thanks Nate!
I'll test the code out and put a reply back in. The values in the model are from 1 to 10 and are float values. So, I'm multiplying them by 10 ( e.g. 6.3 becomes 63) and having the progress bar have a range of 0 - 100.
I don't have to display a series of progression - just one value (like a percentage value showing how much some task had been completed at a point in time). I read that if you process some code in a loop, then only the last value will be shown in the swing control because of the event control/thread implemention. That would work fine for me since I have to display only one value, but it just wouldn't update the display at all.
Anyway, I'll try out what you wrote. Again, thanks a lot!
22 years ago
I might be wrong here, but wouldn't the URL that you specify have a "/" at the end of it, and supplying another "/" one make the complete URL contain "//." On windows systems, you access computers on the network that way. Maybe that's why it throws a security exception.
I could be way way off on this!
[ April 24, 2002: Message edited by: Altaf Ahmad ]
22 years ago
How about having a class that stores all HTML-recognized special characters? Once you extract the plain text, you can parse the text file word for word with your special characters class. If the word is a match, then that class could swap the value of the word with equivalent ascii values. The downside is that this wouldn't be very efficient since every word is being compared.
22 years ago
Hi!
I'm trying to update values in a JProgressBar based on user selection but I can't seem to get the updated values to reflect in the progress bar.
I looked up past threads and Sun's site, from which I derived that it had to be done using invokeLater(). But it doesn't work still. The value is being updated in the object, but it just doesn't update the GUI.
Here's my routine:

I'll appreciate if anybody could tell me what I'm doing wrong or where I could find relevant info! Any leads will be great!
Thanks,
Altaf
22 years ago
Hi!
I had a conceptual question about Java event handling. When we implement event handling by extending classes or implementing interfaces, we end up having a different class handling events. How, then, is it possible to work with data (objects) of the class which is generating the events?
For example, say I have a JProgressBar and a JTable as objects in a class. When a user clicks on a row in the table, the progress bar's value should reflect the new table row selection. To access both the objects, we need to work in the class containing both of them. If we extend the JTable class or implement a selection interface in a new class, then we don't have access to the progress bar any more!
I'm sure I'm missing something or trying to do it the wrong way. Could anybody explain to me where I might be taking an incorrect approach (in the language or logically)?
Thanks!
Altaf
22 years ago