Link to home
Start Free TrialLog in
Avatar of CPUCentral
CPUCentral

asked on

My very own component?

Hiya everybody,

I've got a sort of component knocked together. Its sort of something like this:

Frame
   list box


In this class are functions that can be called and are already written inside here, they are only used on the list box and its contents. But I don't have a clue on anything on how to turn this into my own component. Also I don't really want a frame there if possible, just the list box by itself. The list box handles its own mouse events apart from one, which I would like to be handled by the class that creates an object of this component class.

Any help or pointers would be appreciated.
ASKER CERTIFIED SOLUTION
Avatar of FaithNoMore
FaithNoMore

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of CPUCentral
CPUCentral

ASKER

Ok I think I get what you mean, just another question...currently I have:

public class MyComponent extends java.awt.List{

However, when I use this class I also am able to access LOADS of other methods relating to the java.awt.list class that are just not needed. All I want to be available is the methods that I have defined in the class MyComponent.
I dont think its possible.  Since List is a subclass of Component, it will receive all of the Components variables and methods and will add its own methods/variables.
Check:(http://java.sun.com/j2se/1.3/docs/api/java/awt/List.html).

When you make your class a subclass of List, you will receive all of the methods.


Someone correct me if I am wrong on this.
I dont think its possible to make a subclass of another class and only inherit the variables/methods you want.  I am pretty sure you get them all no matter what

To do what you are saying, you would probably have to not extend and other class and start from scratch.  Seemslike you want to do something that is already done for you and not very OOP.