📄 forest.java~2~
字号:
package bus;import javax.swing.*;import java.awt.*;import javax.swing.*;import javax.swing.tree.*;public class Forest extends JTree { public Forest() { DefaultMutableTreeNode root=new DefaultMutableTreeNode("西西公交公司"); DefaultMutableTreeNode node1=new DefaultMutableTreeNode("线路查询"); DefaultMutableTreeNode node2=new DefaultMutableTreeNode("线路管理"); DefaultMutableTreeNode node3=new DefaultMutableTreeNode("车辆管理"); DefaultMutableTreeNode node4=new DefaultMutableTreeNode("系统维护"); DefaultMutableTreeNode node5=new DefaultMutableTreeNode("费用管理"); DefaultMutableTreeNode node6=new DefaultMutableTreeNode("小工具"); DefaultTreeModel treemodel=new DefaultTreeModel(root); treemodel.insertNodeInto(node1,root,root.getChildCount()); treemodel.insertNodeInto(node2,root,root.getChildCount()); treemodel.insertNodeInto(node3,root,root.getChildCount()); treemodel.insertNodeInto(node4,root,root.getChildCount()); treemodel.insertNodeInto(node5,root,root.getChildCount()); treemodel.insertNodeInto(node6,root,root.getChildCount()); DefaultMutableTreeNode line=new DefaultMutableTreeNode("公交线路设置"); treemodel.insertNodeInto(line,node1,node1.getChildCount()); line=new DefaultMutableTreeNode("车辆登记"); treemodel.insertNodeInto(line,node3,node3.getChildCount()); line=new DefaultMutableTreeNode("品牌类型"); treemodel.insertNodeInto(line,node3,node3.getChildCount()); line=new DefaultMutableTreeNode("颜色类型"); treemodel.insertNodeInto(line,node3,node3.getChildCount()); line=new DefaultMutableTreeNode("车辆类型"); treemodel.insertNodeInto(line,node3,node3.getChildCount()); line=new DefaultMutableTreeNode("车票收入"); treemodel.insertNodeInto(line,node5,node5.getChildCount()); line=new DefaultMutableTreeNode("维修费用"); treemodel.insertNodeInto(line,node5,node5.getChildCount()); line=new DefaultMutableTreeNode("加油支出"); treemodel.insertNodeInto(line,node5,node5.getChildCount()); line=new DefaultMutableTreeNode("公司注册"); treemodel.insertNodeInto(line,node4,node4.getChildCount()); line=new DefaultMutableTreeNode("修改密码"); treemodel.insertNodeInto(line,node4,node4.getChildCount()); line=new DefaultMutableTreeNode("用户权限"); treemodel.insertNodeInto(line,node4,node4.getChildCount()); line=new DefaultMutableTreeNode("计算器"); treemodel.insertNodeInto(line,node6,node6.getChildCount()); line=new DefaultMutableTreeNode("电话区号邮政编码"); treemodel.insertNodeInto(line,node6,node6.getChildCount()); JTree tree=new JTree(treemodel); tree.setFont(new Font("宋体",Font.PLAIN,20)); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -