Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 
 
 /*
  * Copyright (C) 2006 Sun Microsystems, Inc. All rights reserved. Use is
  * subject to license terms.
  */ 
 
 package org.jdesktop.application;
 
public class FrameView extends View {
    private static final Logger logger = Logger.getLogger(FrameView.class.getName());
    private JFrame frame = null;
    public FrameView(Application application) {
        super(application);
    }

    
Return the JFrame used to show this View

This method may be called at any time; the JFrame is created lazily and cached. For example:

  @Override protected void startup() {
     getFrame().setJMenuBar(createMenuBar());
     show(createMainPanel());
 }
 

Returns:
this application's main frame
    public JFrame getFrame() {
	if ( == null) {
	    String title = getContext().getResourceMap().getString("Application.title");
	     = new JFrame(title);
	    .setName("mainFrame");
	}
	return ;
    }

     
Sets the JFrame use to show this View

This method should be called from the startup method by a subclass that wants to construct and initialize the main frame itself. Most applications can rely on the fact that {code getFrame} lazily constructs the main frame and initializes the frame property.

If the main frame property was already initialized, either implicitly through a call to getFrame or by explicitly calling this method, an IllegalStateException is thrown. If frame is null, an IllegalArgumentException is thrown.

This property is bound.

Parameters:
frame the new value of the frame property
See also:
getFrame()
    public void setFrame(JFrame frame) {
	if (frame == null) {
	    throw new IllegalArgumentException("null JFrame");
	}
	if (this. != null) {
	    throw new IllegalStateException("frame already set");
	}
	this. = frame;
	firePropertyChange("frame"nullthis.);
    }
    public JRootPane getRootPane() {
        return getFrame().getRootPane();
    }
New to GrepCode? Check out our FAQ X