1 | //////////////////////////////////////////////////////////////////////// |
---|
2 | // |
---|
3 | // This file RayFrame.java is part of SURFEX. |
---|
4 | // |
---|
5 | //////////////////////////////////////////////////////////////////////// |
---|
6 | |
---|
7 | //////////////////////////////////////////////////////////////////////// |
---|
8 | // |
---|
9 | // SURFEX version 0.90.00 |
---|
10 | // ================= |
---|
11 | // |
---|
12 | // Saarland University at Saarbruecken, Germany |
---|
13 | // Department of Mathematics and Computer Science |
---|
14 | // |
---|
15 | // SURFEX on the web: www.surfex.AlgebraicSurface.net |
---|
16 | // |
---|
17 | // Authors: Oliver Labs (2001-2008), Stephan Holzer (2004-2005) |
---|
18 | // |
---|
19 | // Copyright (C) 2001-2008 |
---|
20 | // |
---|
21 | // |
---|
22 | // *NOTICE* |
---|
23 | // ======== |
---|
24 | // |
---|
25 | // This program is free software; you can redistribute it and/or modify it |
---|
26 | // under the terms of the GNU General Public License as published by the |
---|
27 | // Free Software Foundation ( version 3 or later of the License ). |
---|
28 | // |
---|
29 | // See LICENCE.TXT for details. |
---|
30 | // |
---|
31 | ///////////////////////////////////////////////////////////////////////// |
---|
32 | |
---|
33 | import java.awt.BorderLayout; |
---|
34 | import java.awt.Container; |
---|
35 | import java.awt.Image; |
---|
36 | |
---|
37 | import javax.swing.JFrame; |
---|
38 | import javax.swing.JSlider; |
---|
39 | import javax.swing.JTextField; |
---|
40 | |
---|
41 | import javax.swing.*; |
---|
42 | ////////////////////////////////////////////////////////////// |
---|
43 | // |
---|
44 | // class RayFrame |
---|
45 | // |
---|
46 | ////////////////////////////////////////////////////////////// |
---|
47 | |
---|
48 | public class RayFrame extends JFrame { |
---|
49 | private Image theIMG = null; |
---|
50 | |
---|
51 | //UpdateRayframeImmediatlyThread updateRayframeImmediatlyThread; |
---|
52 | |
---|
53 | public RayPanel panel; |
---|
54 | |
---|
55 | public JLabel status=new JLabel(); |
---|
56 | public JLabel info=new JLabel(" "); |
---|
57 | |
---|
58 | long tic,toc=0; |
---|
59 | int fps=0; |
---|
60 | |
---|
61 | int rand; |
---|
62 | |
---|
63 | RayFrame(String name) { |
---|
64 | |
---|
65 | super(name); |
---|
66 | //updateThread=uT; |
---|
67 | Container cp = getContentPane(); |
---|
68 | cp.setLayout(new BorderLayout()); |
---|
69 | panel = new RayPanel(); |
---|
70 | cp.add(panel,BorderLayout.CENTER); |
---|
71 | isWorking(false); |
---|
72 | cp.add(status,BorderLayout.SOUTH); |
---|
73 | setLocation(550, 200); |
---|
74 | repaint(); |
---|
75 | rand=(int)(Math.random()*1000000); |
---|
76 | } |
---|
77 | |
---|
78 | |
---|
79 | |
---|
80 | |
---|
81 | |
---|
82 | public void setInfo(String s){ |
---|
83 | info.setText(s); |
---|
84 | } |
---|
85 | |
---|
86 | public void isWorking(boolean b){ |
---|
87 | if(b){ |
---|
88 | tic=System.currentTimeMillis(); |
---|
89 | status.setText("updating "+fps+"fps"); |
---|
90 | |
---|
91 | }else{ |
---|
92 | status.setText(" "); |
---|
93 | toc=System.currentTimeMillis(); |
---|
94 | // System.out.println(); |
---|
95 | if(toc-tic !=0){ |
---|
96 | fps=(int)(1000/(toc-tic)*1.2); // 1.2 wie lange die anderen sachen ca. wegfressen |
---|
97 | }else{ |
---|
98 | fps=2147483647; |
---|
99 | } |
---|
100 | tic=toc; |
---|
101 | } |
---|
102 | } |
---|
103 | |
---|
104 | public void changeBackground(String picname) { |
---|
105 | // System.out.println("name:"+picname); |
---|
106 | // System.out.println("cp:"+getContentPane().getSize()); |
---|
107 | // System.out.println("ins:"+getInsets()); |
---|
108 | // System.out.println("size:"+getSize()); |
---|
109 | // panel.setSize(getContentPane().getSize()); |
---|
110 | panel.changeBackground(picname); |
---|
111 | } |
---|
112 | } // end class RayFrame |
---|
113 | |
---|
114 | |
---|