www.gusucode.com > mbcguitools 工具箱 matlab 源码程序 > mbcguitools/@mbctree/@treenode/treenode.m

    function obj = treenode( varargin )
% mbctree.treenode class constructor 

%  Copyright 2006-2007 The MathWorks, Inc.

% Is the first input argument a udd object derived from me? If it is then
% we are being called as a super class constructor and don't have to
% construct an object
if nargin && isa(varargin{1}, 'mbctree.treenode')
	obj = varargin{1};
	varargin(1) = [];
else
	obj = mbctree.treenode;
end

set( obj, varargin{:} );

% We pass in this object to the java treenode - we can get it back via
% "getNodeData" - this is a little circular - both nodes hold references to
% each other - who knows if the java/udd link can cope with this?
obj.TreeNode = com.mathworks.toolbox.mbc.gui.peer.MBCTreeNodePeer( obj.Name, obj.IconFile, obj );
obj.TreeNode.setEditable( obj.Editable );