Mercurial > hg > Members > tatsuki > Alice
comparison src/alice/test/topology/aquarium/MakeFrame.java @ 141:4c71bbfe557d working
add mouse event
author | sugi |
---|---|
date | Thu, 20 Sep 2012 21:35:23 +0900 |
parents | b51d3bf971e7 |
children | 287aae21e7d8 |
comparison
equal
deleted
inserted
replaced
140:b51d3bf971e7 | 141:4c71bbfe557d |
---|---|
24 | 24 |
25 public class MakeFrame { | 25 public class MakeFrame { |
26 | 26 |
27 private int fSizeX = 800; | 27 private int fSizeX = 800; |
28 private int fSizeY = 800; | 28 private int fSizeY = 800; |
29 private Canvas3D canvas; | 29 //private Canvas3D canvas; |
30 private ViewChange canvas; | |
30 private SimpleUniverse universe; | 31 private SimpleUniverse universe; |
31 private JFrame frame; | 32 private JFrame frame; |
32 private ObjectList list = new ObjectList(); | 33 private ObjectList list = new ObjectList(); |
33 | 34 |
34 public MakeFrame(String str){ | 35 public MakeFrame(String str){ |
39 JPanel cp = new JPanel(); | 40 JPanel cp = new JPanel(); |
40 cp.setLayout(null); | 41 cp.setLayout(null); |
41 frame.add(cp); | 42 frame.add(cp); |
42 | 43 |
43 GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration(); | 44 GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration(); |
44 canvas = new Canvas3D(config); | 45 //canvas = new Canvas3D(config); |
46 canvas = new ViewChange(3.0f,0.01f,config); | |
45 canvas.setBounds(0,0,fSizeX,fSizeY); | 47 canvas.setBounds(0,0,fSizeX,fSizeY); |
46 cp.add(canvas); | 48 cp.add(canvas); |
47 | 49 |
48 universe = new SimpleUniverse(canvas); | 50 |
49 universe.addBranchGraph(createLight()); | 51 canvas.universe.addBranchGraph(createLight()); |
50 universe.addBranchGraph(setBackground()); | 52 canvas.universe.addBranchGraph(setBackground()); |
51 | 53 |
52 canvas.addKeyListener(new KeyInputCodeSegment(this)); | 54 canvas.addKeyListener(new KeyInputCodeSegment(this)); |
53 frame.setVisible(true); | 55 frame.setVisible(true); |
54 | 56 |
55 ViewingPlatform camera = universe.getViewingPlatform(); | 57 //ViewingPlatform camera = universe.getViewingPlatform(); |
56 camera.setNominalViewingTransform(); | 58 //camera.setNominalViewingTransform(); |
57 } | 59 } |
58 | 60 |
59 private BranchGroup setBackground(){ | 61 private BranchGroup setBackground(){ |
60 BranchGroup scene = new BranchGroup(); | 62 BranchGroup scene = new BranchGroup(); |
61 BufferedImage img = null; | 63 BufferedImage img = null; |
87 } | 89 } |
88 | 90 |
89 public void register(MakeObject obj){ | 91 public void register(MakeObject obj){ |
90 list.table.add(obj); | 92 list.table.add(obj); |
91 BranchGroup group = obj.createBranch(); | 93 BranchGroup group = obj.createBranch(); |
92 this.universe.addBranchGraph(group); | 94 this.canvas.universe.addBranchGraph(group); |
93 | 95 |
94 } | 96 } |
95 | 97 |
96 public SimpleUniverse getUniverse(){ | 98 public SimpleUniverse getUniverse(){ |
97 return this.universe; | 99 return this.universe; |
98 } | 100 } |
99 | 101 |
100 public Canvas3D getCanvas(){ | 102 public ViewChange getCanvas(){ |
101 return this.canvas; | 103 return this.canvas; |
102 } | 104 } |
103 | 105 |
104 public JFrame getJFrame(){ | 106 public JFrame getJFrame(){ |
105 return this.frame; | 107 return this.frame; |