]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.scenegraph.swing/src/org/simantics/scenegraph/swing/JViewportSG.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.scenegraph.swing / src / org / simantics / scenegraph / swing / JViewportSG.java
1 package org.simantics.scenegraph.swing;\r
2 \r
3 import java.awt.Point;\r
4 \r
5 import javax.swing.JComponent;\r
6 import javax.swing.JViewport;\r
7 \r
8 import org.simantics.scenegraph.INode;\r
9 \r
10 public class JViewportSG extends JViewport implements JComponentSG {\r
11 \r
12         private static final long serialVersionUID = 1941565557888406721L;\r
13 \r
14         final private INode node;\r
15         \r
16         public JViewportSG(INode node) {\r
17                 super();\r
18                 this.node = node;\r
19         }\r
20 \r
21         @Override\r
22         public boolean contains(int eventX, int eventY) {\r
23                 return JComponentUtils.contains(eventX, eventY, this, node);\r
24         }\r
25         \r
26         @Override\r
27         public boolean containsTransformed(Point p) {\r
28                 return super.contains(p.x, p.y);\r
29         }\r
30         \r
31         @Override\r
32         public JComponent getComponent() {\r
33                 return this;\r
34         }\r
35         \r
36 }\r