players[master].addControllerListener(new PlayerListener());
// Show each Player's Visual Component
for(int i = 0; i < players.length; i++) {
JFrame f = new JFrame();
Container pane = f.getContentPane();
pane.setLayout( new BorderLayout() );
Component vis =
players[i].getVisualComponent();
if ( vis != null ) {
pane.add(vis, BorderLayout.CENTER);
}
if( i == master ) {
f.setTitle("Master Player");
f.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
Component cont =
players[i].getControlPanelComponent();
if( cont != null ) {
pane.add(cont, BorderLayout.SOUTH);
}
} else {
f.setTitle("Managed Controller");
}
if( f.getComponentCount() != 0 ) {
f.pack();
f.setVisible(true);
}
}
}