FileDocCategorySizeDatePackage
JMFrame.javaAPI DocJMF 2.1.1e3775Mon May 12 12:20:30 BST 2003jmapps.ui

JMFrame

public class JMFrame extends Frame implements WindowListener

Fields Summary
protected Frame
frameOwner
private boolean
boolFirstTimeVisible
private Vector
vectorChildFrames
Constructors Summary
public JMFrame()



       
        this ( null, "JMFrame" );
    
public JMFrame(String strTitle)

        this ( null, strTitle );
    
public JMFrame(Frame frameOwner)

        this ( frameOwner, "JMFrame" );
    
public JMFrame(Frame frameOwner, String strTitle)

        super ( strTitle );
        this.frameOwner = frameOwner;
        initFrame ();
    
Methods Summary
public voidaddNotify()

        super.addNotify ();
        autoPosition ();
    
public voidautoPosition()

        autoPosition ( this, frameOwner );
    
public static voidautoPosition(java.awt.Frame frame, java.awt.Frame frameOwner)

        Dimension       dim;
        Dimension       dimOwner;
        Dimension       dimFrame;
        Dimension       dimScreen;
        Point           point;
        Insets          insets;
        Frame           framePrevSibling = null;

        if ( frame == null  ||  frameOwner == null  ||  !frameOwner.isShowing() )
            return;

        if ( frameOwner instanceof JMFrame  &&  ((JMFrame)frameOwner).vectorChildFrames.size() > 0 ) {
            framePrevSibling = (Frame) ((JMFrame)frameOwner).vectorChildFrames.lastElement();
        }

        if ( framePrevSibling != null  &&  framePrevSibling.isShowing() ) {
            point = framePrevSibling.getLocationOnScreen();
            point.x += 20;
            point.y += 20;
        }
        else {
            point = frameOwner.getLocationOnScreen ();
            dimOwner = frameOwner.getSize ();
            point.y += dimOwner.height;
        }

        dim = frame.getPreferredSize ();
        dimFrame = frame.getSize ();
        dimFrame.width = Math.max ( dim.width, dimFrame.width );
        dimFrame.height = Math.max ( dim.height, dimFrame.height );
        dimScreen = Toolkit.getDefaultToolkit().getScreenSize();

        if ( point.x + dimFrame.width > dimScreen.width )
            point.x = dimScreen.width - dimFrame.width;
        if ( point.y + dimFrame.height > dimScreen.height )
            point.y = dimScreen.height - dimFrame.height;
        frame.setLocation ( point );
    
protected voidinitFrame()

        this.addWindowListener ( this );
    
public voidsetVisible(boolean boolVisible)

        if ( boolVisible == true  &&  !this.isVisible()  &&  boolFirstTimeVisible == true ) {
            boolFirstTimeVisible = false;
            autoPosition ();
            if ( frameOwner != null  &&  frameOwner instanceof JMFrame ) {
                ((JMFrame)frameOwner).vectorChildFrames.addElement ( this );
            }
        }
        super.setVisible ( boolVisible );
    
public voidwindowActivated(java.awt.event.WindowEvent event)

    
public voidwindowClosed(java.awt.event.WindowEvent event)

        if ( frameOwner != null  &&  frameOwner instanceof JMFrame
                    &&  ((JMFrame)frameOwner).vectorChildFrames.contains(this) ) {
            ((JMFrame)frameOwner).vectorChildFrames.removeElement ( this );
        }
    
public voidwindowClosing(java.awt.event.WindowEvent event)

        this.dispose ();
    
public voidwindowDeactivated(java.awt.event.WindowEvent event)

    
public voidwindowDeiconified(java.awt.event.WindowEvent event)

    
public voidwindowIconified(java.awt.event.WindowEvent event)

    
public voidwindowOpened(java.awt.event.WindowEvent event)