All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.alantea.swing.vml.frame.MainFrame Maven / Gradle / Ivy

The newest version!
package net.alantea.swing.vml.frame;

import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;

import net.alantea.swing.layout.percent.PercentLayout;
import net.alantea.tools.configuration.Configuration;
import net.alantea.utils.MultiMessages;
import net.alantea.viewml.annotations.VElement;

/**
 * The Class MainFrame.
 * 
 * Copyright Airbus Defence and Space 2015
 */
@VElement("mainFrame")
public class MainFrame extends Frame
{
   /** Resolution for the screen. */
   public static final Dimension RESOLUTION = new Dimension(
         Configuration.getInteger("Application.resolution.width", 
               Toolkit.getDefaultToolkit().getScreenSize().width), 
         Configuration.getInteger("Application.resolution.height", 
               Toolkit.getDefaultToolkit().getScreenSize().height));
   // -------------------------------------------------------------------------
   // ----- Constructor -------------------------------------------------------
   // -------------------------------------------------------------------------

   /** Default UID. */
   private static final long serialVersionUID = 1L;
   
   private WindowListener _wl;
   
   /**
    * Public constructor.
    */
   public MainFrame()
   {
      super(MultiMessages.get("Application.name"));
      
//      String iconPath = MultiMessages.get("Application.icon");
//      if (!"Application.icon".equals(iconPath))
//      {
//         URL res = this.getClass().getResource(iconPath);
//         setIconImage(ImageTool.loadCompatibleImage(res));
//      }
      
      _wl = new WindowAdapter()
      {
         @Override
         public void windowClosing(WindowEvent e)
         {
            System.exit(0);
         }
      };
      
      addWindowListener(_wl);

      setDecorated(true);
      setLayout(new PercentLayout());

      setBounds(0, 0, RESOLUTION.width, RESOLUTION.height);
   }
   
   /**
    * Get window listener.
    * @return listener
    */
   public WindowListener getWindowsListener()
   {
      return _wl;
   }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy