// ListExample // Modified: Carsten Schuermann // Date: Mon Mar 27 09:11:20 2006 import javax.swing.JFrame; import javax.swing.JSplitPane; public class ListExample{ public static void main(String[] args){ final OOPWindow mainFrame = new OOPWindow(); } } class OOPWindow extends JFrame { OOPWindow(){ setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setSize(700, 400); setTitle("ListExample"); // The delegate pane. final OOPStudentPanel sd = new OOPStudentPanel(); // The selection list on on the left. final Selection students = new Selection(OOPStudent.students); final SelectionPanel sl = new SelectionPanel(students); // Listening relationship 1. students.addListener( new SelectionListener(){ public void selectionChanged(SelectionListener.Event ev){ if (ev.getSelection() == null) sd.setModel(null); else sd.setModel (ev.getSelection() ); }}); // The organization of the window JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sl, sd); splitPane.setOneTouchExpandable(true); splitPane.setDividerLocation(150); this.getContentPane().add( splitPane); setVisible(true); } }