001: /*
002: * This file is part of the GeOxygene project source files.
003: *
004: * GeOxygene aims at providing an open framework which implements OGC/ISO specifications for
005: * the development and deployment of geographic (GIS) applications. It is a open source
006: * contribution of the COGIT laboratory at the Institut Géographique National (the French
007: * National Mapping Agency).
008: *
009: * See: http://oxygene-project.sourceforge.net
010: *
011: * Copyright (C) 2005 Institut Géographique National
012: *
013: * This library is free software; you can redistribute it and/or modify it under the terms
014: * of the GNU Lesser General Public License as published by the Free Software Foundation;
015: * either version 2.1 of the License, or any later version.
016: *
017: * This library is distributed in the hope that it will be useful, but WITHOUT ANY
018: * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
019: * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
020: *
021: * You should have received a copy of the GNU Lesser General Public License along with
022: * this library (see file LICENSE if present); if not, write to the Free Software
023: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
024: *
025: */
026:
027: package fr.ign.cogit.geoxygene.util.browser;
028:
029: import java.awt.BorderLayout;
030: import java.awt.Dimension;
031: import java.awt.HeadlessException;
032: import java.awt.event.WindowAdapter;
033: import java.awt.event.WindowEvent;
034: import java.net.URL;
035: import java.util.Locale;
036: import java.util.ResourceBundle;
037:
038: import javax.swing.ImageIcon;
039: import javax.swing.JFrame;
040: import javax.swing.JLabel;
041:
042: /**
043: * Cette classe permet l'affichage d'une fenêtre graphique contenant un message d'avertissement lorsqu'un accès à une valeur <b>null</b> est tenté
044: * ou qu'une telle valeur est renvoyée par une méthode déclenchée depuis le navigateur d'objet graphique de GeOxygene.
045: *
046: * @author Thierry Badard & Arnaud Braun
047: * @version 1.0
048: *
049: */
050:
051: public class ObjectBrowserNullPointerFrame extends JFrame {
052:
053: /** Localisation des fichiers d'internationalisation de l'interface. */
054: private static final String I18N_LANGUAGE_FILE_LOCATION = "fr.ign.cogit.geoxygene.util.browser.ObjectBrowserLanguageFile";
055: /** Locale courante. */
056: private Locale currentLocale;
057: /** RessourceBundle lié à la Locale et au fichier d'internationalisation. */
058: private ResourceBundle i18nLanguageFile;
059:
060: /**
061: * Constructeur prinicipal de ObjectBrowserNullPointerFrame.
062: *
063: * @throws HeadlessException
064: */
065: public ObjectBrowserNullPointerFrame() throws HeadlessException {
066:
067: super ();
068:
069: currentLocale = Locale.getDefault();
070: i18nLanguageFile = ResourceBundle.getBundle(
071: I18N_LANGUAGE_FILE_LOCATION, currentLocale);
072: /* i18nLanguageFile = ResourceBundle.getBundle(I18N_LANGUAGE_FILE_LOCATION,new Locale("en", "US")); */
073:
074: setTitle(i18nLanguageFile
075: .getString("NullPointerFrameDefaultTitle"));
076:
077: try {
078: URL imageUrl = this .getClass().getResource(
079: "images/exclamation.gif");
080:
081: JLabel nullPointerLabel = new JLabel(i18nLanguageFile
082: .getString("NullPointerFrameDefaultLabel"),
083: new ImageIcon(imageUrl), JLabel.CENTER);
084:
085: this .getContentPane().add(nullPointerLabel,
086: BorderLayout.CENTER);
087:
088: Dimension frameSize = new Dimension(this .getPreferredSize());
089: this .setSize(new Dimension(375, 80));
090: this .setResizable(false);
091:
092: this .addWindowListener(new WindowAdapter() {
093: public void windowClosing(WindowEvent e) {
094: dispose();
095: }
096: });
097:
098: this .setVisible(true);
099: } catch (NullPointerException e) {
100: //e.printStackTrace();
101: }
102:
103: }
104:
105: }
|