-
Accessing an object from another Object
Hey Guys,
I have an tab control that dynamically generates a group of user controls. It is my goal that when a jLabel is clicked on one of those controls that it be removed from the tab control.
However, it seems that it is not possible to pass an object into another one using Java. Is there anyway I could access the upper-level control to remove this object from it's collection?
Thanks for any help!
-
to pass an object into another one
You can pass a reference to one object to code in another object several ways:
via its constructor
via a method
via a global (public static)
Can you explain the problem a bit more. These are very simple concepts.
-
Actually, after much research and trial and error I discovered that using "static" variables was the only way to do this. Java has no pass by reference, when an object is passed, it is passed with only default values. This is documented in Sun Microsystems documentation.
However, I am fairly new to Java and know the basics and not much else, though I am learning very quickly as I go along. Your help is appreciated though.
-
when an object is passed, it is passed with only default values
The values in an object are not changed to "default values" when a reference to that object is passed via a method. If you add a println() to show what is in an object just before calling a method and in the method println() the same variables that will show the values to be the same. The contents of an object is not changed.
Similar Threads
-
By ShadowKatmandu in forum ASP.NET
Replies: 0
Last Post: 10-31-2008, 03:49 PM
-
Replies: 1
Last Post: 06-07-2005, 10:55 PM
-
By twahl in forum ASP.NET
Replies: 0
Last Post: 05-27-2003, 11:12 AM
-
By Darta in forum VB Classic
Replies: 1
Last Post: 10-24-2000, 04:48 PM
-
By Sam Avella in forum VB Classic
Replies: 2
Last Post: 07-14-2000, 06:35 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|