root / trunk / examples / exaExample1 / src / com / iver / ejemplo / FPanelAbout.java @ 1645
History | View | Annotate | Download (6.16 KB)
1 |
/*
|
---|---|
2 |
* Created on 02-sep-2004
|
3 |
*
|
4 |
* TODO To change the template for this generated file go to
|
5 |
* Window - Preferences - Java - Code Generation - Code and Comments
|
6 |
*/
|
7 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
8 |
*
|
9 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
10 |
*
|
11 |
* This program is free software; you can redistribute it and/or
|
12 |
* modify it under the terms of the GNU General Public License
|
13 |
* as published by the Free Software Foundation; either version 2
|
14 |
* of the License, or (at your option) any later version.
|
15 |
*
|
16 |
* This program is distributed in the hope that it will be useful,
|
17 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
18 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
19 |
* GNU General Public License for more details.
|
20 |
*
|
21 |
* You should have received a copy of the GNU General Public License
|
22 |
* along with this program; if not, write to the Free Software
|
23 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
24 |
*
|
25 |
* For more information, contact:
|
26 |
*
|
27 |
* Generalitat Valenciana
|
28 |
* Conselleria d'Infraestructures i Transport
|
29 |
* Av. Blasco Ib??ez, 50
|
30 |
* 46010 VALENCIA
|
31 |
* SPAIN
|
32 |
*
|
33 |
* +34 963862235
|
34 |
* gvsig@gva.es
|
35 |
* www.gvsig.gva.es
|
36 |
*
|
37 |
* or
|
38 |
*
|
39 |
* IVER T.I. S.A
|
40 |
* Salamanca 50
|
41 |
* 46005 Valencia
|
42 |
* Spain
|
43 |
*
|
44 |
* +34 963163400
|
45 |
* dac@iver.es
|
46 |
*/
|
47 |
package com.iver.ejemplo; |
48 |
|
49 |
import java.awt.BorderLayout; |
50 |
import java.io.FileNotFoundException; |
51 |
import java.io.IOException; |
52 |
|
53 |
import javax.swing.JButton; |
54 |
import javax.swing.JDialog; |
55 |
import javax.swing.JEditorPane; |
56 |
import javax.swing.JLabel; |
57 |
import javax.swing.JPanel; |
58 |
import javax.swing.JScrollPane; |
59 |
import javax.swing.event.HyperlinkEvent; |
60 |
|
61 |
import com.iver.andami.PluginServices; |
62 |
import com.iver.andami.ui.mdiManager.View; |
63 |
import com.iver.andami.ui.mdiManager.ViewInfo; |
64 |
/**
|
65 |
* @author FJP
|
66 |
*
|
67 |
* TODO To change the template for this generated type comment go to
|
68 |
* Window - Preferences - Java - Code Generation - Code and Comments
|
69 |
*/
|
70 |
public class FPanelAbout extends JPanel implements View { |
71 |
|
72 |
private JEditorPane jEditorPane = null; |
73 |
private JScrollPane jScrollPane = null; |
74 |
private JEditorPane jEditorPane1 = null; |
75 |
private JPanel jPanel = null; |
76 |
private JButton jButton = null; |
77 |
|
78 |
private JLabel jLblVersion = null; |
79 |
/**
|
80 |
* This is the default constructor
|
81 |
* @throws FileNotFoundException
|
82 |
*/
|
83 |
public FPanelAbout(){
|
84 |
super();
|
85 |
initialize(); |
86 |
} |
87 |
/**
|
88 |
* This method initializes this
|
89 |
*
|
90 |
* @return void
|
91 |
* @throws FileNotFoundException
|
92 |
*/
|
93 |
private void initialize(){ |
94 |
this.setLayout(new BorderLayout()); |
95 |
this.setSize(600, 450); |
96 |
this.add(getJScrollPane(), java.awt.BorderLayout.CENTER);
|
97 |
this.add(getJPanel(), java.awt.BorderLayout.SOUTH);
|
98 |
} |
99 |
|
100 |
/**
|
101 |
* This method initializes jScrollPane
|
102 |
*
|
103 |
* @return javax.swing.JScrollPane
|
104 |
*/
|
105 |
private JScrollPane getJScrollPane() { |
106 |
if (jScrollPane == null) { |
107 |
jScrollPane = new JScrollPane(); |
108 |
jScrollPane.setPreferredSize(new java.awt.Dimension(300,400)); |
109 |
jScrollPane.setViewportView(getJEditorPane()); |
110 |
} |
111 |
return jScrollPane;
|
112 |
} |
113 |
/**
|
114 |
* This method initializes jEditorPane1
|
115 |
*
|
116 |
* @return javax.swing.JEditorPane
|
117 |
*/
|
118 |
private JEditorPane getJEditorPane() { |
119 |
if (jEditorPane == null) { |
120 |
jEditorPane = new JEditorPane(); |
121 |
|
122 |
jEditorPane.setEditable(false);
|
123 |
jEditorPane.setContentType("text/html");
|
124 |
jEditorPane.setPreferredSize(new java.awt.Dimension(300,200)); |
125 |
|
126 |
java.net.URL aboutURL = FPanelAbout.class.getResource( |
127 |
"/about.htm");
|
128 |
if (aboutURL != null) { |
129 |
try {
|
130 |
jEditorPane.setPage(aboutURL); |
131 |
jEditorPane.addHyperlinkListener(new javax.swing.event.HyperlinkListener() {
|
132 |
public void hyperlinkUpdate(javax.swing.event.HyperlinkEvent e) { |
133 |
if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) |
134 |
{ |
135 |
JEditorPane pane = (JEditorPane) e.getSource(); |
136 |
System.out.println("hyperlinkUpdate()"); // TODO Auto-generated Event stub hyperlinkUpdate() |
137 |
//BrowserControl.displayURL(e.getURL().toString());
|
138 |
// if (e instanceof HTMLFrameHyperlinkEvent) {
|
139 |
} |
140 |
|
141 |
|
142 |
} |
143 |
}); |
144 |
} catch (IOException e) { |
145 |
System.err.println("Attempted to read a bad URL: " + aboutURL); |
146 |
} |
147 |
} else {
|
148 |
System.err.println("Couldn't find file: about.html" + aboutURL.getPath()); |
149 |
} |
150 |
|
151 |
} |
152 |
return jEditorPane;
|
153 |
} |
154 |
/**
|
155 |
* This method initializes jPanel
|
156 |
*
|
157 |
* @return javax.swing.JPanel
|
158 |
*/
|
159 |
private JPanel getJPanel() { |
160 |
if (jPanel == null) { |
161 |
jLblVersion = new JLabel(); |
162 |
jPanel = new JPanel(); |
163 |
jPanel.setLayout(null);
|
164 |
jPanel.setPreferredSize(new java.awt.Dimension(10,50)); |
165 |
jLblVersion.setBounds(31, 20, 172, 17); |
166 |
jLblVersion.setText("Version 0.3 ");
|
167 |
jPanel.add(getJButton(), null);
|
168 |
jPanel.add(jLblVersion, null);
|
169 |
} |
170 |
return jPanel;
|
171 |
} |
172 |
/**
|
173 |
* This method initializes jButton
|
174 |
*
|
175 |
* @return javax.swing.JButton
|
176 |
*/
|
177 |
private JButton getJButton() { |
178 |
if (jButton == null) { |
179 |
jButton = new JButton(); |
180 |
jButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); |
181 |
jButton.setText(PluginServices.getText(this,"Cerrar")); |
182 |
jButton.setBounds(266, 12, 94, 25); |
183 |
jButton.addActionListener(new java.awt.event.ActionListener() {
|
184 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
185 |
System.out.println("actionPerformed()"); // TODO Auto-generated Event stub actionPerformed() |
186 |
if (PluginServices.getMainFrame() != null) |
187 |
{ |
188 |
PluginServices.getMDIManager().closeView(FPanelAbout.this); |
189 |
} |
190 |
else
|
191 |
{ |
192 |
((JDialog) (getParent().getParent().getParent().getParent())).dispose();
|
193 |
} |
194 |
|
195 |
} |
196 |
}); |
197 |
} |
198 |
return jButton;
|
199 |
} |
200 |
/* (non-Javadoc)
|
201 |
* @see com.iver.mdiApp.ui.MDIManager.View#getViewInfo()
|
202 |
*/
|
203 |
public ViewInfo getViewInfo() {
|
204 |
ViewInfo m_ViewInfo = new ViewInfo(ViewInfo.MODALDIALOG|ViewInfo.RESIZABLE);
|
205 |
m_ViewInfo.setTitle("Acerca de...");
|
206 |
|
207 |
return m_ViewInfo;
|
208 |
} |
209 |
/* (non-Javadoc)
|
210 |
* @see com.iver.mdiApp.ui.MDIManager.View#viewActivated()
|
211 |
*/
|
212 |
public void viewActivated() { |
213 |
// TODO Auto-generated method stub
|
214 |
|
215 |
} |
216 |
} // @jve:decl-index=0:visual-constraint="10,10"
|