14,28d13 < import javax.swing.JSplitPane; < import javax.swing.JScrollPane; < import javax.swing.JList; < import javax.swing.JComponent; < import java.awt.*; < import java.awt.event.*; < import java.util.*; < import java.io.*; < import java.beans.PropertyChangeListener; < import java.beans.PropertyChangeEvent; < < import CH.ifa.draw.framework.*; < import CH.ifa.draw.standard.*; < import CH.ifa.draw.figures.*; < import CH.ifa.draw.util.*; 35,35c20,20 < * @author Wolfram Kaiser --- > * @author Wolfram Kaiser 40,43d24 < private JComponent leftComponent; < private JComponent rightComponent; < private PropertyChangeListener myPropertyChangeListener; < 56,100d36 < myPropertyChangeListener = new PropertyChangeListener() { < public void propertyChange(PropertyChangeEvent evt) { < getRightComponent().repaint(); < getLeftComponent().repaint(); < } < }; < } < < /** < * Opens the window and initializes its contents. < * Clients usually only call but don't override it. < */ < protected JComponent createContents(DrawingView view) { < createRightComponent(view); < createLeftComponent(view); < < if ((getLeftComponent() == null) && (getRightComponent() == null)) { < return super.createContents(view); < } < else if (getLeftComponent() == null) { < return getRightComponent(); < } < else if (getRightComponent() == null) { < return getLeftComponent(); < } < else { < return createSplitPane(view); < } < } < < /** < * Method which creates the basic split pane. Subclasses may override < * this method. < * < * @param view DrawingView for which the JSplitPane should be created < * @return the created JSplitPane < */ < protected JSplitPane createSplitPane(DrawingView view) { < JSplitPane dividedContents = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, < getLeftComponent(), getRightComponent()); < dividedContents.setAlignmentX(JSplitPane.LEFT_ALIGNMENT); < dividedContents.setOneTouchExpandable(true); < dividedContents.addPropertyChangeListener(myPropertyChangeListener); < dividedContents.setDividerLocation(150); < return dividedContents; 102a39,40 > protected Desktop createDesktop() { > return new SplitPaneDesktop(); 103,154d38 < /** < * Method which creates the left component for the JSplitPane. < * Subclasses may override this method but should call setLeftComponent() < * to associate the created component with the JSplitPane. < */ < protected void createLeftComponent(DrawingView view) { < setLeftComponent(new JScrollPane(new JList())); < } < < /** < * Set the left component of the JSplitPane. < * < * @param newLeftComponent left component < */ < protected final void setLeftComponent(JComponent newLeftComponent) { < leftComponent = newLeftComponent; < } < < /** < * Get the left component of the JSplitPane. < * < * @return left component < */ < public JComponent getLeftComponent() { < return leftComponent; < } < < /** < * Method which creates the right component for the JSplitPane. < * Subclasses may override this method but should call setLeftComponent() < * to associate the created component with the JSplitPane. < */ < protected void createRightComponent(DrawingView view) { < setRightComponent(super.createContents(view)); < } < < /** < * Set the right component of the JSplitPane. < * < * @param newRightComponent right component < */ < protected final void setRightComponent(JComponent newRightComponent) { < rightComponent = newRightComponent; < } < < /** < * Get the right component of the JSplitPane. < * < * @return right component < */ < public JComponent getRightComponent() { < return rightComponent;