GoogleCodeArchive / piccolo2d

Automatically exported from code.google.com/p/piccolo2d
0 stars 0 forks source link

PSwing nodes doen't handle interactions when added to the camera #148

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
The following code demonstrates the problem:

import java.awt.Dimension;

import javax.swing.JFrame;
import javax.swing.JTextField;

import edu.umd.cs.piccolox.pswing.PSwing;
import edu.umd.cs.piccolox.pswing.PSwingCanvas;

public class PSwingCanvasTest {
    public static void main(String[] args) {
        JFrame frame = new JFrame();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.getContentPane().setPreferredSize(new Dimension(600, 600));

        frame.getContentPane().add(buildPSwingCanvas());        
        frame.pack();
        frame.setVisible(true);
    }

    private static PSwingCanvas buildPSwingCanvas() {
        PSwingCanvas canvas = new PSwingCanvas();

        addCameraPSwing(canvas);
        addLayerPSwing(canvas);

        return canvas;
    }

    private static void addCameraPSwing(PSwingCanvas canvas) {
        PSwing swingNode = buildPSwingNode();
        canvas.getCamera().addChild(swingNode);
    }

    private static void addLayerPSwing(PSwingCanvas canvas) {
        PSwing swingNode = buildPSwingNode();
        swingNode.setOffset(200, 0);
        canvas.getLayer().addChild(swingNode);
    }

    private static PSwing buildPSwingNode() {
        JTextField textField = new JTextField();
        textField.setPreferredSize(new Dimension(100, 20));
        return new PSwing(textField);        
    }
}

What is the expected output? What do you see instead?
  Both PSwing nodes should allow focus, but only the one on the right does.

Original issue reported on code.google.com by allain.lalonde on 5 Nov 2009 at 8:34

GoogleCodeExporter commented 9 years ago
Why doesn't google code support editing typos? grrr

Original comment by allain.lalonde on 5 Nov 2009 at 8:35

GoogleCodeExporter commented 9 years ago

Original comment by allain.lalonde on 1 Dec 2009 at 8:45

GoogleCodeExporter commented 9 years ago
Added as PSwingCameraBug

$ svn commit -m "Issue 148 ; adding PSwingCameraBug to examples.pswing.issues 
package" .
Committed revision 1173.

Original comment by heue...@gmail.com on 31 Aug 2012 at 5:16

GoogleCodeExporter commented 9 years ago

Original comment by heue...@gmail.com on 26 Nov 2013 at 9:11