1  /*
     2   Copyright aswing.org, see the LICENCE.txt.
     3  */
     4   
     5  import org.aswing.Container;
     6  import org.aswing.JFrame;
     7  import org.aswing.LayoutManager;
     8  import org.aswing.plaf.basic.frame.TitleBarLayout;
     9  import org.aswing.plaf.ComponentUI;
    10  import org.aswing.UIManager;
    11  
    12  /**
    13   * @author iiley
    14   */
    15  class org.aswing.plaf.basic.frame.FrameTitleBar extends Container {
    16  	
    17  	
    18  	private var frame:JFrame;
    19  	
    20  	public function FrameTitleBar(frame:JFrame) {
    21  		super();
    22  		setName("FrameTitleBar");
    23  		this.frame = frame;
    24  		updateUI();
    25  	}
    26  	
    27  	public function setLayout(l:LayoutManager):Void{
    28  		if(l instanceof TitleBarLayout){
    29  			super.setLayout(TitleBarLayout(l));
    30  		}else{
    31  			trace("FrameTitleBar just can accept FrameTitleBar!");
    32  			throw new Error("FrameTitleBar just can accept FrameTitleBar!");
    33  		}
    34  	}
    35  		
    36  	public function getFrame():JFrame{
    37  		return frame;
    38  	}
    39  	
    40      public function updateUI():Void{
    41      	//trace("FrameTitleBar is a instanceof Container? : " + (this instanceof Container));
    42      	setUI(UIManager.getUI(this));
    43      }
    44      
    45      public function setUI(newUI:ComponentUI):Void{
    46      	//trace("FrameTitleBar setUI : " + this);
    47      	super.setUI(newUI);
    48      }
    49  	
    50  	public function getUIClassID():String{
    51  		return "Frame.titleBarUI";
    52  	}
    53  }
    54