Is PCanvas able to be added to JPanel and JFrame ?

25 views
Skip to first unread message

Paul Peng

unread,
Nov 4, 2014, 11:15:13 PM11/4/14
to piccolo...@googlegroups.com
Dear all,

I'm NewBee to piccolo and try to learn it through manipulating the examples of Piccolo in Java. I'd like to ask is PCanvas able to be added to JPanel and JFrame ?

For example, I have a class classed MyCanvas which extends the PCanvas

1) When I try to add a instance of MyCanvas myCanvas to a JPanel panel through panel.add(myCanvas) method, no view of PNode will be displayed out in JPanel.

2) When I try to add a instance of MyCanvas myCanvas  to a JFrame frame through frame.setContentPane(myCanvas) method, it works and the view of PNode will displayed out in JFrame . But I noticed the JDialog in BirdsEyeViewExample sample class, is using dialog.getContentPane().add(myCanvas) method. Hence, I tried the same method to implement JFrame, it didn't work. This doesn't make sense to me, cause the getContentPane() method of both JFrame and JDialog are return their Container.

Thank you for your time and explanation.
Reply all
Reply to author
Forward
0 new messages