>>530
設計方針とか変更不可のクラス等の制約条件とかが分からないけど
手っ取り早くやるならMainPanelとSubPanelの親子関係がそのままなのを前提に
b.addActionListener((MainPanel)getParent());