📄 smallframe.java~5~
字号:
package bus;import java.awt.*;import java.awt.event.*;import javax.swing.*;import javax.swing.tree.*; class tree extends JPanel { public tree() { DefaultMutableTreeNode root=new DefaultMutableTreeNode("西西工交公司"); DefaultMutableTreeNode node1=new DefaultMutableTreeNode("线路查询"); DefaultMutableTreeNode node2=new DefaultMutableTreeNode("线路管理"); DefaultMutableTreeNode node3=new DefaultMutableTreeNode("车辆管理"); DefaultMutableTreeNode node4=new DefaultMutableTreeNode("系统维护"); DefaultMutableTreeNode node5=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()); 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,node4,node4.getChildCount()); //line=new DefaultMutableTreeNode("数据初始化"); //treemodel.insertNodeInto(line,node4,node4.getChildCount()); line=new DefaultMutableTreeNode("计算器"); treemodel.insertNodeInto(line,node4,node4.getChildCount()); JTree tree=new JTree(treemodel); tree.setFont(new Font("宋体",Font.PLAIN,20)); JScrollPane scrollPane=new JScrollPane(); scrollPane.setPreferredSize(new Dimension(200,550)); scrollPane.setViewportView(tree); this.add(scrollPane); } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -