解决此问题的一种方法是使用组合而不是继承.您可以将JPanel传递给JTable的子类.
public class TopPanel extends JPanel { private TheTable table; public TopPanel() { table = new TheTable(this); } public void methodToFire() { } } public class TheTable extends JTable { private TopPanel panel; public TheTable(TopPanel panel) { this.panel = panel; this.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { doThing(); } } ); } private void doThing() { this.panel.methodToFire(); } }