package iDSS.disp;

import javax.swing.*;
import java.awt.*;
import javax.swing.event.*;

import java.beans.*;


public class DisplayFrame extends JInternalFrame
    implements InternalFrameListener {

    private static int x = 0;
    private static int y = 0;
    //private PropertyChangeSupport pcs;
  
    //private DataManager parentComponent;


    public DisplayFrame (String title, boolean resize,
        boolean close, boolean maximize, boolean iconify, ImageIcon anIcon) {

        super (title, resize, close, maximize, iconify);

        //pcs = new PropertyChangeSupport(this);

        if (anIcon != null)
            setFrameIcon(anIcon);

        x = x+10;
        y = y+10;

        if((x > 600) || (y > 500)) {

            x = 10;
            y = 10;

        } //if((x > 600) || (y > 500))


        setLocation(x,y);
        //setPreferredSize(new Dimension (300,200));
        setMinimumSize(new Dimension (300,200));
        setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        addInternalFrameListener(this);

    } //public DisplayFrame (String title)





    public DisplayFrame (String title, boolean resize,
          boolean close, boolean maximize, boolean iconify, ImageIcon anIcon,int width,int height) {

        super (title, resize, close, maximize, iconify);

        if (anIcon != null)
            setFrameIcon(anIcon);

        x = x+10;
        y = y+10;

        setLocation(x,y);
        //setPreferredSize(new Dimension (width,height));
        setMinimumSize(new Dimension (width,height));
        setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        addInternalFrameListener(this);

    } //public DisplayFrame (...........)





/**
    public void addPropertyChangeListener(PropertyChangeListener l) {

        pcs.addPropertyChangeListener(l);

    } //public void addPropertyChangeListener(PropertyChangeListener l)






    public void removePropertyChangeListener(PropertyChangeListener l) {

        pcs.removePropertyChangeListener(l);

    } //public void removePropertyChangeListener(PropertyChangeListener l)
**/



/***
    private void firePropertyChange(String eventName,Object oldValue,Object newValue) {

        pcs.firePropertyChange(eventName,oldValue,newValue);

    } //private void firePropertyChange(String eventName,Object oldValue,Object newValue)
**/



    public void internalFrameClosing(InternalFrameEvent e) {

        System.out.println("internalFrameClosing");
        //if (parentComponent != null)
        //    parentComponent.listenToInternalFrameEvent(title);
    }


    public void internalFrameClosed(InternalFrameEvent e) {

        System.out.println("internalFrameClosed");
    }

    public void internalFrameOpened(InternalFrameEvent e) {

        System.out.println("internalFrameOpened");

    }

    public void internalFrameIconified(InternalFrameEvent e) {

        System.out.println("internalFrameIconified");

    }

    public void internalFrameDeiconified(InternalFrameEvent e) {

        System.out.println("internalFrameDeiconified");

    }

    public void internalFrameActivated(InternalFrameEvent e) {

        System.out.println("internalFrameActivated");

    }

    public void internalFrameDeactivated(InternalFrameEvent e) {

        System.out.println("internalFrameDeactivated");

    }



    public String toString() {

        return "Generic DisplayFrame";

    } //public String toString()




} //public class DisplayFrame extends JInternalFrame
