gvsig-3d / 2.0 / trunk / org.gvsig.gvsig3d / org.gvsig.gvsig3d.swing / org.gvsig.gvsig3d.swing.impl / src / main / java / org / gvsig / gvsig3d / swing / impl / DefaultGvsig3DWindowManager.java @ 380
History | View | Annotate | Download (2.78 KB)
1 |
/* gvSIG 3D extension for gvSIG
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2012 Prodevelop.
|
4 |
*
|
5 |
* This program is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License
|
7 |
* as published by the Free Software Foundation; either version 2
|
8 |
* of the License, or (at your option) any later version.
|
9 |
*
|
10 |
* This program is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
*
|
15 |
* You should have received a copy of the GNU General Public License
|
16 |
* along with this program; if not, write to the Free Software
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
18 |
*
|
19 |
* For more information, contact:
|
20 |
*
|
21 |
* Prodevelop, S.L.
|
22 |
* Pza. Don Juan de Villarrasa, 14 - 5
|
23 |
* 46001 Valencia
|
24 |
* Spain
|
25 |
*
|
26 |
* +34 963 510 612
|
27 |
* +34 963 510 968
|
28 |
* prode@prodevelop.es
|
29 |
* http://www.prodevelop.es
|
30 |
*/
|
31 |
/*
|
32 |
* AUTHORS:
|
33 |
* 2012 AI2 - Instituto Universitario de Automatica e Informatica Industrial.
|
34 |
* Universitat Politecnica de Valencia (UPV)
|
35 |
* http://www.ai2.upv.es
|
36 |
*/
|
37 |
|
38 |
|
39 |
package org.gvsig.gvsig3d.swing.impl; |
40 |
|
41 |
import java.awt.BorderLayout; |
42 |
import java.awt.Dimension; |
43 |
import java.awt.Toolkit; |
44 |
import java.awt.event.ComponentEvent; |
45 |
import java.awt.event.ComponentListener; |
46 |
|
47 |
import javax.swing.JFrame; |
48 |
import javax.swing.JPanel; |
49 |
|
50 |
import org.gvsig.gvsig3d.swing.Gvsig3DWindowManager; |
51 |
|
52 |
/**
|
53 |
* Default implementation for the {@link Gvsig3DWindowManager}.
|
54 |
*
|
55 |
* @author Jesus Zarzoso- jzarzoso@ai2.upv.es
|
56 |
* @version $Id$
|
57 |
*/
|
58 |
public class DefaultGvsig3DWindowManager implements |
59 |
Gvsig3DWindowManager, ComponentListener {
|
60 |
|
61 |
public void showWindow(JPanel panel, String title, int mode) { |
62 |
JFrame frame = new JFrame(); |
63 |
// frame.setAlwaysOnTop(true);
|
64 |
|
65 |
final Dimension s = Toolkit.getDefaultToolkit().getScreenSize(); |
66 |
frame.setLocation(s.width / 4, s.height / 4); |
67 |
|
68 |
frame.setLayout(new BorderLayout()); |
69 |
frame.setTitle(title); |
70 |
frame.add(panel, BorderLayout.CENTER);
|
71 |
|
72 |
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
73 |
|
74 |
frame.setSize(400, 400); |
75 |
panel.addComponentListener(this);
|
76 |
|
77 |
frame.pack(); |
78 |
frame.setVisible(true);
|
79 |
} |
80 |
|
81 |
public void componentHidden(ComponentEvent componentEvent) { |
82 |
JFrame frame =
|
83 |
(JFrame) ((JPanel) componentEvent.getSource()).getRootPane() |
84 |
.getParent(); |
85 |
frame.setVisible(false);
|
86 |
frame.dispose(); |
87 |
} |
88 |
|
89 |
public void componentMoved(ComponentEvent arg0) { |
90 |
// Do nothing
|
91 |
} |
92 |
|
93 |
public void componentResized(ComponentEvent arg0) { |
94 |
// Do nothing
|
95 |
} |
96 |
|
97 |
public void componentShown(ComponentEvent arg0) { |
98 |
// Do nothing
|
99 |
} |
100 |
} |