Revision: 965
Author: allain.lalonde
Date: Tue Feb 2 11:20:47 2010
Log: Fixed Issue # 160
Removing component listener from PSwing constructor. Caused more problems
than it solved.
http://code.google.com/p/piccolo2d/source/detail?r=965
Modified:
/piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/pswing/PSwing.java
/piccolo2d.java/trunk/extras/src/test/java/edu/umd/cs/piccolox/pswing/PSwingTest.java
=======================================
---
/piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/pswing/PSwing.java
Thu Jan 28 07:04:37 2010
+++
/piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/pswing/PSwing.java
Tue Feb 2 11:20:47 2010
@@ -323,19 +323,7 @@
public void propertyChange(final PropertyChangeEvent evt) {
updateBounds();
}
- });
-
- component.addComponentListener(new ComponentAdapter() {
- /** {...@inheritdoc} */
- public void componentHidden(final ComponentEvent e) {
- setVisible(false);
- }
-
- /** {...@inheritdoc} */
- public void componentShown(final ComponentEvent e) {
- setVisible(true);
- }
- });
+ });
updateBounds();
listenForCanvas(this);
=======================================
---
/piccolo2d.java/trunk/extras/src/test/java/edu/umd/cs/piccolox/pswing/PSwingTest.java
Thu Jan 28 07:04:37 2010
+++
/piccolo2d.java/trunk/extras/src/test/java/edu/umd/cs/piccolox/pswing/PSwingTest.java
Tue Feb 2 11:20:47 2010
@@ -93,28 +93,7 @@
final BufferedImage img = pSwing.paintComponent();
assertEquals(Color.RED.getRGB(), img.getRGB(50, 50));
- }
-
- public void testHidingComponentHidesPSwing() {
- final JPanel panel = new JPanel();
- final PSwing pSwing = new PSwing(panel);
- panel.setPreferredSize(new Dimension(100, 100));
- pSwing.setBounds(0, 0, 00, 100);
- panel.setVisible(false);
-
- // Wow, do I hate this chunk of code. Turns out that the event
dispatch
- // thread needs time to push the component hidden method before
this
- // test passes
- // There has to be a way of forcing this without a sleep
- assertDelayedSuccess(
- "setting component to invisible did not reflect in
associated PSwing",
- 500, new Predicate() {
-
- public boolean isTrue() {
- return !pSwing.getVisible();
- }
- });
- }
+ }
public void testHidingPNodeHidesComponent() {
final JPanel panel = new JPanel();
--
Piccolo2D Developers Group: http://groups.google.com/group/piccolo2d-dev?hl=en