2 Replies Latest reply: Feb 19, 2007 3:47 PM by 807599 RSS

    Accessing variable from a subclass

    807599
      I have created a Class (Class 1). And from that Class, I created 3 other Subclasses (Subclasses 1,2, and 3). Now, I have a Vector of type Class 1. Each subclass has a specific field that is know as its "selected item", as in it it the currently display selection on the screen. (It would be from a JCheckBox, JSpinner, or JComboBox.) Is there a way to create a Method in Class 1 that can access those fields depending on the "type" that it is? the Name and Type are common and accessible from the Class 1.

      I.E.
      I add a Subclass 1 item to the Vector.
      I add a Subclass 3 item to the Vector.

      Now I need to know the currently selected item of element 1 in the Vector.

      Is this possible?

      Thanks,
      Marcus.