Author: heuermh
Date: Mon Mar 16 14:23:10 2009
New Revision: 431
Modified:
piccolo2d.java/trunk/examples/src/main/java/edu/umd/cs/piccolo/examples/ScrollingExample.java
Log:
Issue 67 ; fixed issue with example, it was incorrectly adding the scroll
pane to the canvas
Modified:
piccolo2d.java/trunk/examples/src/main/java/edu/umd/cs/piccolo/examples/ScrollingExample.java
==============================================================================
---
piccolo2d.java/trunk/examples/src/main/java/edu/umd/cs/piccolo/examples/ScrollingExample.java
(original)
+++
piccolo2d.java/trunk/examples/src/main/java/edu/umd/cs/piccolo/examples/ScrollingExample.java
Mon Mar 16 14:23:10 2009
@@ -38,6 +38,7 @@
import java.util.Iterator;
import javax.swing.ButtonGroup;
+import javax.swing.JPanel;
import javax.swing.JToggleButton;
import javax.swing.JToolBar;
@@ -77,10 +78,7 @@
public void initialize() {
final PCanvas canvas = getCanvas();
-
final PScrollPane scrollPane = new PScrollPane(canvas);
- getContentPane().add(scrollPane);
-
final PViewport viewport = (PViewport) scrollPane.getViewport();
final PScrollDirector windowSD = viewport.getScrollDirector();
final PScrollDirector documentSD = new DocumentScrollDirector();
@@ -119,6 +117,7 @@
viewport.setScrollDirector(windowSD);
viewport.fireStateChanged();
scrollPane.revalidate();
+ getContentPane().validate();
}
});
document.addActionListener(new ActionListener() {
@@ -126,11 +125,16 @@
viewport.setScrollDirector(documentSD);
viewport.fireStateChanged();
scrollPane.revalidate();
+ getContentPane().validate();
}
});
- getContentPane().add(toolBar, BorderLayout.NORTH);
- getContentPane().validate();
+ JPanel contentPane = new JPanel();
+ contentPane.setLayout(new BorderLayout());
+ contentPane.add("Center", scrollPane);
+ contentPane.add("North", toolBar);
+ setContentPane(contentPane);
+ validate();
}
/**
--~--~---------~--~----~------------~-------~--~----~
Piccolo2D Developers Group: http://groups.google.com/group/piccolo2d-dev?hl=en
-~----------~----~----~----~------~----~------~--~---