Skantha Kandiah

Greenhorn
+ Follow
since Jan 19, 2001
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Skantha Kandiah

Thanks for the help.
Adding the getPreferredSize() method and calling the revalidate() function fixed my problem. I had to use MediaTracker to wait for the image to finish loading before calling repaint() and revalidate().
But this seems like an awful lot of work just to display an image on a JPanel. I thought some of the work will be handled automatically, like revalidation when a component changes.
Isn't there a simple way to add and remove images from a panel?
24 years ago
Hi,
I am trying to create an application that can display different images in a single frame. The main frame contains a JScrollPane that contains a JPanel. Initally there is no image on the JPanel and there are no scrollbars on the scroll pane. When I add a large image to the JPanel the scrollbars don't appear on the scroll pane. What function do I need to call for the scroll bars to appear? I tried revalidate() and it did not work.
Thanks,
SK
24 years ago
I wrote a simple program in Java to check this. Looks like the private access specifier applies to the class and not to the object... so two objects instantiated from the same class can access and modify each others private variables. Amazing!
Next time I have a similar question I will post it on the other Forum.
Thanks,
Skantha
24 years ago
In the java rule round-up game the answer to question #208:
"Can an object access a private variable of another object of the same class?"
is set to "Yes". How is that possible? Seems to me that the answer should be "No".
24 years ago