svn-gvsig-desktop / tags / gvSIGv0_6_1RELEASE / frameworks / _fwAndami / src / com / iver / andami / ui / SplashWindow.java @ 5222
History | View | Annotate | Download (3.37 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
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 |
* Generalitat Valenciana
|
22 |
* Conselleria d'Infraestructures i Transport
|
23 |
* Av. Blasco Ib??ez, 50
|
24 |
* 46010 VALENCIA
|
25 |
* SPAIN
|
26 |
*
|
27 |
* +34 963862235
|
28 |
* gvsig@gva.es
|
29 |
* www.gvsig.gva.es
|
30 |
*
|
31 |
* or
|
32 |
*
|
33 |
* IVER T.I. S.A
|
34 |
* Salamanca 50
|
35 |
* 46005 Valencia
|
36 |
* Spain
|
37 |
*
|
38 |
* +34 963163400
|
39 |
* dac@iver.es
|
40 |
*/
|
41 |
package com.iver.andami.ui; |
42 |
|
43 |
import java.awt.BorderLayout; |
44 |
import java.awt.Color; |
45 |
import java.awt.Dimension; |
46 |
import java.awt.Frame; |
47 |
import java.awt.Toolkit; |
48 |
|
49 |
import javax.swing.BorderFactory; |
50 |
import javax.swing.ImageIcon; |
51 |
import javax.swing.JLabel; |
52 |
import javax.swing.JProgressBar; |
53 |
import javax.swing.JWindow; |
54 |
|
55 |
import com.iver.andami.messages.Messages; |
56 |
|
57 |
|
58 |
/**
|
59 |
* Clase del ui que consiste en una imagen y una barra de progreso
|
60 |
*/
|
61 |
public class SplashWindow extends JWindow { |
62 |
/** DOCUMENT ME! */
|
63 |
private static JProgressBar pb; |
64 |
private static JLabel lblStatus; |
65 |
|
66 |
/**
|
67 |
* Creates a new SplashWindow object.
|
68 |
*
|
69 |
* @param filename ruta de la imagen que se quiere mostrar
|
70 |
* @param f null
|
71 |
*/
|
72 |
public SplashWindow(Frame f) { |
73 |
super(f);
|
74 |
|
75 |
String logoName = Messages.get("SplashWindow.logo"); |
76 |
if( logoName == null) { |
77 |
logoName = "logo_en.png";
|
78 |
} |
79 |
JLabel l = new JLabel(new ImageIcon(this.getClass().getClassLoader().getResource("images/"+logoName))); |
80 |
getContentPane().add(l, BorderLayout.CENTER);
|
81 |
|
82 |
lblStatus = new JLabel(Messages.getString("SplashWindow.Iniciando")); |
83 |
lblStatus.setBorder(BorderFactory.createEtchedBorder());
|
84 |
lblStatus.setBackground(Color.WHITE);
|
85 |
pb = new JProgressBar(); |
86 |
getContentPane().add(lblStatus, BorderLayout.NORTH);
|
87 |
getContentPane().add(pb, BorderLayout.SOUTH);
|
88 |
pack(); |
89 |
|
90 |
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); |
91 |
Dimension labelSize = l.getPreferredSize();
|
92 |
setLocation((screenSize.width / 2) - (labelSize.width / 2), |
93 |
(screenSize.height / 2) - (labelSize.height / 2)); |
94 |
setVisible(true);
|
95 |
} |
96 |
|
97 |
/**
|
98 |
* cierra la ventana
|
99 |
*/
|
100 |
public void close() { |
101 |
setVisible(false);
|
102 |
dispose(); |
103 |
} |
104 |
|
105 |
/**
|
106 |
* @see com.iver.mdiApp.ui.AppLoadingListener#process(int)
|
107 |
*/
|
108 |
public static void process(int p, String str) { |
109 |
|
110 |
lblStatus.setText(str); |
111 |
// System.out.println("Porcentaje :" + p);
|
112 |
if (pb.getValue() != p)
|
113 |
{ |
114 |
pb.setValue(p); |
115 |
pb.repaint(); |
116 |
// pb.paint(pb.getGraphics());
|
117 |
} |
118 |
} |
119 |
} |