diff --git a/extras/src/main/java/edu/umd/cs/piccolox/pswing/PSwing.java b/extras/src/main/java/edu/umd/cs/piccolox/pswing/PSwing.java index ba0f9cf..13b8f11 100644 --- a/extras/src/main/java/edu/umd/cs/piccolox/pswing/PSwing.java +++ b/extras/src/main/java/edu/umd/cs/piccolox/pswing/PSwing.java @@ -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); diff --git a/extras/src/test/java/edu/umd/cs/piccolox/pswing/PSwingTest.java b/extras/src/test/java/edu/umd/cs/piccolox/pswing/PSwingTest.java index 0ae6ae3..5382a40 100644 --- a/extras/src/test/java/edu/umd/cs/piccolox/pswing/PSwingTest.java +++ b/extras/src/test/java/edu/umd/cs/piccolox/pswing/PSwingTest.java @@ -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();