Jtree配合CheckBox使用?下面代码如何改?
privateJTreegetJTree(){if(jTree==null){jTree=newJTree();DefaultTreeModeltreeModel=nul...
private JTree getJTree() { if (jTree == null) { jTree = new JTree(); DefaultTreeModel treeModel=null; DefaultMutableTreeNode parent=new DefaultMutableTreeNode("车队信息"); DefaultMutableTreeNode node1=new DefaultMutableTreeNode("车队1"); DefaultMutableTreeNode node2=new DefaultMutableTreeNode("京H8888"); DefaultMutableTreeNode node3=new DefaultMutableTreeNode("京J5619"); DefaultMutableTreeNode node4=new DefaultMutableTreeNode("车队2"); DefaultMutableTreeNode node5=new DefaultMutableTreeNode("冀C66155"); DefaultMutableTreeNode node6=new DefaultMutableTreeNode("冀F88088"); treeModel=new DefaultTreeModel(parent); treeModel.insertNodeInto(node1,parent,parent.getChildCount()); treeModel.insertNodeInto(node2,node1,node1.getChildCount()); treeModel.insertNodeInto(node3, node1,node1.getChildCount()); treeModel.insertNodeInto(node4, parent,parent.getChildCount()); treeModel.insertNodeInto(node5, node4,node4.getChildCount()); treeModel.insertNodeInto(node6, node4, node4.getChildCount()); jTree=new JTree(treeModel); jTree.setVisible(true); } return jTree; }
展开
1个回答
展开全部
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询