当前位置: 首页>>代码示例>>Java>>正文


Java DefaultMutableTreeNode.setUserObject方法代码示例

本文整理汇总了Java中javax.swing.tree.DefaultMutableTreeNode.setUserObject方法的典型用法代码示例。如果您正苦于以下问题:Java DefaultMutableTreeNode.setUserObject方法的具体用法?Java DefaultMutableTreeNode.setUserObject怎么用?Java DefaultMutableTreeNode.setUserObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.tree.DefaultMutableTreeNode的用法示例。


在下文中一共展示了DefaultMutableTreeNode.setUserObject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updateNotificationsNodeLabel

import javax.swing.tree.DefaultMutableTreeNode; //导入方法依赖的package包/类
/**
 * Update the label of the supplied MBean tree node.
 */
// Call on EDT
private void updateNotificationsNodeLabel(
        DefaultMutableTreeNode node, String label) {
    synchronized (mbeansTab.getTree()) {
        invalidate();
        XNodeInfo oldUserObject = (XNodeInfo) node.getUserObject();
        XNodeInfo newUserObject = new XNodeInfo(
                oldUserObject.getType(), oldUserObject.getData(),
                label, oldUserObject.getToolTipText());
        node.setUserObject(newUserObject);
        DefaultTreeModel model =
                (DefaultTreeModel) mbeansTab.getTree().getModel();
        model.nodeChanged(node);
        validate();
        repaint();
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:21,代码来源:XSheet.java

示例2: traverseFileSystem

import javax.swing.tree.DefaultMutableTreeNode; //导入方法依赖的package包/类
private void traverseFileSystem(Entry poifsNode, DefaultMutableTreeNode treeNode) throws TreeModelLoadException {
	final String qualifier;
	if (poifsNode.getParent() == null) {
		qualifier = "OLERootEntry";
	} else if (poifsNode instanceof DirectoryNode) {
		qualifier = "OLEDirEntry";
	} else {
		qualifier = "OLEEntry";
	}

	treeNode.setUserObject(appContext.getBean(qualifier, poifsNode, treeNode));
	if (poifsNode instanceof DirectoryNode) {
		for (Entry poifsChild : ((DirectoryNode)poifsNode)) {
			DefaultMutableTreeNode treeChild = new DefaultMutableTreeNode();
			treeNode.add(treeChild);
			traverseFileSystem(poifsChild, treeChild);
		}
	}
}
 
开发者ID:kiwiwings,项目名称:poi-visualizer,代码行数:20,代码来源:OLETreeModel.java

示例3: removeMultiple

import javax.swing.tree.DefaultMutableTreeNode; //导入方法依赖的package包/类
@Override
protected void removeMultiple(DefaultMutableTreeNode node){
	
	// --- Remind all needed informations -------------------------------------------
	DefaultMutableTreeNode previousNode = node.getPreviousNode();
	DefaultMutableTreeNode parentNode = (DefaultMutableTreeNode) node.getParent();
	
	DynType dt = (DynType) node.getUserObject();
	JPanel deletePanel = dt.getPanel();
	JPanel parentPanel = (JPanel) deletePanel.getParent();
	
	int movement = (deletePanel.getHeight() + 2) * (-1);
	
	// --- Remove node from the parent node and panel -------------------------------
	DynType dyntype = (DynType) node.getUserObject();
	node.setUserObject(null);
	parentNode.remove(node);
	this.getTreeNodesByDynType().remove(dyntype);
	
	// --- remove the panel from the parent -----------------------------------------
	parentPanel.remove(deletePanel);
	parentPanel.validate();
	this.setPanelBounds(parentPanel);
	
	// --- Now move the rest of the elements on the form ----------------------------
	this.moveAfterAddOrRemove(movement, previousNode);

	// --- refresh the GUI ----------------------------------------------------------
	this.adjustPreferredSize();
	
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:32,代码来源:DynForm.java

示例4: editRayAction

import javax.swing.tree.DefaultMutableTreeNode; //导入方法依赖的package包/类
/**
 * Shows the a dialog allowing the user to edit the ray.
 */
private void editRayAction() {
    // getProperty the currently selected body
    TreePath path = this.tree.getSelectionPath();
    // make sure something is selected
    if (path != null) {
        // getProperty the selected node
        DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent();
        // make sure its a ray that is selected
        if (node.getUserObject() instanceof SandboxRay) {
            // getProperty the ray from the node
            SandboxRay ray = (SandboxRay) node.getUserObject();
            // show the right dialog
            synchronized (Simulation.LOCK) {
                SandboxRay nRay = EditRayDialog.show(ControlUtilities.getParentWindow(this), ray);
                this.simulation.getRays().remove(ray);
                this.simulation.getRays().add(nRay);
                node.setUserObject(nRay);
            }
        }
    }
}
 
开发者ID:dmitrykolesnikovich,项目名称:featurea,代码行数:25,代码来源:SimulationTreePanel.java

示例5: addSection

import javax.swing.tree.DefaultMutableTreeNode; //导入方法依赖的package包/类
private void addSection(final Section section, final DefaultMutableTreeNode parent, final PropertySet ps) {
	DefaultMutableTreeNode secNode = new DefaultMutableTreeNode();
	final HPSFSection secModel = appContext.getBean(HPSFSection.class, section, secNode);
	secNode.setUserObject(secModel);
	parent.add(secNode);
	
	for (final Property p : section.getProperties()) {
		addProperty(p, secNode, ps);
	}
}
 
开发者ID:kiwiwings,项目名称:poi-visualizer,代码行数:11,代码来源:HPSFTreeModel.java

示例6: addProperty

import javax.swing.tree.DefaultMutableTreeNode; //导入方法依赖的package包/类
private void addProperty(final Property property, final DefaultMutableTreeNode parent, final PropertySet ps) {
	DefaultMutableTreeNode propNode = new DefaultMutableTreeNode();
	final HPSFProperty propModel = appContext.getBean(HPSFProperty.class, property, propNode);
	propModel.setPropertySet(ps);
	propNode.setUserObject(propModel);
	parent.add(propNode);
}
 
开发者ID:kiwiwings,项目名称:poi-visualizer,代码行数:8,代码来源:HPSFTreeModel.java

示例7: load

import javax.swing.tree.DefaultMutableTreeNode; //导入方法依赖的package包/类
@Override
public void load(Object source) throws TreeModelLoadException {
	try {
		ppt = new HSLFSlideShow((DirectoryNode)source);
		final DefaultMutableTreeNode slNode = getNamedTreeNode(parent, HSLFSlideShow.POWERPOINT_DOCUMENT);
		HSLFRootEntry rootNode = appContext.getBean(HSLFRootEntry.class, ppt, slNode);
		slNode.setUserObject(rootNode);
		loadRecords(slNode,ppt.getSlideShowImpl().getRecords());
		final DefaultMutableTreeNode picNode = getNamedTreeNode(parent, "Pictures");
		loadPictures(picNode);
		loadCurrentUser(parent);
	} catch (IOException e) {
		throw new TreeModelLoadException("Can't load HSLF slideshow",e);
	}
}
 
开发者ID:kiwiwings,项目名称:poi-visualizer,代码行数:16,代码来源:HSLFTreeModel.java

示例8: loadRecords

import javax.swing.tree.DefaultMutableTreeNode; //导入方法依赖的package包/类
private void loadRecords(final DefaultMutableTreeNode parentNode, final Record[] records) {
	for (final Record r : records) {
		final String qualifier;
		if (r instanceof RecordContainer) {
			qualifier = "HSLFDirEntry";
		} else if (r instanceof PPDrawing) {
			qualifier = "HSLFDrawing";
		} else {
			qualifier = "HSLFEntry";
		}

		final DefaultMutableTreeNode childNode = new DefaultMutableTreeNode();
		final TreeModelEntry dirEntry = (TreeModelEntry)appContext.getBean(qualifier, r, childNode);
		childNode.setUserObject(dirEntry);
		parentNode.add(childNode);

		if (r instanceof RecordContainer) {
			loadRecords(childNode, ((RecordContainer)r).getChildRecords());
		} else if (r instanceof PPDrawing) {
			loadEscherRecords(childNode, ((PPDrawing)r).getEscherRecords());
		} else if (r instanceof PPDrawingGroup) {
			loadEscherRecords(childNode, Collections.singletonList(((PPDrawingGroup)r).getDggContainer()));
		} else if (r instanceof ExOleObjStg) {
			loadOleEmbed(childNode, (ExOleObjStg)r);
		} else if (r instanceof TxMasterStyleAtom) {
			loadTextProp(childNode, "characterStyles", ((TxMasterStyleAtom)r).getCharacterStyles());
			loadTextProp(childNode, "paragraphStyles", ((TxMasterStyleAtom)r).getParagraphStyles());
		}
	}
}
 
开发者ID:kiwiwings,项目名称:poi-visualizer,代码行数:31,代码来源:HSLFTreeModel.java

示例9: refreshInterfaceList

import javax.swing.tree.DefaultMutableTreeNode; //导入方法依赖的package包/类
private void refreshInterfaceList() {
    this.interfacesRootNode.removeAllChildren();
    int i = this.currClassFile.interfaces.getInterfacesCount();
    for (int j = 0; j < i; j++) {
        String str = this.currClassFile.interfaces.getInterfaceName(j);
        DefaultMutableTreeNode localDefaultMutableTreeNode = new DefaultMutableTreeNode(str);
        localDefaultMutableTreeNode.setUserObject(str);
        this.interfacesRootNode.add(localDefaultMutableTreeNode);
    }
    this.treeInterfaces.setModel(new DefaultTreeModel(this.interfacesRootNode));
}
 
开发者ID:dmitrykolesnikovich,项目名称:featurea,代码行数:12,代码来源:GeneralPropPane.java

示例10: loadPictures

import javax.swing.tree.DefaultMutableTreeNode; //导入方法依赖的package包/类
private void loadPictures(final DefaultMutableTreeNode parentNode) {
	for (HSLFPictureData p : ppt.getPictureData()) {
		final DefaultMutableTreeNode childNode = new DefaultMutableTreeNode();
		final HSLFPictureEntry pic = appContext.getBean(HSLFPictureEntry.class, p, childNode);
		childNode.setUserObject(pic);
		parentNode.add(childNode);
	}

}
 
开发者ID:kiwiwings,项目名称:poi-visualizer,代码行数:10,代码来源:HSLFTreeModel.java

示例11: loadEscherRecords

import javax.swing.tree.DefaultMutableTreeNode; //导入方法依赖的package包/类
private void loadEscherRecords(final DefaultMutableTreeNode parentNode, List<EscherRecord> records) {
	for (EscherRecord r : records) {
		final DefaultMutableTreeNode childNode = new DefaultMutableTreeNode();
		final HSLFEscherRecord escher = appContext.getBean(HSLFEscherRecord.class, r, childNode);
		childNode.setUserObject(escher);
		parentNode.add(childNode);
		if (r instanceof EscherContainerRecord) {
			loadEscherRecords(childNode, ((EscherContainerRecord)r).getChildRecords());
		} else if (r instanceof HSLFEscherClientDataRecord) {
			final List<? extends Record> hslfRecords = ((HSLFEscherClientDataRecord)r).getHSLFChildRecords();
			loadRecords(childNode, hslfRecords.toArray(new Record[hslfRecords.size()]));
		}
	}
}
 
开发者ID:kiwiwings,项目名称:poi-visualizer,代码行数:15,代码来源:HSLFTreeModel.java

示例12: load

import javax.swing.tree.DefaultMutableTreeNode; //导入方法依赖的package包/类
@Override
public void load(Object source) throws TreeModelLoadException {
	try {
		wb = new HSSFWorkbook((DirectoryNode)source, true);
		final DefaultMutableTreeNode wbNode = getNamedTreeNode(parent, InternalWorkbook.WORKBOOK_DIR_ENTRY_NAMES);
		HSSFRootEntry rootNode = appContext.getBean(HSSFRootEntry.class, wb, wbNode);
		wbNode.setUserObject(rootNode);
		
		loadRecords(wbNode, wb.getInternalWorkbook().getRecords());
	} catch (IOException e) {
		throw new TreeModelLoadException("Can't load HSSF workbook",e);
	}
}
 
开发者ID:kiwiwings,项目名称:poi-visualizer,代码行数:14,代码来源:HSSFTreeModel.java

示例13: dimensionConfigAdded

import javax.swing.tree.DefaultMutableTreeNode; //导入方法依赖的package包/类
private void dimensionConfigAdded(PlotDimension dimension, DimensionConfig dimensionConfig) {
	PlotConfigurationTreeNode root = (PlotConfigurationTreeNode) this.root;
	DefaultMutableTreeNode child = (DefaultMutableTreeNode) root.getChild(dimension);
	child.setUserObject(dimensionConfig);

	// change selection path
	TreePath path = new TreePath(getPathToRoot(child));
	makeVisibleAndSelect(path);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:10,代码来源:PlotConfigurationTreeModel.java

示例14: initComponents

import javax.swing.tree.DefaultMutableTreeNode; //导入方法依赖的package包/类
private void initComponents() {
    TreeDemo demo = new TreeDemo();
    JTree tree = (JTree) ComponentUtils.findComponent(JTree.class, demo);
    DefaultMutableTreeNode root = (DefaultMutableTreeNode) tree.getModel().getRoot();
    root.setUserObject("Root node [] , / Special");
    Container contentPane = getContentPane();
    contentPane.setLayout(new BorderLayout());
    contentPane.add(new JButton("Click-Me"), BorderLayout.NORTH);
    contentPane.add(demo, BorderLayout.CENTER);
    setSize(640, 480);
    setLocation(100, 100);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:14,代码来源:SwingSet3TreeDemo.java

示例15: getDependencyTree

import javax.swing.tree.DefaultMutableTreeNode; //导入方法依赖的package包/类
private DefaultMutableTreeNode getDependencyTree(Dependency dependency) throws Exception
{
	DefaultMutableTreeNode rootnode = new DefaultMutableTreeNode();
	
	if(dependency.isDirect())
	{
		AIndicator indi = getIndicatorClass(dependency.getDependency()).getConstructor(null).newInstance(null);
		rootnode.setUserObject(indi);
		Dependency[] deps = indi.getDependencies();
		
		if(deps!=null)
		{
			for(Dependency dep:deps)
			{
				rootnode.add(getDependencyTree(dep));
			}
		}
	}
	else
	{
		rootnode.setUserObject(dependency);
		for(String indicator: dependency.getDependencies())
		{
			//Dependency d = dependency.clone();
			//d.setDependency(indicator);
			// d ist hier immer indirect dependency, folglich wird getDependencyTree immer wieder aufgerufen
			// spontan:
			Dependency d = new Dependency(indicator);
			// muss aber noch den rest des codes checken
			rootnode.add(getDependencyTree(d));
		}
	}
	
	return rootnode;
}
 
开发者ID:lead4good,项目名称:open-java-trade-manager,代码行数:36,代码来源:IndicatorFactory.java


注:本文中的javax.swing.tree.DefaultMutableTreeNode.setUserObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。