操作系统安全课程设计报告-0906130204-廖浩伟
validate();
String cname[] = { \映像名称\, \用户名\, \优先权\, \, \线程数\ };
for (int i = 0; i < 5; i++) pb.add(cname[i]);
autoFlush();
pTable.setShowHorizontalLines(false); pTable.setShowVerticalLines(false);
Font font = new Font(\微软雅黑\,Font.PLAIN,12); pTable.setFont(font);
// 单元格内容对齐
DefaultTableCellRenderer r = new DefaultTableCellRenderer();
r.setHorizontalAlignment(JLabel.LEFT);
pTable.setDefaultRenderer(Object.class, r);
// 放置表格的容器
JScrollPane tableP = new JScrollPane(pTable);
tableP.setPreferredSize(new Dimension(500, 450)); tableP.setBounds(15, 12, 480, 410); process_tab.add(tableP);
// 结束进程按钮
JButton kill = new JButton(\结束进程(E)\); kill.setBounds(400, 425, 98, 23); kill.addActionListener(this); process_tab.add(kill);
// 开启新进程按钮
JButton start = new JButton(\新建任务(N)\); start.setBounds(13, 425, 98, 23); start.addActionListener(this); process_tab.add(start);
validate();
}
- 19 -
操作系统安全课程设计报告-0906130204-廖浩伟
3.11服务选项卡
//服务选项卡
public void ServiceTab() throws Exception { validate();
String cname[] = { \名称\, \, \描述\, \状态\, \工作组\ }; for (int i = 0; i < 5; i++) sb.add(cname[i]);
//autoFlush();
sTable.setShowHorizontalLines(false); sTable.setShowVerticalLines(false);
Font font = new Font(\微软雅黑\,Font.PLAIN,12); sTable.setFont(font);
// 单元格内容对齐
DefaultTableCellRenderer r = new DefaultTableCellRenderer();
r.setHorizontalAlignment(JLabel.LEFT);
sTable.setDefaultRenderer(Object.class, r);
// 放置表格的容器
JScrollPane tableS = new JScrollPane(sTable);
tableS.setPreferredSize(new Dimension(500, 450)); tableS.setBounds(15, 12, 480, 410); service_tab.add(tableS);
// 服务按钮
JButton service_btn = new JButton(\服务\); service_btn.setBounds(400, 550, 100, 25); service_btn.addActionListener(this); //service_tab.add(service_btn);
validate();
}
- 20 -
操作系统安全课程设计报告-0906130204-廖浩伟
3.12系统性能选项卡
public void FunctionTab() throws Exception{ validate();
//CPU使用率外框
JPanel cpu_used = new JPanel(); Border b_cpu_used =
BorderFactory.createEtchedBorder(EtchedBorder.LOWERED);
cpu_used.setBorder(BorderFactory.createTitledBorder(b_cpu_used,
\使用率\, TitledBorder.LEFT,TitledBorder.TOP)); cpu_used.setBounds(10, 0, 90, 160); cpu_used.setBackground(Color.WHITE); cpu_used.setLayout(null); function_tab.add(cpu_used);
//CPU使用记录外框
JPanel cpu_record = new JPanel(); Border b_cpu_record =
BorderFactory.createEtchedBorder(EtchedBorder.LOWERED);
cpu_record.setBorder(BorderFactory.createTitledBorder(b_cpu_record,
\使用记录\,
TitledBorder.LEFT,TitledBorder.TOP));
cpu_record.setBounds(110, 0, 390, 160); cpu_record.setBackground(Color.WHITE); cpu_record.setLayout(null); function_tab.add(cpu_record);
//内存外框
JPanel memory_used = new JPanel(); Border b_memory_used =
BorderFactory.createEtchedBorder(EtchedBorder.LOWERED);
memory_used.setBorder(BorderFactory.createTitledBorder(b_memory_used,
\内存\, TitledBorder.LEFT,TitledBorder.TOP)); memory_used.setBounds(10, 160, 90, 160); memory_used.setBackground(Color.WHITE); memory_used.setLayout(null); function_tab.add(memory_used);
- 21 -
操作系统安全课程设计报告-0906130204-廖浩伟
//物理内存使用记录外框
JPanel memory_record = new JPanel(); Border b_memory_record =
BorderFactory.createEtchedBorder(EtchedBorder.LOWERED);
memory_record.setBorder(BorderFactory.createTitledBorder(b_memory_record,
\物理内存使用记录\,
TitledBorder.LEFT,TitledBorder.TOP));
memory_record.setBounds(110, 160, 390, 160); memory_record.setBackground(Color.WHITE); memory_record.setLayout(null); function_tab.add(memory_record);
//物理内存(MB)外框
JPanel physical_memory = new JPanel(); Border b_physical_memory =
BorderFactory.createEtchedBorder(EtchedBorder.LOWERED);
physical_memory.setBorder(BorderFactory.createTitledBorder(b_physical_memory,
\物理内存(MB)\,
TitledBorder.LEFT,TitledBorder.TOP));
physical_memory.setBounds(10, 320, 200, 80); physical_memory.setBackground(Color.WHITE); physical_memory.setLayout(null); function_tab.add(physical_memory);
//系统外框
JPanel sys = new JPanel(); Border b_sys =
BorderFactory.createEtchedBorder(EtchedBorder.LOWERED);
sys.setBorder(BorderFactory.createTitledBorder(b_sys, \系统\, TitledBorder.LEFT,TitledBorder.TOP)); sys.setBounds(220, 320, 200, 100); sys.setBackground(Color.WHITE); sys.setLayout(null); function_tab.add(sys);
//核心内存(MB)外框
JPanel main_memory = new JPanel(); Border b_main_memory =
BorderFactory.createEtchedBorder(EtchedBorder.LOWERED);
- 22 -
操作系统安全课程设计报告-0906130204-廖浩伟
main_memory.setBorder(BorderFactory.createTitledBorder(b_main_memory,
\核心内存(MB)\,
TitledBorder.LEFT,TitledBorder.TOP));
main_memory.setBounds(10, 400, 200, 50); main_memory.setBackground(Color.WHITE); main_memory.setLayout(null); function_tab.add(main_memory);
//资源监视器 按钮
JButton btn_monitor = new JButton(\资源监视器(R)...\); btn_monitor.setBounds(220, 430, 200, 20); function_tab.add(btn_monitor);
//物理内存(MB)中的内容
JLabel jl_total = new JLabel(\总数\); JLabel jl_cache = new JLabel(\已缓存\); JLabel jl_available = new JLabel(\可用\); JLabel jl_free = new JLabel(\空闲\);
jl_total.setBounds(10, 13, 40, 15); jl_cache.setBounds(10, 28, 40, 15);
jl_available.setBounds(10, 43, 40, 15); jl_free.setBounds(10, 58, 40, 15); physical_memory.add(jl_total); physical_memory.add(jl_cache);
physical_memory.add(jl_available); physical_memory.add(jl_free);
//系统中的内容
JLabel jl_jbs = new JLabel(\句柄数\); JLabel jl_xcs = new JLabel(\线程数\); JLabel jl_jcs = new JLabel(\进程数\); JLabel jl_kjsj = new JLabel(\开机时间\); JLabel jl_tj = new JLabel(\提交(GB)\);
jl_jbs.setBounds(10, 13, 50, 15); jl_xcs.setBounds(10, 28, 50, 15); jl_jcs.setBounds(10, 43, 50, 15); jl_kjsj.setBounds(10, 58, 50, 15); jl_tj.setBounds(10, 73, 50, 15); sys.add(jl_jbs); sys.add(jl_xcs);
- 23 -