2

i have a JTabbedPane with several tabs, each of them is a class that extends JPanel, and contains a layout (textfields and labels for example). i been trying to reach the data from various tabs, but i cant figure out how to do it. my goal is to 'reach' the data from all the tabs and process it in the 'main' tab.

is there a way to do so?

mKorbel
  • 109,525
  • 20
  • 134
  • 319
Zephyer
  • 333
  • 6
  • 16

1 Answers1

1

You need to keep a reference to all the controls on the different tabs. A map of your custom JPanels would do the trick, using a tab id or name as the key and your custom component (which presumably has a getter for the data contained thereon) as the value.

Paul
  • 19,704
  • 14
  • 78
  • 96
  • Thank you for the reply. yes, i thought about doing that reference thing - but i have no idea how to do it. im abit of a beginner :) i tried to make the main class get the others in the constructor, but it gives a snapshot, and if the data is changed while working, that is not reflected in the parameters. can you explain more about "a map of your custom jpanel"? – Zephyer Jan 10 '12 at 04:50