use of javax.swing.tree.DefaultTreeModel in project jdk8u_jdk by JetBrains.
the class Test4631471 method main.
private static void main() throws Exception {
// the DefaultMutableTreeNode will archive correctly
new Test4631471() {
protected Object getObject() {
return getRoot();
}
}.test(false);
// the DefaultTreeModel will also archive correctly
new Test4631471() {
protected Object getObject() {
return getModel();
}
}.test(false);
// create a new model from the root node
// this simulates the the MetaData ctor:
// registerConstructor("javax.swing.tree.DefaultTreeModel", new String[]{"root"});
new Test4631471() {
protected Object getObject() {
return new DefaultTreeModel((TreeNode) getModel().getRoot());
}
}.test(false);
// the JTree will archive correctly too
new Test4631471() {
protected Object getObject() {
return getTree();
}
}.test(false);
}
use of javax.swing.tree.DefaultTreeModel in project MyPet by xXKeyleXx.
the class LevelCreator method createUIComponents.
private void createUIComponents() {
DefaultMutableTreeNode root = new DefaultMutableTreeNode("");
skillTreeTreeModel = new DefaultTreeModel(root);
skillTreeTree = new JTree(skillTreeTreeModel);
skillTreeTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
createRightclickMenus();
inheritanceComboBoxModel = new DefaultComboBoxModel();
inheritanceComboBox = new JComboBox(inheritanceComboBoxModel);
}
use of javax.swing.tree.DefaultTreeModel in project MyPet by xXKeyleXx.
the class SkilltreeCreator method createUIComponents.
private void createUIComponents() {
DefaultMutableTreeNode root = new DefaultMutableTreeNode("");
skilltreeTreeModel = new DefaultTreeModel(root);
skilltreeTree = new JTree(skilltreeTreeModel);
skilltreeTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
createRightclickMenus();
mobTypeComboBox = new JComboBox(GuiMain.petTypes);
selectedMobtype = SkillTreeMobType.DEFAULT;
skilltreeTreeSetSkilltrees();
}
use of javax.swing.tree.DefaultTreeModel in project knime-core by knime.
the class DecTreePredictorNodeView method modelChanged.
/**
* {@inheritDoc}
*/
@Override
protected void modelChanged() {
DecTreePredictorNodeModel model = this.getNodeModel();
DecisionTree dt = model.getDecisionTree();
if (dt != null) {
// set new model
m_jTree.setModel(new DefaultTreeModel(dt.getRootNode()));
// change default renderer
m_jTree.setCellRenderer(new DecisionTreeNodeRenderer());
// make sure no default height is assumed (the renderer's
// preferred size should be used instead)
m_jTree.setRowHeight(0);
// retrieve HiLiteHandler from Input port
m_hiLiteHdl = model.getInHiLiteHandler(DecTreePredictorNodeModel.INDATAPORT);
// and adjust menu entries for HiLite-ing
m_hiLiteMenu.setEnabled(m_hiLiteHdl != null);
} else {
m_jTree.setModel(null);
}
}
use of javax.swing.tree.DefaultTreeModel in project knime-core by knime.
the class MissingNodeDialog method loadSettingsFrom.
/**
* {@inheritDoc}
*/
@Override
protected void loadSettingsFrom(final NodeSettingsRO settings, final PortObjectSpec[] specs) throws NotConfigurableException {
m_settings = new NodeSettings("ignored");
settings.copyTo(m_settings);
m_tree.setModel(new DefaultTreeModel(settings));
for (int i = m_tree.getRowCount() - 1; i >= 0; i--) {
m_tree.expandRow(i);
}
}
Aggregations